diff --git a/inc/db_mysql.php b/inc/db_mysql.php index 09cf4bb6d9..0e18f06189 100644 --- a/inc/db_mysql.php +++ b/inc/db_mysql.php @@ -633,11 +633,18 @@ function list_tables($database, $prefix='') { if($prefix) { - $query = $this->query("SHOW TABLES FROM `$database` LIKE '".$this->escape_string($prefix)."%'"); + $query = $this->query(" + SELECT `TABLE_NAME` FROM INFORMATION_SCHEMA.TABLES + WHERE `TABLE_SCHEMA` = '$database' AND `TABLE_TYPE` = 'BASE TABLE' + AND `TABLE_NAME` LIKE '".$this->escape_string($prefix)."%' + "); } else { - $query = $this->query("SHOW TABLES FROM `$database`"); + $query = $this->query(" + SELECT `TABLE_NAME` FROM INFORMATION_SCHEMA.TABLES + WHERE `TABLE_SCHEMA` = '$database' AND `TABLE_TYPE` = 'BASE TABLE' + "); } $tables = array(); @@ -659,8 +666,9 @@ function table_exists($table) { // Execute on master server to ensure if we've just created a table that we get the correct result $query = $this->write_query(" - SHOW TABLES - LIKE '{$this->table_prefix}$table' + SELECT `TABLE_NAME` FROM INFORMATION_SCHEMA.TABLES + WHERE `TABLE_TYPE` = 'BASE TABLE' + AND `TABLE_NAME` LIKE '{$this->table_prefix}$table' "); $exists = $this->num_rows($query); if($exists > 0) diff --git a/inc/db_mysqli.php b/inc/db_mysqli.php index 1794117dd6..46284b59fc 100644 --- a/inc/db_mysqli.php +++ b/inc/db_mysqli.php @@ -630,11 +630,18 @@ function list_tables($database, $prefix='') { if($prefix) { - $query = $this->query("SHOW TABLES FROM `$database` LIKE '".$this->escape_string($prefix)."%'"); + $query = $this->query(" + SELECT `TABLE_NAME` FROM INFORMATION_SCHEMA.TABLES + WHERE `TABLE_SCHEMA` = '$database' AND `TABLE_TYPE` = 'BASE TABLE' + AND `TABLE_NAME` LIKE '".$this->escape_string($prefix)."%' + "); } else { - $query = $this->query("SHOW TABLES FROM `$database`"); + $query = $this->query(" + SELECT `TABLE_NAME` FROM INFORMATION_SCHEMA.TABLES + WHERE `TABLE_SCHEMA` = '$database' AND `TABLE_TYPE` = 'BASE TABLE' + "); } $tables = array(); @@ -655,8 +662,9 @@ function table_exists($table) { // Execute on master server to ensure if we've just created a table that we get the correct result $query = $this->write_query(" - SHOW TABLES - LIKE '{$this->table_prefix}$table' + SELECT `TABLE_NAME` FROM INFORMATION_SCHEMA.TABLES + WHERE `TABLE_TYPE` = 'BASE TABLE' + AND `TABLE_NAME` LIKE '{$this->table_prefix}$table' "); $exists = $this->num_rows($query);