optimize many tables
This commit is contained in:
@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
|
||||
$Id$
|
||||
$Source$
|
||||
|
||||
2002-02-02 Marc Delisle <lem9@users.sourceforge.net>
|
||||
* db_stats.php3, db_details.php3, mult_submits.inc.php3,
|
||||
tbl_properties.php3: Button to optimize many tables
|
||||
|
||||
2002-02-01 Marc Delisle <lem9@users.sourceforge.net>
|
||||
* tbl_properties.inc.php3, add a link to doc for column types
|
||||
|
||||
|
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
/**
|
||||
* Gets some core libraries
|
||||
*/
|
||||
@@ -23,7 +22,7 @@ $err_url = 'db_details.php3'
|
||||
|
||||
|
||||
/**
|
||||
* Ensures the database exists (else move to the "parent" script) and diplays
|
||||
* Ensures the database exists (else move to the "parent" script) and displays
|
||||
* headers
|
||||
*/
|
||||
if (!isset($is_db) || !$is_db) {
|
||||
@@ -62,7 +61,7 @@ window.parent.frames['nav'].location.replace('./left.php3?lang=<?php echo $lang;
|
||||
* Drop/delete multiple tables if required
|
||||
*/
|
||||
if ((!empty($submit_mult) && isset($selected_tbl))
|
||||
|| isset($mult_btnDrop)) {
|
||||
|| isset($mult_btn)) {
|
||||
$action = 'db_details.php3';
|
||||
include('./mult_submits.inc.php3');
|
||||
}
|
||||
@@ -349,6 +348,8 @@ else if (PMA_MYSQL_INT_VERSION >= 32300) {
|
||||
<input type="submit" name="submit_mult" value="<?php echo $strEmpty; ?>" />
|
||||
<i><?php echo $strOr; ?></i>
|
||||
<input type="submit" name="submit_mult" value="<?php echo $strPrintView; ?>" />
|
||||
<i><?php echo $strOr; ?></i>
|
||||
<input type="submit" name="submit_mult" value="<?php echo $strOptimizeTable; ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@@ -12,7 +12,7 @@ require('./header.inc.php3');
|
||||
* Drop databases if required
|
||||
*/
|
||||
if ((!empty($submit_mult) && isset($selected_db))
|
||||
|| isset($mult_btnDrop)) {
|
||||
|| isset($mult_btn)) {
|
||||
$err_url = 'db_stats.php3'
|
||||
. '?lang=' . $lang
|
||||
. '&server=' . $server;
|
||||
|
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
/**
|
||||
* Confirmation form if required or include of other scripts
|
||||
*/
|
||||
@@ -19,8 +18,18 @@ if (!empty($submit_mult)
|
||||
include('./tbl_printview.php3');
|
||||
exit();
|
||||
} else {
|
||||
$selected = $selected_tbl;
|
||||
$what = (($submit_mult == $strDrop) ? 'drop_tbl' : 'empty_tbl');
|
||||
$selected = $selected_tbl;
|
||||
switch ($submit_mult) {
|
||||
case $strDrop:
|
||||
$what = 'drop_tbl';
|
||||
break;
|
||||
case $strEmpty:
|
||||
$what = 'empty_tbl';
|
||||
break;
|
||||
case $strOptimizeTable:
|
||||
$what = 'optimize_tbl';
|
||||
break;
|
||||
} // end switch
|
||||
}
|
||||
} else {
|
||||
$selected = $selected_fld;
|
||||
@@ -49,6 +58,12 @@ if (!empty($submit_mult)
|
||||
. (($i == $selected_cnt - 1) ? ';<br />' : '');
|
||||
break;
|
||||
|
||||
case 'optimize_tbl':
|
||||
$full_query .= (empty($full_query) ? 'OPTIMIZE TABLE ' : ', ')
|
||||
. PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
|
||||
. (($i == $selected_cnt - 1) ? ';<br />' : '');
|
||||
break;
|
||||
|
||||
case 'empty_tbl':
|
||||
$full_query .= 'DELETE FROM '
|
||||
. PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
|
||||
@@ -94,8 +109,8 @@ if (!empty($submit_mult)
|
||||
}
|
||||
?>
|
||||
<input type="hidden" name="query_type" value="<?php echo $what; ?>" />
|
||||
<input type="submit" name="mult_btnDrop" value="<?php echo $strYes; ?>" />
|
||||
<input type="submit" name="mult_btnDrop" value="<?php echo $strNo; ?>" />
|
||||
<input type="submit" name="mult_btn" value="<?php echo $strYes; ?>" />
|
||||
<input type="submit" name="mult_btn" value="<?php echo $strNo; ?>" />
|
||||
</form>
|
||||
<?php
|
||||
echo"\n";
|
||||
@@ -107,8 +122,8 @@ if (!empty($submit_mult)
|
||||
/**
|
||||
* Executes the query
|
||||
*/
|
||||
else if ((get_magic_quotes_gpc() && stripslashes($mult_btnDrop) == $strYes)
|
||||
|| $mult_btnDrop == $strYes) {
|
||||
else if ((get_magic_quotes_gpc() && stripslashes($mult_btn) == $strYes)
|
||||
|| $mult_btn == $strYes) {
|
||||
|
||||
$sql_query = '';
|
||||
$selected_cnt = count($selected);
|
||||
@@ -127,6 +142,12 @@ else if ((get_magic_quotes_gpc() && stripslashes($mult_btnDrop) == $strYes)
|
||||
$reload = 1;
|
||||
break;
|
||||
|
||||
case 'optimize_tbl':
|
||||
$sql_query .= (empty($sql_query) ? 'OPTIMIZE TABLE ' : ', ')
|
||||
. PMA_backquote(urldecode($selected[$i]))
|
||||
. (($i == $selected_cnt-1) ? ';' : '');
|
||||
break;
|
||||
|
||||
case 'empty_tbl':
|
||||
$a_query = 'DELETE FROM '
|
||||
. PMA_backquote(urldecode($selected[$i]));
|
||||
@@ -139,8 +160,11 @@ else if ((get_magic_quotes_gpc() && stripslashes($mult_btnDrop) == $strYes)
|
||||
break;
|
||||
} // end switch
|
||||
|
||||
// All "DROP TABLE" and "DROP FIELD" statements will be run at once below
|
||||
if ($query_type != 'drop_tbl' && $query_type != 'drop_fld') {
|
||||
// All "DROP TABLE","DROP FIELD" and "OPTIMIZE TABLE" statements
|
||||
// will be run at once below
|
||||
if ($query_type != 'drop_tbl'
|
||||
&& $query_type != 'drop_fld'
|
||||
&& $query_type != 'optimize_tbl') {
|
||||
$sql_query .= $a_query . ';' . "\n";
|
||||
|
||||
if ($query_type != 'drop_db') {
|
||||
@@ -150,7 +174,9 @@ else if ((get_magic_quotes_gpc() && stripslashes($mult_btnDrop) == $strYes)
|
||||
} // end if
|
||||
} // end for
|
||||
|
||||
if ($query_type == 'drop_tbl' || $query_type == 'drop_fld') {
|
||||
if ($query_type == 'drop_tbl'
|
||||
|| $query_type == 'drop_fld'
|
||||
|| $query_type == 'optimize_tbl') {
|
||||
mysql_select_db($db);
|
||||
$result = @mysql_query($sql_query) or PMA_mysqlDie('', '', FALSE, $err_url);
|
||||
}
|
||||
|
@@ -64,7 +64,7 @@ if (!isset($message)) {
|
||||
* Drop/delete mutliple tables if required
|
||||
*/
|
||||
if ((!empty($submit_mult) && isset($selected_fld))
|
||||
|| isset($mult_btnDrop)) {
|
||||
|| isset($mult_btn)) {
|
||||
$action = 'tbl_properties.php3';
|
||||
include('./mult_submits.inc.php3');
|
||||
}
|
||||
|
Reference in New Issue
Block a user