diff options
author | Andrei Rosseti <andrei@facedigital.com.br> | 2017-08-30 22:41:27 +0200 |
---|---|---|
committer | Andrei Rosseti <andrei@facedigital.com.br> | 2017-08-30 22:41:27 +0200 |
commit | e1f7e5430b3b7761467b918b07890e94edc6e663 (patch) | |
tree | 649cf0db7435819cefdb90a62192e21dc89bd798 | |
parent | 6ffc8f63c8a9a76c5323a4013382a61eb4d7031a (diff) |
Fixed DBLIB subdriver to get the right version number of SQL Server.
-rw-r--r-- | system/database/drivers/pdo/subdrivers/pdo_dblib_driver.php | 27 |
1 files changed, 27 insertions, 0 deletions
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 <andrei@facedigital.com.br> + * @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(); + } + } } |