From ce50148cbd3edb6c379b6431a5a55ae2107f9c48 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 31 Aug 2017 16:03:30 +0300 Subject: Merge pull request #5243 from rosseti/fix/pdo-dblib-sqlserver-version Fix for DBLIB subdriver to get the right version number of SQL Server. --- .../database/drivers/pdo/subdrivers/pdo_dblib_driver.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'system') diff --git a/system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php b/system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php index e9226c350..b9b86f784 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php +++ b/system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php @@ -334,4 +334,20 @@ class CI_DB_pdo_dblib_driver extends CI_DB_pdo_driver { return ($this->db_debug) ? $this->display_error('db_unsupported_feature') : FALSE; } + // -------------------------------------------------------------------- + + /** + * Database version number + * + * @return string + */ + public function version() + { + if (isset($this->data_cache['version'])) + { + return $this->data_cache['version']; + } + + return $this->data_cache['version'] = $this->conn_id->query("SELECT SERVERPROPERTY('ProductVersion') AS ver")->fetchColumn(0); + } } -- cgit v1.2.3-24-g4f1b