From 3a330753f413c3e024163f8f401f327bc2f9930c Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 4 Sep 2008 14:10:03 +0000 Subject: Get real dbms version instead of relying on php internal functions which only grab the local library version git-svn-id: file:///svn/phpbb/trunk@8821 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/db/sqlite.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/db/sqlite.php') diff --git a/phpBB/includes/db/sqlite.php b/phpBB/includes/db/sqlite.php index df1180db8f..dc2701c1ce 100644 --- a/phpBB/includes/db/sqlite.php +++ b/phpBB/includes/db/sqlite.php @@ -49,18 +49,31 @@ class dbal_sqlite extends dbal if ($this->db_connect_id) { @sqlite_query('PRAGMA short_column_names = 1', $this->db_connect_id); +// @sqlite_query('PRAGMA encoding = "UTF-8"', $this->db_connect_id); } - return ($this->db_connect_id) ? true : array('message' => $error); } /** * Version information about used database + * @param bool $raw if true, only return the fetched sql_server_version + * @return string sql server version */ - function sql_server_info() + function sql_server_info($raw = false) { - return 'SQLite ' . @sqlite_libversion(); + global $cache; + + if (empty($cache) || ($this->sql_server_version = $cache->get('sqlite_version')) === false) + { + $result = @sqlite_query('SELECT sqlite_version() AS version', $this->db_connect_id); + $row = @sqlite_fetch_array($result, SQLITE_ASSOC); + + $this->sql_server_version = (!empty($row['version'])) ? $row['version'] : 0; + $cache->put('sqlite_version', $this->sql_server_version); + } + + return ($raw) ? $this->sql_server_version : 'SQLite ' . $this->sql_server_version; } /** -- cgit v1.2.1