.tables only works with the SQLite3 CLI program

http://www.sqlite.org/faq.html#q7
This commit is contained in:
Daku 2014-06-23 04:23:21 +01:00 committed by Shish
parent b1ec0c434e
commit 05cfbde372

View File

@ -689,6 +689,7 @@ class Database {
* @return int|null * @return int|null
*/ */
public function count_tables() { public function count_tables() {
if(is_null($this->db) || is_null($this->engine)) $this->connect_db(); if(is_null($this->db) || is_null($this->engine)) $this->connect_db();
if($this->engine->name === "mysql") { if($this->engine->name === "mysql") {
@ -701,7 +702,7 @@ class Database {
); );
} else if ($this->engine->name === "sqlite") { } else if ($this->engine->name === "sqlite") {
return count( return count(
$this->get_all(".tables") $this->get_all("SELECT name FROM sqlite_master WHERE type = 'table'")
); );
} else { } else {
// Hard to find a universal way to do this... // Hard to find a universal way to do this...