diff --git a/ChangeLog b/ChangeLog index 887ea19ee..6b82c4d96 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,13 @@ phpMyAdmin - ChangeLog $Id$ $HeadURL$ +2007-01-21 Marc Delisle + * libraries/Table.class.php: on a MySQL 5.0.33 server with 4400 databases, + one of which having 400 tables, it took more than 3 minutes just to + see the database structure (some accesses to INFORMATION_SCHEMA are + just too slow) so I changed PMA_Table::isView() to avoid calling + INFORMATION_SCHEMA + 2007-01-20 Marc Delisle * libraries/sqlparser.lib.php: bug #1638267, wrong reserved word recognition diff --git a/libraries/Table.class.php b/libraries/Table.class.php index 3ee9a5233..a01fc0a6c 100644 --- a/libraries/Table.class.php +++ b/libraries/Table.class.php @@ -233,11 +233,20 @@ class PMA_Table { if (PMA_MYSQL_INT_VERSION < 50000) { return false; } - if (false === PMA_DBI_fetch_value('SELECT TABLE_NAME FROM `information_schema`.`VIEWS` WHERE `TABLE_SCHEMA` = \'' . $db . '\' AND `TABLE_NAME` = \'' . $table . '\';')) { + // This would be the correct way of doing the check but at least in + // MySQL 5.0.33 it's too slow when there are hundreds of databases + // and/or tables (more than 3 minutes for 400 tables) + /*if (false === PMA_DBI_fetch_value('SELECT TABLE_NAME FROM `information_schema`.`VIEWS` WHERE `TABLE_SCHEMA` = \'' . $db . '\' AND `TABLE_NAME` = \'' . $table . '\';')) { return false; } else { return true; - } + } */ + // A more complete verification would be to check if all columns + // from the result set are NULL except Name and Comment. + // MySQL from 5.0.0 to 5.0.12 returns 'view', + // from 5.0.13 returns 'VIEW'. + $comment = strtoupper(PMA_DBI_fetch_value('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . $table . '\'', 0, 'Comment')); + return ($comment == 'VIEW'); } /**