diff --git a/ChangeLog b/ChangeLog index d11372af5..b48e5a3e3 100755 --- a/ChangeLog +++ b/ChangeLog @@ -27,6 +27,11 @@ $Source$ * lib.inc.php3; db_readdump.php3, line 82: restored the use of the remove_remarks function that is required (else sql dump files starting with comments won't be successfully splitted into single queries). + * defines.inc.php3; db_details.php3; ldi_check.php3; lib.inc.php3; + tbl_copy.php3; tbl_create.php3; tbl_dump.php3; tbl_printview.php3; + tbl_properties.inc.php3; tbl_properties.php3; user_details.php3: + replaced MYSQL_MAJOR_VERSION and MYSQL_MINOR_VERSION constants by + MYSQL_INT_VERSION. 2001-08-20 Olivier Müller * db_stats.php3: new file and feature (sorry :) : simply display an diff --git a/db_details.php3 b/db_details.php3 index ec92be98a..92d45361b 100755 --- a/db_details.php3 +++ b/db_details.php3 @@ -39,9 +39,9 @@ if (mysql_error() != '') { } // speedup view on locked tables - staybyte - 11 June 2001 -if ($num_tables > 0 && MYSQL_MAJOR_VERSION >= 3.23 && intval(MYSQL_MINOR_VERSION) >= 3) { +if ($num_tables > 0 && MYSQL_INT_VERSION >= 32303) { // Special speedup for newer MySQL Versions (in 4.0 format changed) - if ($cfgSkipLockedTables == TRUE && MYSQL_MAJOR_VERSION == 3.23 && intval(MYSQL_MINOR_VERSION) >= 30) { + if ($cfgSkipLockedTables == TRUE && MYSQL_INT_VERSION >= 32330) { $query = 'SHOW OPEN TABLES FROM ' . backquote($db); $result = mysql_query($query); // Blending out tables in use @@ -89,7 +89,7 @@ if ($num_tables == 0) { echo $strNoTablesFound . "\n"; } // show table size on mysql >= 3.23 - staybyte - 11 June 2001 -else if (MYSQL_MAJOR_VERSION >= 3.23 && isset($tbl_cache)) { +else if (MYSQL_INT_VERSION >= 32300 && isset($tbl_cache)) { ?> @@ -466,7 +466,7 @@ if ($num_tables > 0) { = 3.23 && intval(MYSQL_MINOR_VERSION) >= 6) { + if (MYSQL_INT_VERSION >= 32306) { ?> > diff --git a/defines.inc.php3 b/defines.inc.php3 index e32b72124..4ef8be112 100755 --- a/defines.inc.php3 +++ b/defines.inc.php3 @@ -5,13 +5,12 @@ /** * DEFINES VARIABLES & CONSTANTS * Overview: - * MYSQL_MAJOR_VERSION (double) - eg: 3.23 - * MYSQL_MINOR_VERSION (double) - eg: 39 * PHPMYADMIN_VERSION (string) - phpMyAdmin version string * PHP_INT_VERSION (int) - eg: 30017 instead of 3.0.17 or * 40006 instead of 4.0.6RC3 * PMA_WINDOWS (bool) - mark if phpMyAdmin running on windows * server + * MYSQL_INT_VERSION (int) - eg: 32339 instead of 3.23.39 */ // phpMyAdmin release if (!defined('PHPMYADMIN_VERSION')) { @@ -51,21 +50,28 @@ if (!defined('MYSQL_MAJOR_VERSION') && isset($link)) { if (!empty($server)) { $result = mysql_query('SELECT VERSION() AS version'); if ($result != FALSE && @mysql_num_rows($result) > 0) { - $row = mysql_fetch_array($result); - define('MYSQL_MAJOR_VERSION', (double)substr($row['version'], 0, 4)); - define('MYSQL_MINOR_VERSION', (double)substr($row['version'], 5)); + $row = mysql_fetch_array($result); + $match = explode('.', $row['version']); } else { $result = @mysql_query('SHOW VARIABLES LIKE \'version\''); if ($result != FALSE && @mysql_num_rows($result) > 0){ - $row = mysql_fetch_row($result); - define('MYSQL_MAJOR_VERSION', (double)substr($row[1], 0, 4)); - define('MYSQL_MINOR_VERSION', (double)substr($row[1], 5)); + $row = mysql_fetch_row($result); + $match = explode('.', $row[1]); } } } // end server id is defined case - if (!defined('MYSQL_MAJOR_VERSION')) { - define('MYSQL_MAJOR_VERSION', 3.21); - define('MYSQL_MINOR_VERSION', 0); - } // end if + + if (!isset($match) || !isset($match[0])) { + $match[0] = 3; + } + if (!isset($match[1])) { + $match[1] = 21; + } + if (!isset($match[2])) { + $match[2] = 0; + } + + define('MYSQL_INT_VERSION', (int)sprintf('%d%02d%02d', $match[0], $match[1], intval($match[2]))); + unset($match); } ?> diff --git a/ldi_check.php3 b/ldi_check.php3 index c72152b71..ecae5ac2f 100755 --- a/ldi_check.php3 +++ b/ldi_check.php3 @@ -65,7 +65,7 @@ if (isset($btnLDI) && ($textfile != 'none')) { $query .= ' LINES TERMINATED BY \'' . $line_terminator . '\''; } if (strlen($column_name) > 0) { - if (MYSQL_MAJOR_VERSION >= 3.23 && intval(MYSQL_MINOR_VERSION) >= 6) { + if (MYSQL_INT_VERSION >= 32306) { $query .= ' ('; $tmp = split(',( ?)', $column_name); for ($i = 0; $i < count($tmp); $i++) { diff --git a/lib.inc.php3 b/lib.inc.php3 index c1806c7fe..8ec9d58af 100755 --- a/lib.inc.php3 +++ b/lib.inc.php3 @@ -130,8 +130,6 @@ if (!defined('__LIB_INC__')){ */ function mysql_die($error_message = '', $the_query = '') { - global $sql_query; - if (!$error_message) { $error_message = mysql_error(); } @@ -424,7 +422,7 @@ if (!defined('__LIB_INC__')){ function backquote($a_name, $do_it = TRUE) { if ($do_it - && MYSQL_MAJOR_VERSION >= 3.23 && intval(MYSQL_MINOR_VERSION) >= 6 + && MYSQL_INT_VERSION >= 32306 && !empty($a_name) && $a_name != '*') { return '`' . $a_name . '`'; } else { @@ -1279,7 +1277,7 @@ var errorMsg2 = ' 20) { + if (MYSQL_MAJOR_VERSION >= 32321) { // Whether to quote table and fields names or not if ($use_backquotes) { mysql_query('SET SQL_QUOTE_SHOW_CREATE = 1'); diff --git a/tbl_copy.php3 b/tbl_copy.php3 index 9b44122f8..3603d4d8e 100755 --- a/tbl_copy.php3 +++ b/tbl_copy.php3 @@ -56,7 +56,7 @@ if (isset($new_name) && trim($new_name) != '') { // Copy the data if ($result != FALSE && $what == 'data') { // speedup copy table - staybyte - 22. Juni 2001 - if (MYSQL_MAJOR_VERSION >= 3.23) { + if (MYSQL_INT_VERSION >= 32300) { $sql_insert_data = 'INSERT INTO ' . backquote($new_name) . ' SELECT * FROM ' . backquote($table); $result = mysql_query($sql_insert_data) or mysql_die(); } // end MySQL >= 3.23 diff --git a/tbl_create.php3 b/tbl_create.php3 index dc8e31edb..5ed6b9d87 100755 --- a/tbl_create.php3 +++ b/tbl_create.php3 @@ -121,7 +121,7 @@ if (isset($submit)) { if (!empty($tbl_type) && ($tbl_type != 'Default')) { $sql_query .= ' TYPE = ' . $tbl_type; } - if (MYSQL_MAJOR_VERSION == 3.23 && !empty($comment)) { + if (MYSQL_INT_VERSION >= 32300 && !empty($comment)) { $sql_query .= ' comment = \'' . sql_addslashes($comment) . '\''; } diff --git a/tbl_dump.php3 b/tbl_dump.php3 index 76eb6791a..466d284cc 100755 --- a/tbl_dump.php3 +++ b/tbl_dump.php3 @@ -170,7 +170,7 @@ else { : '\'' . $db . '\''; $dump_buffer .= $crlf . '# ' . $strGenTime . ': ' . date('F j, Y, g:i a') . $crlf - . '# ' . $strServerVersion . ': ' . MYSQL_MAJOR_VERSION . '.' . MYSQL_MINOR_VERSION . $crlf + . '# ' . $strServerVersion . ': ' . substr(MYSQL_INT_VERSION, 0, 1) . '.' . substr(MYSQL_INT_VERSION, 1, 2) . '.' . substr(MYSQL_INT_VERSION, 3) . $crlf . '# ' . $strPHPVersion . ': ' . phpversion() . $crlf . '# ' . $strDatabase . ': ' . $formatted_db_name . $crlf; diff --git a/tbl_printview.php3 b/tbl_printview.php3 index 84dbe07f1..b789990ab 100755 --- a/tbl_printview.php3 +++ b/tbl_printview.php3 @@ -23,7 +23,7 @@ mysql_select_db($db); /** * Displays the comments of the table is MySQL >= 3.23 */ -if (MYSQL_MAJOR_VERSION >= 3.23) { +if (MYSQL_INT_VERSION >= 32300) { $result = mysql_query('SHOW TABLE STATUS LIKE \'' . sql_addslashes($table, TRUE) . '\'') or mysql_die(); $row = mysql_fetch_array($result); if (!empty($row['Comment'])) { diff --git a/tbl_properties.inc.php3 b/tbl_properties.inc.php3 index ac450a165..376859bc4 100755 --- a/tbl_properties.inc.php3 +++ b/tbl_properties.inc.php3 @@ -216,7 +216,7 @@ for ($i = 0 ; $i < $num_fields; $i++) {
= 3.23) { +if ($action == 'tbl_create.php3' && MYSQL_INT_VERSION >= 32300) { echo "\n"; ?> diff --git a/tbl_properties.php3 b/tbl_properties.php3 index 9f82921c5..9c14b63c3 100755 --- a/tbl_properties.php3 +++ b/tbl_properties.php3 @@ -67,7 +67,7 @@ $url_query = 'lang=' . $lang * Gets table informations */ // 1. Get table type and comments ('show table' works correct since 3.23.03) -if (MYSQL_MAJOR_VERSION >= 3.23 && intval(MYSQL_MINOR_VERSION) >= 3) { +if (MYSQL_INT_VERSION >= 32303) { // Update table type, comment and order if required by the user if (isset($submitcomment)) { if (get_magic_quotes_gpc()) { @@ -326,7 +326,7 @@ $nonisam = FALSE; if (!eregi('ISAM|HEAP', $showtable['Type'])) { $nonisam = TRUE; } -if (MYSQL_MAJOR_VERSION >= 3.23 && intval(MYSQL_MINOR_VERSION) > 3 && $nonisam == FALSE && isset($showtable)) { +if (MYSQL_INT_VERSION >= 32303 && $nonisam == FALSE && isset($showtable)) { // Gets some sizes $mergetable = FALSE; if (isset($showtable['Type']) && $showtable['Type'] == 'MRG_MyISAM') { @@ -625,7 +625,7 @@ while (list($junk, $fieldname) = each($aryFields)) { = 3.23 && MYSQL_MINOR_VERSION >= 34) { +if (MYSQL_INT_VERSION >= 32334) { ?>
  • @@ -695,7 +695,7 @@ echo "\n";
    = 3.23 && intval(MYSQL_MINOR_VERSION) >= 6) { +if (MYSQL_INT_VERSION >= 32306) { ?>
    @@ -820,7 +820,7 @@ echo "\n";
  • = 3.23 && intval(MYSQL_MINOR_VERSION) >= 22) { +if (MYSQL_INT_VERSION >= 32322) { if ($tbl_type == 'MYISAM' or $tbl_type == 'BDB') { ?> diff --git a/user_details.php3 b/user_details.php3 index 714eed562..1c594fced 100644 --- a/user_details.php3 +++ b/user_details.php3 @@ -235,15 +235,11 @@ function grant_operations() } function protect_name(db_or_table) { - var js_mysql_major_version, js_mysql_minor_version; - js_mysql_major_version = ; - js_mysql_minor_version = ; + var js_mysql_version = ; - if (js_mysql_major_version >= "3.23") { - if (js_mysql_minor_version >= "6") { + if (js_mysql_version >= 32306) { return db_or_table; - } } else { return db_or_table;