From 2fcd96ca72741bdfb36c24a0af9dd8230b5a828f Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 4 Sep 2008 12:01:47 +0000 Subject: Ok, story real database server info, as well as caching it Store it on installation too - allows us to check the db version used on installation and used currently to warn the user about incompatibilities git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8814 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/db/mssql.php | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'phpBB/includes/db/mssql.php') diff --git a/phpBB/includes/db/mssql.php b/phpBB/includes/db/mssql.php index 8b67f04b5d..97be2bfb3f 100644 --- a/phpBB/includes/db/mssql.php +++ b/phpBB/includes/db/mssql.php @@ -62,24 +62,38 @@ class dbal_mssql extends dbal /** * 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) { - $result_id = @mssql_query("SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY('productlevel'), SERVERPROPERTY('edition')", $this->db_connect_id); + global $cache; - $row = false; - if ($result_id) + if (empty($cache) || ($this->sql_server_version = $cache->get('mssql_version')) === false) { - $row = @mssql_fetch_assoc($result_id); - @mssql_free_result($result_id); + $result_id = @mssql_query("SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY('productlevel'), SERVERPROPERTY('edition')", $this->db_connect_id); + + $row = false; + if ($result_id) + { + $row = @mssql_fetch_assoc($result_id); + @mssql_free_result($result_id); + } + + $this->sql_server_version = ($row) ? trim(implode(' ', $row)) : 0; + + if (!empty($cache)) + { + $cache->put('mssql_version', $this->sql_server_version); + } } - if ($row) + if ($raw) { - return 'MSSQL
' . implode(' ', $row); + return $this->sql_server_version; } - return 'MSSQL'; + return ($this->sql_server_version) ? 'MSSQL
' . $this->sql_server_version : 'MSSQL'; } /** -- cgit v1.2.1