From bc15d243a2b12f2b8afb6f513c742f45899252ea Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Sun, 11 Aug 2002 21:24:54 +0000 Subject: [PATCH] bug #590055 --- ChangeLog | 2 ++ libraries/common.lib.php3 | 28 ++++++++++++++++++++++------ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index a78cad382..62aba64ca 100755 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,8 @@ $Source$ * lang/german-*.inc.php3: Updates. * tbl_properties_links.php3: Use "TRUNCATE TABLE" instead of "TRUNCATE". * tbl_indexes.php3: Default page for databases. + * libraries/common.lib.php3: Workaround against bug #590055 + (Tables need repair after empty). 2002-08-10 Robin Johnson * libraries/string.lib.php3: diff --git a/libraries/common.lib.php3 b/libraries/common.lib.php3 index 638c17934..8505daf5b 100644 --- a/libraries/common.lib.php3 +++ b/libraries/common.lib.php3 @@ -1061,13 +1061,12 @@ if (typeof(window.parent) != 'undefined' else if (isset($GLOBALS['table']) && $cfg['ShowTooltip'] && PMA_MYSQL_INT_VERSION >= 32303) { $result = @PMA_mysql_query('SHOW TABLE STATUS FROM ' . PMA_backquote($GLOBALS['db']) . ' LIKE \'' . PMA_sqlAddslashes($GLOBALS['table'], TRUE) . '\''); if ($result) { - $tmp = PMA_mysql_fetch_array($result, MYSQL_ASSOC); - $tooltip = (empty($tmp['Comment'])) - ? '' - : $tmp['Comment'] . ' '; - $tooltip .= '(' . $tmp['Rows'] . ' ' . $GLOBALS['strRows'] . ')'; + $tbl_status = PMA_mysql_fetch_array($result, MYSQL_ASSOC); + $tooltip = (empty($tbl_status['Comment'])) + ? '' + : $tbl_status['Comment'] . ' '; + $tooltip .= '(' . $tbl_status['Rows'] . ' ' . $GLOBALS['strRows'] . ')'; mysql_free_result($result); - unset($tmp); $md5_tbl = md5($GLOBALS['table']); echo "\n"; ?> @@ -1084,6 +1083,23 @@ if (typeof(document.getElementById) != 'undefined' = 40000 + && $GLOBALS['sql_query'] == 'TRUNCATE TABLE ' . PMA_backquote($GLOBALS['table'])) { + if (!isset($tbl_status)) { + $result = @PMA_mysql_query('SHOW TABLE STATUS FROM ' . PMA_backquote($GLOBALS['db']) . ' LIKE \'' . PMA_sqlAddslashes($GLOBALS['table'], TRUE) . '\''); + if ($result) { + $tbl_status = PMA_mysql_fetch_array($result, MYSQL_ASSOC); + mysql_free_result($result); + } + } + if (isset($tbl_status) && (int)$tbl_status['Index_length'] > 1024) { + @PMA_mysql_query('REPAIR TABLE ' . PMA_backquote($GLOBALS['table'])); + } + } + + unset($tbl_status); echo "\n"; ?>