sometimes we cannot rely on the cached information about a table
This commit is contained in:
@@ -255,9 +255,9 @@ class PMA_Table
|
|||||||
. ' (' . PMA_Table::countRecords($db, $table, true) . ')';
|
. ' (' . PMA_Table::countRecords($db, $table, true) . ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function sGetStatusInfo($db, $table, $info = null)
|
static public function sGetStatusInfo($db, $table, $info = null, $force_read = false)
|
||||||
{
|
{
|
||||||
if (! isset(PMA_Table::$cache[$db][$table])) {
|
if (! isset(PMA_Table::$cache[$db][$table]) || $force_read) {
|
||||||
PMA_Table::$cache[$db][$table] = PMA_DBI_fetch_single_row('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . $table . '\'');
|
PMA_Table::$cache[$db][$table] = PMA_DBI_fetch_single_row('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . $table . '\'');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,7 +265,7 @@ class PMA_Table
|
|||||||
return PMA_Table::$cache[$db][$table];
|
return PMA_Table::$cache[$db][$table];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! isset(PMA_Table::$cache[$db][$table][$info])) {
|
if (! isset(PMA_Table::$cache[$db][$table][$info]) || $force_read) {
|
||||||
PMA_Table::$cache[$db][$table] = PMA_DBI_fetch_single_row('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . $table . '\'');
|
PMA_Table::$cache[$db][$table] = PMA_DBI_fetch_single_row('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . $table . '\'');
|
||||||
}
|
}
|
||||||
return PMA_Table::$cache[$db][$table][$info];
|
return PMA_Table::$cache[$db][$table][$info];
|
||||||
|
@@ -36,7 +36,11 @@ global $showtable, $tbl_is_view, $tbl_type, $show_comment, $tbl_collation,
|
|||||||
// otherwise error #1046, no database selected
|
// otherwise error #1046, no database selected
|
||||||
PMA_DBI_select_db($GLOBALS['db']);
|
PMA_DBI_select_db($GLOBALS['db']);
|
||||||
|
|
||||||
$showtable = PMA_Table::sGetStatusInfo($GLOBALS['db'], $GLOBALS['table']);
|
// PMA_Table::sGetStatusInfo() does caching by default, but here
|
||||||
|
// we force reading of the current table status
|
||||||
|
// if $reread_info is true (for example, coming from tbl_operations.php
|
||||||
|
// and we just changed the table's storage engine)
|
||||||
|
$showtable = PMA_Table::sGetStatusInfo($GLOBALS['db'], $GLOBALS['table'], null, (isset($reread_info) && $reread_info ? true : false));
|
||||||
|
|
||||||
// need this test because when we are creating a table, we get 0 rows
|
// need this test because when we are creating a table, we get 0 rows
|
||||||
// from the SHOW TABLE query
|
// from the SHOW TABLE query
|
||||||
|
Reference in New Issue
Block a user