From 373706054873d3ccc7f53533586d9cb7fc558278 Mon Sep 17 00:00:00 2001 From: Sebastian Mendel Date: Tue, 2 Oct 2007 10:39:52 +0000 Subject: [PATCH] removed MySQL < 5 code --- tbl_addfield.php | 9 --------- tbl_alter.php | 10 ---------- tbl_create.php | 13 +------------ tbl_indexes.php | 5 +---- tbl_printview.php | 19 +++++++----------- tbl_relation.php | 37 ++++++++++++----------------------- tbl_select.php | 23 ++++++++++------------ tbl_structure.php | 49 +++++++++++++++++++++-------------------------- 8 files changed, 53 insertions(+), 112 deletions(-) diff --git a/tbl_addfield.php b/tbl_addfield.php index c5ae997e7..21abf792e 100644 --- a/tbl_addfield.php +++ b/tbl_addfield.php @@ -168,15 +168,6 @@ if (isset($submit_num_fields)) { $cfgRelation = PMA_getRelationsParam(); - // garvin: Update comment table, if a comment was set. - if (isset($field_comments) && is_array($field_comments) && $cfgRelation['commwork'] && PMA_MYSQL_INT_VERSION < 40100) { - foreach ($field_comments AS $fieldindex => $fieldcomment) { - if (isset($field_name[$fieldindex]) && strlen($field_name[$fieldindex])) { - PMA_setComment($db, $table, $field_name[$fieldindex], $fieldcomment, '', 'pmadb'); - } - } - } - // garvin: Update comment table for mime types [MIME] if (isset($field_mimetype) && is_array($field_mimetype) && $cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) { foreach ($field_mimetype AS $fieldindex => $mimetype) { diff --git a/tbl_alter.php b/tbl_alter.php index 8fa3d2880..badcb3955 100644 --- a/tbl_alter.php +++ b/tbl_alter.php @@ -83,16 +83,6 @@ if (isset($do_save_data)) { $cfgRelation = PMA_getRelationsParam(); - // take care of pmadb internal comments here - // garvin: Update comment table, if a comment was set. - if (PMA_MYSQL_INT_VERSION < 40100 && isset($field_comments) && is_array($field_comments) && $cfgRelation['commwork']) { - foreach ($field_comments AS $fieldindex => $fieldcomment) { - if (isset($field_name[$fieldindex]) && strlen($field_name[$fieldindex])) { - PMA_setComment($db, $table, $field_name[$fieldindex], $fieldcomment, $field_orig[$fieldindex], 'pmadb'); - } - } - } - // garvin: Rename relations&display fields, if altered. if (($cfgRelation['displaywork'] || $cfgRelation['relwork']) && isset($field_orig) && is_array($field_orig)) { foreach ($field_orig AS $fieldindex => $fieldcontent) { diff --git a/tbl_create.php b/tbl_create.php index e478aa075..ebcfa3303 100644 --- a/tbl_create.php +++ b/tbl_create.php @@ -9,7 +9,6 @@ * @uses $strTable * @uses $strHasBeenCreated * @uses PMA_ENGINE_KEYWORD - * @uses PMA_MYSQL_INT_VERSION * @uses PMA_Table::generateFieldSpec() * @uses PMA_checkParameters() * @uses PMA_generateCharsetQueryPart() @@ -185,7 +184,7 @@ if (isset($_REQUEST['do_save_data'])) { if (!empty($tbl_type) && ($tbl_type != 'Default')) { $sql_query .= ' ' . PMA_ENGINE_KEYWORD . ' = ' . $tbl_type; } - if (PMA_MYSQL_INT_VERSION >= 40100 && !empty($tbl_collation)) { + if (!empty($tbl_collation)) { $sql_query .= PMA_generateCharsetQueryPart($tbl_collation); } @@ -204,16 +203,6 @@ if (isset($_REQUEST['do_save_data'])) { $cfgRelation = PMA_getRelationsParam(); - // garvin: Update comment table, if a comment was set. - if (isset($field_comments) && is_array($field_comments) - && $cfgRelation['commwork'] && PMA_MYSQL_INT_VERSION < 40100) { - foreach ($field_comments as $fieldindex => $fieldcomment) { - if (isset($field_name[$fieldindex]) && strlen($field_name[$fieldindex])) { - PMA_setComment($db, $table, $field_name[$fieldindex], $fieldcomment, '', 'pmadb'); - } - } - } - // garvin: Update comment table for mime types [MIME] if (isset($field_mimetype) && is_array($field_mimetype) && $cfgRelation['commwork'] && $cfgRelation['mimework'] diff --git a/tbl_indexes.php b/tbl_indexes.php index 2a0ec52c2..0a306ac68 100644 --- a/tbl_indexes.php +++ b/tbl_indexes.php @@ -220,10 +220,7 @@ elseif (!defined('PMA_IDX_INCLUDED') $edited_index_data = $indexes_data[$old_index]; - if ((PMA_MYSQL_INT_VERSION < 40002 - && $edited_index_info['Comment'] == 'FULLTEXT') - || (PMA_MYSQL_INT_VERSION >= 40002 - && $edited_index_info['Index_type'] == 'FULLTEXT')) { + if ($edited_index_info['Index_type'] == 'FULLTEXT') { $index_type = 'FULLTEXT'; } elseif ($index == 'PRIMARY') { $index_type = 'PRIMARY'; diff --git a/tbl_printview.php b/tbl_printview.php index 873785f83..a4518b631 100644 --- a/tbl_printview.php +++ b/tbl_printview.php @@ -170,9 +170,7 @@ foreach ($the_tables as $key => $table) { if ($have_rel) { echo '' . $strLinksTo . '' . "\n"; } - if ($cfgRelation['commwork'] || PMA_MYSQL_INT_VERSION >= 40100) { - echo ' ' . $strComments . '' . "\n"; - } + echo ' ' . $strComments . '' . "\n"; if ($cfgRelation['mimework']) { echo ' MIME' . "\n"; } @@ -260,14 +258,12 @@ foreach ($the_tables as $key => $table) { } echo ' ' . "\n"; } - if ($cfgRelation['commwork'] || PMA_MYSQL_INT_VERSION >= 40100) { - echo ' '; - $comments = PMA_getComments($db, $table); - if (isset($comments[$field_name])) { - echo htmlspecialchars($comments[$field_name]); - } - echo ' ' . "\n"; + echo ' '; + $comments = PMA_getComments($db, $table); + if (isset($comments[$field_name])) { + echo htmlspecialchars($comments[$field_name]); } + echo ' ' . "\n"; if ($cfgRelation['mimework']) { $mime_map = PMA_getMIME($db, $table, true); @@ -288,8 +284,7 @@ foreach ($the_tables as $key => $table) { = 40013) { - $sql_query = 'ALTER TABLE ' . PMA_backquote($table) - . ' DROP FOREIGN KEY ' - . PMA_backquote($existrel_innodb[$master_field]['constraint']) . ';'; + $sql_query = 'ALTER TABLE ' . PMA_backquote($table) + . ' DROP FOREIGN KEY ' + . PMA_backquote($existrel_innodb[$master_field]['constraint']) . ';'; - // I tried to send both in one query but it failed - $upd_rs = PMA_DBI_query($sql_query); - $display_query .= $sql_query . "\n"; - } + // I tried to send both in one query but it failed + $upd_rs = PMA_DBI_query($sql_query); + $display_query .= $sql_query . "\n"; // add another $sql_query = 'ALTER TABLE ' . PMA_backquote($table) @@ -203,13 +201,11 @@ if (isset($_REQUEST['destination_innodb'])) { } // end if... else.... } elseif (isset($existrel_innodb[$master_field])) { - if (PMA_MYSQL_INT_VERSION >= 40013) { - $sql_query = 'ALTER TABLE ' . PMA_backquote($table) - . ' DROP FOREIGN KEY ' - . PMA_backquote($existrel_innodb[$master_field]['constraint']); - $sql_query .= ';'; - $display_query .= $sql_query . "\n"; - } + $sql_query = 'ALTER TABLE ' . PMA_backquote($table) + . ' DROP FOREIGN KEY ' + . PMA_backquote($existrel_innodb[$master_field]['constraint']); + $sql_query .= ';'; + $display_query .= $sql_query . "\n"; } // end if... else.... if (! empty($sql_query)) { @@ -407,11 +403,8 @@ if ($col_rs && PMA_DBI_num_rows($col_rs) > 0) { } echo ''; } - if ($tbl_type=='INNODB') { + if ($tbl_type == 'INNODB') { echo 'InnoDB'; - if (PMA_MYSQL_INT_VERSION < 40013) { - echo '(**)'; - } echo ''; } ?> @@ -558,12 +551,6 @@ if ($col_rs && PMA_DBI_num_rows($col_rs) > 0) { ' - .'** ' . sprintf($strUpgrade, 'MySQL', '4.0.13') - .''; -} - /** * Displays the footer */ diff --git a/tbl_select.php b/tbl_select.php index 3aa33e5e5..d6c5acb7a 100644 --- a/tbl_select.php +++ b/tbl_select.php @@ -51,7 +51,7 @@ if (!isset($param) || $param[0] == '') { $err_url = $goto . '?' . PMA_generate_common_url($db, $table); // Gets the list and number of fields - $result = PMA_DBI_query('SHOW' . (PMA_MYSQL_INT_VERSION >= 40100 ? ' FULL' : '') . ' FIELDS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($db) . ';', null, PMA_DBI_QUERY_STORE); + $result = PMA_DBI_query('SHOW FULL FIELDS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($db) . ';', null, PMA_DBI_QUERY_STORE); $fields_cnt = PMA_DBI_num_rows($result); // rabue: we'd better ensure, that all arrays are empty. $fields_list = $fields_null = $fields_type = $fields_collation = array(); @@ -79,7 +79,7 @@ if (!isset($param) || $param[0] == '') { } $fields_null[] = $row['Null']; $fields_type[] = $type; - $fields_collation[] = PMA_MYSQL_INT_VERSION >= 40100 && !empty($row['Collation']) && $row['Collation'] != 'NULL' + $fields_collation[] = !empty($row['Collation']) && $row['Collation'] != 'NULL' ? $row['Collation'] : ''; } // end while @@ -186,7 +186,7 @@ while (list($operator) = each($GLOBALS['cfg']['UnaryOperators'])) { - = 40100 ? '' . $strCollation . '' . "\n" : ''; ?> + @@ -202,8 +202,7 @@ while (list($operator) = each($GLOBALS['cfg']['UnaryOperators'])) { - = 40100 ? '' - . $fields_collation[$i] . '' . "\n" : ''; ?> +