diff --git a/libraries/tbl_info.inc.php b/libraries/tbl_info.inc.php index befdb8287..7540763fd 100644 --- a/libraries/tbl_info.inc.php +++ b/libraries/tbl_info.inc.php @@ -36,7 +36,6 @@ global $showtable, $tbl_is_view, $tbl_type, $show_comment, $tbl_collation, // otherwise error #1046, no database selected PMA_DBI_select_db($GLOBALS['db']); -// The 'show table' statement works correct since 3.23.03 $table_info_result = PMA_DBI_query( 'SHOW TABLE STATUS LIKE \'' . PMA_sqlAddslashes($GLOBALS['table'], true) . '\';', null, PMA_DBI_QUERY_STORE); diff --git a/tbl_operations.php b/tbl_operations.php index ef91ce2ad..2cec4ef01 100644 --- a/tbl_operations.php +++ b/tbl_operations.php @@ -47,6 +47,11 @@ PMA_DBI_select_db($GLOBALS['db']); require './libraries/tbl_info.inc.php'; +// define some globals here, for improved syntax in the conditionals +$is_myisam_or_maria = $is_isam = $is_innodb = $is_berkeleydb = false; +// set initial value of these globals, based on the current table engine +PMA_set_global_variables_for_engine($tbl_type); + $reread_info = false; $table_alters = array(); @@ -75,6 +80,8 @@ if (isset($_REQUEST['submitoptions'])) { && strtolower($_REQUEST['new_tbl_type']) !== strtolower($tbl_type)) { $table_alters[] = 'ENGINE = ' . $_REQUEST['new_tbl_type']; $tbl_type = $_REQUEST['new_tbl_type']; + // reset the globals for the new engine + PMA_set_global_variables_for_engine($tbl_type); } if (! empty($_REQUEST['tbl_collation']) @@ -82,9 +89,7 @@ if (isset($_REQUEST['submitoptions'])) { $table_alters[] = 'DEFAULT ' . PMA_generateCharsetQueryPart($_REQUEST['tbl_collation']); } - $l_tbl_type = strtolower($tbl_type); - - if (($l_tbl_type === 'myisam' || $l_tbl_type === 'isam') + if (($is_myisam_or_maria || $is_isam) && isset($_REQUEST['new_pack_keys']) && $_REQUEST['new_pack_keys'] != (string)$pack_keys) { $table_alters[] = 'pack_keys = ' . $_REQUEST['new_pack_keys']; @@ -92,19 +97,19 @@ if (isset($_REQUEST['submitoptions'])) { $checksum = empty($checksum) ? '0' : '1'; $_REQUEST['new_checksum'] = empty($_REQUEST['new_checksum']) ? '0' : '1'; - if (($l_tbl_type === 'myisam') + if ($is_myisam_or_maria && $_REQUEST['new_checksum'] !== $checksum) { $table_alters[] = 'checksum = ' . $_REQUEST['new_checksum']; } $delay_key_write = empty($delay_key_write) ? '0' : '1'; $_REQUEST['new_delay_key_write'] = empty($_REQUEST['new_delay_key_write']) ? '0' : '1'; - if (($l_tbl_type === 'myisam') + if ($is_myisam_or_maria && $_REQUEST['new_delay_key_write'] !== $delay_key_write) { $table_alters[] = 'delay_key_write = ' . $_REQUEST['new_delay_key_write']; } - if (($l_tbl_type === 'myisam' || $l_tbl_type === 'innodb') + if (($is_myisam_or_maria || $is_innodb) && ! empty($_REQUEST['new_auto_increment']) && (! isset($auto_increment) || $_REQUEST['new_auto_increment'] !== $auto_increment)) { $table_alters[] = 'auto_increment = ' . PMA_sqlAddslashes($_REQUEST['new_auto_increment']); @@ -299,10 +304,10 @@ if (strstr($show_comment, '; InnoDB free') === false) {