Skip to content

Instantly share code, notes, and snippets.

@simonwelsh
Created July 4, 2013 02:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simonwelsh/5924395 to your computer and use it in GitHub Desktop.
Save simonwelsh/5924395 to your computer and use it in GitHub Desktop.
diff --git a/model/MySQLDatabase.php b/model/MySQLDatabase.php
index 7ec6d5b..02dc037 100644
--- a/model/MySQLDatabase.php
+++ b/model/MySQLDatabase.php
@@ -801,8 +801,10 @@ class MySQLDatabase extends SS_Database {
* NOTE: Experimental; introduced for db-abstraction and may changed before 2.4 is released.
*/
public function hasTable($table) {
- $SQL_table = Convert::raw2sql($table);
- return (bool)($this->query("SHOW TABLES LIKE '$SQL_table'")->value());
+ if(!isset($this->tableList[strtolower($table)])) {
+ $this->tableList = $this->tableList();
+ }
+ return isset($this->tableList[strtolower($table)]);
}
/**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment