diff --git a/e107_handlers/mysql_class.php b/e107_handlers/mysql_class.php index cf7146f92..85cdc2558 100644 --- a/e107_handlers/mysql_class.php +++ b/e107_handlers/mysql_class.php @@ -1,10 +1,10 @@ -mySQLaccess); } + + /* + * Verify whether a table exists, without causing an error + * + * @param string $table + * @return string + * + * NOTES: the 'official' way to do this uses SHOW TABLE STATUS, but that is 20x slower! + * LIMIT 0 is 3x slower than LIMIT 1 + */ + function db_Table_exists($table){ + $res = $this->db_Query("SELECT 1 FROM ".MPREFIX.$table." LIMIT 1"); // error if not there + if ($res) return TRUE; + return FALSE; + } + + } ?>