From 1a5adbb7e27575d9e3ae07c1cb23931a03c9b85b Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sun, 8 Apr 2012 10:56:06 -0400 Subject: [PATCH] Table type is an older term for storage engine --- libraries/tbl_info.inc.php | 8 +++---- libraries/tbl_properties.inc.php | 4 ++-- tbl_create.php | 4 ++-- tbl_operations.php | 36 ++++++++++++++++---------------- tbl_relation.php | 20 +++++++++--------- tbl_structure.php | 24 ++++++++++----------- 6 files changed, 48 insertions(+), 48 deletions(-) diff --git a/libraries/tbl_info.inc.php b/libraries/tbl_info.inc.php index 4c126719ae..6d520bd553 100644 --- a/libraries/tbl_info.inc.php +++ b/libraries/tbl_info.inc.php @@ -24,7 +24,7 @@ PMA_checkParameters(array('db', 'table')); * Defining global variables, in case this script is included by a function. * This is necessary because this script can be included by libraries/header.inc.php. */ -global $showtable, $tbl_is_view, $tbl_type, $show_comment, $tbl_collation, +global $showtable, $tbl_is_view, $tbl_storage_engine, $show_comment, $tbl_collation, $table_info_num_rows, $auto_increment; /** @@ -52,16 +52,16 @@ $GLOBALS['showtable'] = PMA_Table::sGetStatusInfo($GLOBALS['db'], $GLOBALS['tabl // need this test because when we are creating a table, we get 0 rows // from the SHOW TABLE query -// and we don't want to mess up the $tbl_type coming from the form +// and we don't want to mess up the $tbl_storage_engine coming from the form if ($showtable) { if (PMA_Table::isView($GLOBALS['db'], $GLOBALS['table'])) { $tbl_is_view = true; - $tbl_type = __('View'); + $tbl_storage_engine = __('View'); $show_comment = null; } else { $tbl_is_view = false; - $tbl_type = isset($showtable['Engine']) + $tbl_storage_engine = isset($showtable['Engine']) ? strtoupper($showtable['Engine']) : ''; // a new comment could be coming from tbl_operations.php diff --git a/libraries/tbl_properties.inc.php b/libraries/tbl_properties.inc.php index ae287f8608..3cbf3eadbd 100644 --- a/libraries/tbl_properties.inc.php +++ b/libraries/tbl_properties.inc.php @@ -669,8 +669,8 @@ if ($action == 'tbl_create.php') {     diff --git a/tbl_create.php b/tbl_create.php index 55d76ba9a6..ca4b41182b 100644 --- a/tbl_create.php +++ b/tbl_create.php @@ -186,8 +186,8 @@ if (isset($_REQUEST['do_save_data'])) { . ' (' . $sql_query . ')'; // Adds table type, character set, comments and partition definition - if (!empty($_REQUEST['tbl_type']) && ($_REQUEST['tbl_type'] != 'Default')) { - $sql_query .= ' ENGINE = ' . $_REQUEST['tbl_type']; + if (!empty($_REQUEST['tbl_storage_engine']) && ($_REQUEST['tbl_storage_engine'] != 'Default')) { + $sql_query .= ' ENGINE = ' . $_REQUEST['tbl_storage_engine']; } if (!empty($_REQUEST['tbl_collation'])) { $sql_query .= PMA_generateCharsetQueryPart($_REQUEST['tbl_collation']); diff --git a/tbl_operations.php b/tbl_operations.php index 61e25c4298..27c3edd6c2 100644 --- a/tbl_operations.php +++ b/tbl_operations.php @@ -52,7 +52,7 @@ require 'libraries/tbl_info.inc.php'; // define some globals here, for improved syntax in the conditionals $is_myisam_or_aria = $is_isam = $is_innodb = $is_berkeleydb = $is_aria = $is_pbxt = false; // set initial value of these globals, based on the current table engine -PMA_set_global_variables_for_engine($tbl_type); +PMA_set_global_variables_for_engine($tbl_storage_engine); if ($is_aria) { // the value for transactional can be implicit @@ -104,12 +104,12 @@ if (isset($_REQUEST['submitoptions'])) { && urldecode($_REQUEST['prev_comment']) !== $_REQUEST['comment']) { $table_alters[] = 'COMMENT = \'' . PMA_sqlAddSlashes($_REQUEST['comment']) . '\''; } - if (! empty($_REQUEST['new_tbl_type']) - && strtolower($_REQUEST['new_tbl_type']) !== strtolower($tbl_type)) { - $table_alters[] = 'ENGINE = ' . $_REQUEST['new_tbl_type']; - $tbl_type = $_REQUEST['new_tbl_type']; + if (! empty($_REQUEST['new_tbl_storage_engine']) + && strtolower($_REQUEST['new_tbl_storage_engine']) !== strtolower($tbl_storage_engine)) { + $table_alters[] = 'ENGINE = ' . $_REQUEST['new_tbl_storage_engine']; + $tbl_storage_engine = $_REQUEST['new_tbl_storage_engine']; // reset the globals for the new engine - PMA_set_global_variables_for_engine($tbl_type); + PMA_set_global_variables_for_engine($tbl_storage_engine); if ($is_aria) { $transactional = (isset($transactional) && $transactional == '0') ? '0' : '1'; $page_checksum = (isset($page_checksum)) ? $page_checksum : ''; @@ -178,7 +178,7 @@ if (isset($_REQUEST['submitoptions'])) { // should not be reported with a Level of Error, so here // I just ignore it. But there are other 1478 messages // that it's better to show. - if (! ($_REQUEST['new_tbl_type'] == 'MyISAM' && $warning['Code'] == '1478' && $warning['Level'] == 'Error')) { + if (! ($_REQUEST['new_tbl_storage_engine'] == 'MyISAM' && $warning['Code'] == '1478' && $warning['Level'] == 'Error')) { $warning_messages[] = $warning['Level'] . ': #' . $warning['Code'] . ' ' . $warning['Message']; } @@ -374,7 +374,7 @@ if (strstr($show_comment, '; InnoDB free') === false) { - + @@ -509,11 +509,11 @@ unset($innodb_engine_plugin, $innodb_plugin_version, $innodb_file_format); // does not return a warning // (if the table was compressed, it can be seen on the Structure page) -if (isset($possible_row_formats[$tbl_type])) { +if (isset($possible_row_formats[$tbl_storage_engine])) { $current_row_format = strtoupper($showtable['Row_format']); echo ''; echo ''; - echo PMA_generate_html_dropdown('new_row_format', $possible_row_formats[$tbl_type], $current_row_format, 'new_row_format'); + echo PMA_generate_html_dropdown('new_row_format', $possible_row_formats[$tbl_storage_engine], $current_row_format, 'new_row_format'); unset($possible_row_formats, $current_row_format); echo ''; echo ''; @@ -859,21 +859,21 @@ if ($cfgRelation['relwork'] && ! $is_innodb) { require 'libraries/footer.inc.php'; -function PMA_set_global_variables_for_engine($tbl_type) +function PMA_set_global_variables_for_engine($tbl_storage_engine) { global $is_myisam_or_aria, $is_innodb, $is_isam, $is_berkeleydb, $is_aria, $is_pbxt; $is_myisam_or_aria = $is_isam = $is_innodb = $is_berkeleydb = $is_aria = $is_pbxt = false; - $upper_tbl_type = strtoupper($tbl_type); + $upper_tbl_storage_engine = strtoupper($tbl_storage_engine); //Options that apply to MYISAM usually apply to ARIA - $is_myisam_or_aria = ($upper_tbl_type == 'MYISAM' || $upper_tbl_type == 'ARIA' || $upper_tbl_type == 'MARIA'); - $is_aria = ($upper_tbl_type == 'ARIA'); + $is_myisam_or_aria = ($upper_tbl_storage_engine == 'MYISAM' || $upper_tbl_storage_engine == 'ARIA' || $upper_tbl_storage_engine == 'MARIA'); + $is_aria = ($upper_tbl_storage_engine == 'ARIA'); - $is_isam = ($upper_tbl_type == 'ISAM'); - $is_innodb = ($upper_tbl_type == 'INNODB'); - $is_berkeleydb = ($upper_tbl_type == 'BERKELEYDB'); - $is_pbxt = ($upper_tbl_type == 'PBXT'); + $is_isam = ($upper_tbl_storage_engine == 'ISAM'); + $is_innodb = ($upper_tbl_storage_engine == 'INNODB'); + $is_berkeleydb = ($upper_tbl_storage_engine == 'BERKELEYDB'); + $is_pbxt = ($upper_tbl_storage_engine == 'PBXT'); } ?> diff --git a/tbl_relation.php b/tbl_relation.php index d2f1c7ac52..80f7e17004 100644 --- a/tbl_relation.php +++ b/tbl_relation.php @@ -132,7 +132,7 @@ $cfgRelation = PMA_getRelationsParam(); if ($cfgRelation['relwork']) { $existrel = PMA_getForeigners($db, $table, '', 'internal'); } -if (PMA_foreignkey_supported($tbl_type)) { +if (PMA_foreignkey_supported($tbl_storage_engine)) { $existrel_foreign = PMA_getForeigners($db, $table, '', 'foreign'); } if ($cfgRelation['displaywork']) { @@ -336,7 +336,7 @@ if ($cfgRelation['displaywork'] && isset($display_field)) { if (isset($destination) && $cfgRelation['relwork']) { $existrel = PMA_getForeigners($db, $table, '', 'internal'); } -if (isset($destination_foreign) && PMA_foreignkey_supported($tbl_type)) { +if (isset($destination_foreign) && PMA_foreignkey_supported($tbl_storage_engine)) { $existrel_foreign = PMA_getForeigners($db, $table, '', 'foreign'); } @@ -356,13 +356,13 @@ echo PMA_generate_common_hidden_inputs($db, $table); // relations -if ($cfgRelation['relwork'] || PMA_foreignkey_supported($tbl_type)) { +if ($cfgRelation['relwork'] || PMA_foreignkey_supported($tbl_storage_engine)) { // To choose relations we first need all tables names in current db // and if the main table supports foreign keys // we use SHOW TABLE STATUS because we need to find other tables of the // same engine. - if (PMA_foreignkey_supported($tbl_type)) { + if (PMA_foreignkey_supported($tbl_storage_engine)) { $tab_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db); // [0] of the row is the name // [1] is the type @@ -383,9 +383,9 @@ if ($cfgRelation['relwork'] || PMA_foreignkey_supported($tbl_type)) { // if foreign keys are supported, collect all keys from other // tables of the same engine - if (PMA_foreignkey_supported($tbl_type) + if (PMA_foreignkey_supported($tbl_storage_engine) && isset($curr_table[1]) - && strtoupper($curr_table[1]) == $tbl_type + && strtoupper($curr_table[1]) == $tbl_storage_engine ) { // explicitely ask for non-quoted list of indexed columns // need to obtain backquoted values to support dots inside values @@ -412,14 +412,14 @@ if (count($columns) > 0) { ' . __('Internal relation'); - if (PMA_foreignkey_supported($tbl_type)) { + if (PMA_foreignkey_supported($tbl_storage_engine)) { echo PMA_showHint(__('An internal relation is not necessary when a corresponding FOREIGN KEY relation exists.')); } echo ''; } - if (PMA_foreignkey_supported($tbl_type)) { + if (PMA_foreignkey_supported($tbl_storage_engine)) { // this does not have to be translated, it's part of the MySQL syntax - echo '' . __('Foreign key constraint') . ' (' . $tbl_type . ')'; + echo '' . __('Foreign key constraint') . ' (' . $tbl_storage_engine . ')'; echo ''; } ?> @@ -476,7 +476,7 @@ if (count($columns) > 0) { '; if (!empty($save_row[$i]['Key'])) { ?> diff --git a/tbl_structure.php b/tbl_structure.php index 6e0c724e36..85b2f3a45e 100644 --- a/tbl_structure.php +++ b/tbl_structure.php @@ -374,7 +374,7 @@ foreach ($fields as $row) { hasColumn($field_name))) { + if ($type == 'text' || $type == 'blob' || 'ARCHIVE' == $tbl_storage_engine || ($primary && $primary->hasColumn($field_name))) { echo $titles['NoPrimary'] . "\n"; $primary_enabled = false; } else { @@ -389,7 +389,7 @@ foreach ($fields as $row) { = 50604)) + if (! empty($tbl_storage_engine) && ($tbl_storage_engine == 'MYISAM' || $tbl_storage_engine == 'ARIA' || $tbl_storage_engine == 'MARIA' || ($tbl_storage_engine == 'INNODB' && PMA_MYSQL_INT_VERSION >= 50604)) // FULLTEXT is possible on TEXT, CHAR and VARCHAR && (strpos(' ' . $type, 'text') || strpos(' ' . $type, 'char'))) { echo "\n"; @@ -571,16 +571,16 @@ PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_browse', __('Browse if (! $tbl_is_view && ! $db_is_information_schema) { PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_change', __('Change'), 'b_edit.png', 'change'); PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_drop', __('Drop'), 'b_drop.png', 'drop'); - if ('ARCHIVE' != $tbl_type) { + if ('ARCHIVE' != $tbl_storage_engine) { PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_primary', __('Primary'), 'b_primary.png', 'primary'); PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_unique', __('Unique'), 'b_unique.png', 'unique'); PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_index', __('Index'), 'b_index.png', 'index'); } - if (! empty($tbl_type) && $tbl_type == 'MYISAM') { + if (! empty($tbl_storage_engine) && $tbl_storage_engine == 'MYISAM') { PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_spatial', __('Spatial'), 'b_spatial.png', 'spatial'); } - if (! empty($tbl_type) && ($tbl_type == 'MYISAM' || $tbl_type == 'ARIA' || $tbl_type == 'MARIA')) { + if (! empty($tbl_storage_engine) && ($tbl_storage_engine == 'MYISAM' || $tbl_storage_engine == 'ARIA' || $tbl_storage_engine == 'MARIA')) { PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_fulltext', __('Fulltext'), 'b_ftext.png', 'ftext'); } } @@ -617,8 +617,8 @@ echo PMA_getIcon('b_print.png', __('Print view'), true); if (! $tbl_is_view && ! $db_is_information_schema) { // if internal relations are available, or foreign keys are supported - // ($tbl_type comes from libraries/tbl_info.inc.php) - if ($cfgRelation['relwork'] || PMA_foreignkey_supported($tbl_type)) { + // ($tbl_storage_engine comes from libraries/tbl_info.inc.php) + if ($cfgRelation['relwork'] || PMA_foreignkey_supported($tbl_storage_engine)) { ?> 20) { * Displays indexes */ -if (! $tbl_is_view && ! $db_is_information_schema && 'ARCHIVE' != $tbl_type) { +if (! $tbl_is_view && ! $db_is_information_schema && 'ARCHIVE' != $tbl_storage_engine) { PMA_generate_slider_effect('indexes', __('Indexes')); /** * Display indexes @@ -808,7 +808,7 @@ if ($cfg['ShowStats']) {