From 05cfbde3723e91dba07be5134ecfa3652f5585be Mon Sep 17 00:00:00 2001 From: Daku Date: Mon, 23 Jun 2014 04:23:21 +0100 Subject: [PATCH] .tables only works with the SQLite3 CLI program http://www.sqlite.org/faq.html#q7 --- core/database.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/database.class.php b/core/database.class.php index fa77dbec..42f8dd20 100644 --- a/core/database.class.php +++ b/core/database.class.php @@ -689,6 +689,7 @@ class Database { * @return int|null */ public function count_tables() { + if(is_null($this->db) || is_null($this->engine)) $this->connect_db(); if($this->engine->name === "mysql") { @@ -701,7 +702,7 @@ class Database { ); } else if ($this->engine->name === "sqlite") { return count( - $this->get_all(".tables") + $this->get_all("SELECT name FROM sqlite_master WHERE type = 'table'") ); } else { // Hard to find a universal way to do this...