From e1f7e5430b3b7761467b918b07890e94edc6e663 Mon Sep 17 00:00:00 2001 From: Andrei Rosseti Date: Wed, 30 Aug 2017 17:41:27 -0300 Subject: Fixed DBLIB subdriver to get the right version number of SQL Server. --- .../drivers/pdo/subdrivers/pdo_dblib_driver.php | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'system/database') diff --git a/system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php b/system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php index 08243232e..048759fef 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php +++ b/system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php @@ -334,4 +334,31 @@ 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 + * Fix by Andrei Rosseti + * @return string + */ + public function version() + { + if (isset($this->data_cache['version'])) + { + return $this->data_cache['version']; + } + + try + { + $productversion = $this->conn_id->query("SELECT + CAST( + SERVERPROPERTY('productversion') + AS VARCHAR + )")->fetchColumn(0); + + return $this->data_cache['version'] = $productversion; + } + catch (PDOException $e) + { + return parent::version(); + } + } } -- cgit v1.2.3-24-g4f1b From ec948d3665d50a5d4786fac4d806941d3e989f7e Mon Sep 17 00:00:00 2001 From: Andrei Rosseti Date: Thu, 31 Aug 2017 09:40:06 -0300 Subject: Refactoring some codeblocks. --- .../drivers/pdo/subdrivers/pdo_dblib_driver.php | 41 ++++++++-------------- 1 file changed, 15 insertions(+), 26 deletions(-) (limited to 'system/database') diff --git a/system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php b/system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php index 048759fef..fbd279681 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php +++ b/system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php @@ -334,31 +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 - * Fix by Andrei Rosseti - * @return string - */ - public function version() - { - if (isset($this->data_cache['version'])) - { - return $this->data_cache['version']; - } - - try - { - $productversion = $this->conn_id->query("SELECT - CAST( - SERVERPROPERTY('productversion') - AS VARCHAR - )")->fetchColumn(0); - - return $this->data_cache['version'] = $productversion; - } - catch (PDOException $e) - { - return parent::version(); - } - } + * 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