From a65996607dc7d582b57661afc7fe25528dc5788f Mon Sep 17 00:00:00 2001 From: MGatner Date: Tue, 17 Sep 2019 11:30:26 -0400 Subject: [PATCH 1/2] Exclude `sqlite_%` from listTables() --- system/Database/SQLite3/Connection.php | 1 + 1 file changed, 1 insertion(+) diff --git a/system/Database/SQLite3/Connection.php b/system/Database/SQLite3/Connection.php index f7ad7da0ce58..d918d4a19188 100644 --- a/system/Database/SQLite3/Connection.php +++ b/system/Database/SQLite3/Connection.php @@ -207,6 +207,7 @@ protected function _escapeString(string $str): string protected function _listTables(bool $prefixLimit = false): string { return 'SELECT "NAME" FROM "SQLITE_MASTER" WHERE "TYPE" = \'table\'' + . ' AND "NAME" NOT LIKE \'sqlite_%\'' . (($prefixLimit !== false && $this->DBPrefix !== '') ? ' AND "NAME" LIKE \'' . $this->escapeLikeString($this->DBPrefix) . '%\' ' . sprintf($this->likeEscapeStr, $this->likeEscapeChar) From 392eb41cfb5cca874ae9b0013128e8bce7e75252 Mon Sep 17 00:00:00 2001 From: MGatner Date: Tue, 17 Sep 2019 11:36:36 -0400 Subject: [PATCH 2/2] [ci skip] Add mention to User Guide of table exclusion --- user_guide_src/source/database/metadata.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/user_guide_src/source/database/metadata.rst b/user_guide_src/source/database/metadata.rst index 7ec2eb6ffae0..0e2e54ede497 100644 --- a/user_guide_src/source/database/metadata.rst +++ b/user_guide_src/source/database/metadata.rst @@ -26,6 +26,8 @@ you are currently connected to. Example:: { echo $table; } + +.. note:: Some drivers have additional system tables that are excluded from this return. Determine If a Table Exists ===========================