From 0fe04f4b586871f3b49d43eabbf788ca2e88faaf Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Tue, 18 Jan 2005 15:29:27 +0000 Subject: [PATCH] Emulation for MySQL 4.1.2 --- ChangeLog | 4 +++ libraries/storage_engines.lib.php | 60 ++++++++++++++++++++++++++----- server_engines.php | 24 +++++++------ server_links.inc.php | 4 +-- 4 files changed, 71 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 09b6b9013..994d3fb49 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,10 @@ phpMyAdmin - Changelog $Id$ $Source$ +2005-01-18 Alexander M. Turek + * server_engines.php, libraries/storage_engines.lib.php: Emulation for + < MySQL 4.1.2. + 2005-01-17 Michael Keck * libraries/common.lib.php: modified function for Add a link by MySQL-Error #1062 - Duplicate entry diff --git a/libraries/storage_engines.lib.php b/libraries/storage_engines.lib.php index 53bb6c53e..9d2177576 100644 --- a/libraries/storage_engines.lib.php +++ b/libraries/storage_engines.lib.php @@ -4,17 +4,61 @@ /** * Library for extracting information about the available storage engines - * - * Requires at least MySQL 4.1.2 - * TODO: Emulation for earlier versions. */ $GLOBALS['mysql_storage_engines'] = array(); -$res = PMA_DBI_query('SHOW STORAGE ENGINES'); -while ($row = PMA_DBI_fetch_assoc($res)) { - $GLOBALS['mysql_storage_engines'][strtolower($row['Engine'])] = $row; + +if (PMA_MYSQL_INT_VERSION >= 40102) { + /** + * For MySQL >= 4.1.2, the job is easy... + */ + $res = PMA_DBI_query('SHOW STORAGE ENGINES'); + while ($row = PMA_DBI_fetch_assoc($res)) { + $GLOBALS['mysql_storage_engines'][strtolower($row['Engine'])] = $row; + } + PMA_DBI_free_result($res); + unset($res, $row); +} else { + /** + * Emulating SHOW STORAGE ENGINES... + */ + $GLOBALS['mysql_storage_engines'] = array( + 'myisam' => array( + 'Engine' => 'MyISAM', + 'Support' => 'DEFAULT' + ), + 'merge' => array( + 'Engine' => 'MERGE', + 'Support' => 'YES' + ), + 'heap' => array( + 'Engine' => 'HEAP', + 'Support' => 'YES' + ), + 'memory' => array( + 'Engine' => 'MEMORY', + 'Support' => 'YES' + ) + ); + $known_engines = array( + 'archive' => 'ARCHIVE', + 'bdb' => 'BDB', + 'csv' => 'CSV', + 'innodb' => 'InnoDB', + 'isam' => 'ISAM' + ); + $res = PMA_DBI_query('SHOW VARIABLES LIKE \'have\\_%\';'); + while ($row = PMA_DBI_fetch_row($res)) { + $current = substr($row[0], 5); + if (!empty($known_engines[$current])) { + $GLOBALS['mysql_storage_engines'][$current] = array( + 'Engine' => $known_engines[$current], + 'Support' => $row[1] + ); + } + } + PMA_DBI_free_result($res); + unset($known_engines, $res, $row); } -PMA_DBI_free_result($res); -unset($res, $row); ?> diff --git a/server_engines.php b/server_engines.php index 704589fed..22cf8419f 100644 --- a/server_engines.php +++ b/server_engines.php @@ -127,11 +127,13 @@ if (empty($engine) || empty($mysql_storage_engines[$engine])) { . ' ' . "\n" . ' ' . "\n" . ' ' . $strStorageEngine . "\n" - . ' ' . "\n" - . ' ' . "\n" - . ' ' . $strDescription . "\n" - . ' ' . "\n" - . ' ' . "\n" + . ' ' . "\n"; + if (PMA_MYSQL_INT_VERSION >= 40102) { + echo ' ' . "\n" + . ' ' . $strDescription . "\n" + . ' ' . "\n"; + } + echo ' ' . "\n" . ' ' . "\n" . ' ' . "\n"; @@ -147,11 +149,13 @@ if (empty($engine) || empty($mysql_storage_engines[$engine])) { . ' ' . "\n" . ' ' . htmlspecialchars($details['Engine']) . "\n" . ' ' . "\n" - . ' ' . "\n" - . ' ' . "\n" - . ' ' . htmlspecialchars($details['Comment']) . "\n" - . ' ' . "\n" - . ' ' . "\n"; + . ' ' . "\n"; + if (PMA_MYSQL_INT_VERSION >= 40102) { + echo ' ' . "\n" + . ' ' . htmlspecialchars($details['Comment']) . "\n" + . ' ' . "\n"; + } + echo ' ' . "\n"; $useBgcolorOne = !$useBgcolorOne; } unset($useBgcolorOne, $common_url, $engine, $details); diff --git a/server_links.inc.php b/server_links.inc.php index 8ad494a4b..2b2d4b37c 100644 --- a/server_links.inc.php +++ b/server_links.inc.php @@ -53,9 +53,7 @@ if ($cfg['ShowMysqlVars']) { if (PMA_MYSQL_INT_VERSION >= 40100) { echo PMA_printTab(($GLOBALS['cfg']['MainPageIconic'] ? ''.$strCharsets.'' : '') . $strCharsets, 'server_collations.php', $url_query); } -if (PMA_MYSQL_INT_VERSION >= 40102) { - echo PMA_printTab(($GLOBALS['cfg']['MainPageIconic'] ? '' . $strEngines . '' : '') . $strEngines, 'server_engines.php', $url_query); -} +echo PMA_printTab(($GLOBALS['cfg']['MainPageIconic'] ? '' . $strEngines . '' : '') . $strEngines, 'server_engines.php', $url_query); if ($is_superuser) { echo PMA_printTab(($GLOBALS['cfg']['MainPageIconic'] ? ''.$strPrivileges.'' : '') . $strPrivileges, 'server_privileges.php', $url_query); }