Emulation for MySQL 4.1.2

This commit is contained in:
Alexander M. Turek
2005-01-18 15:29:27 +00:00
parent 84cf122c3b
commit 0fe04f4b58
4 changed files with 71 additions and 21 deletions

View File

@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
$Id$ $Id$
$Source$ $Source$
2005-01-18 Alexander M. Turek <me@derrabus.de>
* server_engines.php, libraries/storage_engines.lib.php: Emulation for
< MySQL 4.1.2.
2005-01-17 Michael Keck <mkkeck@users.sourceforge.net> 2005-01-17 Michael Keck <mkkeck@users.sourceforge.net>
* libraries/common.lib.php: modified function for * libraries/common.lib.php: modified function for
Add a link by MySQL-Error #1062 - Duplicate entry Add a link by MySQL-Error #1062 - Duplicate entry

View File

@@ -4,17 +4,61 @@
/** /**
* Library for extracting information about the available storage engines * 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(); $GLOBALS['mysql_storage_engines'] = array();
if (PMA_MYSQL_INT_VERSION >= 40102) {
/**
* For MySQL >= 4.1.2, the job is easy...
*/
$res = PMA_DBI_query('SHOW STORAGE ENGINES'); $res = PMA_DBI_query('SHOW STORAGE ENGINES');
while ($row = PMA_DBI_fetch_assoc($res)) { while ($row = PMA_DBI_fetch_assoc($res)) {
$GLOBALS['mysql_storage_engines'][strtolower($row['Engine'])] = $row; $GLOBALS['mysql_storage_engines'][strtolower($row['Engine'])] = $row;
} }
PMA_DBI_free_result($res); PMA_DBI_free_result($res);
unset($res, $row); 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);
}
?> ?>

View File

@@ -127,11 +127,13 @@ if (empty($engine) || empty($mysql_storage_engines[$engine])) {
. ' <tr>' . "\n" . ' <tr>' . "\n"
. ' <th>' . "\n" . ' <th>' . "\n"
. ' ' . $strStorageEngine . "\n" . ' ' . $strStorageEngine . "\n"
. ' </th>' . "\n" . ' </th>' . "\n";
. ' <th>' . "\n" if (PMA_MYSQL_INT_VERSION >= 40102) {
echo ' <th>' . "\n"
. ' ' . $strDescription . "\n" . ' ' . $strDescription . "\n"
. ' </th>' . "\n" . ' </th>' . "\n";
. ' </tr>' . "\n" }
echo ' </tr>' . "\n"
. ' </thead>' . "\n" . ' </thead>' . "\n"
. ' <tbody>' . "\n"; . ' <tbody>' . "\n";
@@ -147,11 +149,13 @@ if (empty($engine) || empty($mysql_storage_engines[$engine])) {
. ' <a href="' . $common_url . $engine . '">' . "\n" . ' <a href="' . $common_url . $engine . '">' . "\n"
. ' ' . htmlspecialchars($details['Engine']) . "\n" . ' ' . htmlspecialchars($details['Engine']) . "\n"
. ' </a>' . "\n" . ' </a>' . "\n"
. ' </td>' . "\n" . ' </td>' . "\n";
. ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '">' . "\n" if (PMA_MYSQL_INT_VERSION >= 40102) {
echo ' <td bgcolor="' . ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']) . '">' . "\n"
. ' ' . htmlspecialchars($details['Comment']) . "\n" . ' ' . htmlspecialchars($details['Comment']) . "\n"
. ' </td>' . "\n" . ' </td>' . "\n";
. ' </tr>' . "\n"; }
echo ' </tr>' . "\n";
$useBgcolorOne = !$useBgcolorOne; $useBgcolorOne = !$useBgcolorOne;
} }
unset($useBgcolorOne, $common_url, $engine, $details); unset($useBgcolorOne, $common_url, $engine, $details);

View File

@@ -53,9 +53,7 @@ if ($cfg['ShowMysqlVars']) {
if (PMA_MYSQL_INT_VERSION >= 40100) { if (PMA_MYSQL_INT_VERSION >= 40100) {
echo PMA_printTab(($GLOBALS['cfg']['MainPageIconic'] ? '<img src="' . $GLOBALS['pmaThemeImage'] . 's_asci.png" width="16" height="16" border="0" hspace="2" align="middle" alt="'.$strCharsets.'" />' : '') . $strCharsets, 'server_collations.php', $url_query); echo PMA_printTab(($GLOBALS['cfg']['MainPageIconic'] ? '<img src="' . $GLOBALS['pmaThemeImage'] . 's_asci.png" width="16" height="16" border="0" hspace="2" align="middle" alt="'.$strCharsets.'" />' : '') . $strCharsets, 'server_collations.php', $url_query);
} }
if (PMA_MYSQL_INT_VERSION >= 40102) {
echo PMA_printTab(($GLOBALS['cfg']['MainPageIconic'] ? '<img src="' . $GLOBALS['pmaThemeImage'] . 's_process.png" width="16" height="16" border="0" hspace="2" align="middle" alt="' . $strEngines . '" />' : '') . $strEngines, 'server_engines.php', $url_query); echo PMA_printTab(($GLOBALS['cfg']['MainPageIconic'] ? '<img src="' . $GLOBALS['pmaThemeImage'] . 's_process.png" width="16" height="16" border="0" hspace="2" align="middle" alt="' . $strEngines . '" />' : '') . $strEngines, 'server_engines.php', $url_query);
}
if ($is_superuser) { if ($is_superuser) {
echo PMA_printTab(($GLOBALS['cfg']['MainPageIconic'] ? '<img src="' . $GLOBALS['pmaThemeImage'] . 's_rights.png" width="16" height="16" border="0" hspace="2" align="middle" alt="'.$strPrivileges.'" />' : '') . $strPrivileges, 'server_privileges.php', $url_query); echo PMA_printTab(($GLOBALS['cfg']['MainPageIconic'] ? '<img src="' . $GLOBALS['pmaThemeImage'] . 's_rights.png" width="16" height="16" border="0" hspace="2" align="middle" alt="'.$strPrivileges.'" />' : '') . $strPrivileges, 'server_privileges.php', $url_query);
} }