summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/sqlsrv
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-03-03 02:19:28 +0100
committerAndrey Andreev <narf@bofh.bg>2012-03-03 02:19:28 +0100
commit08856b8738ea4fc17b13986c9f2619383cb4a6e9 (patch)
treef214c1498b4ec7cc1958b3654353748954a2a141 /system/database/drivers/sqlsrv
parent75b2c7fd0e23afc5c0338a7b62854d38b37b9c62 (diff)
Improve DB version() implementation and add pg_version() support
Diffstat (limited to 'system/database/drivers/sqlsrv')
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_driver.php24
1 files changed, 16 insertions, 8 deletions
diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php
index 03d7c7199..5c90cb4f2 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_driver.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php
@@ -317,15 +317,23 @@ class CI_DB_sqlsrv_driver extends CI_DB {
// --------------------------------------------------------------------
/**
- * Version number query string
- *
- * @access public
- * @return string
- */
- function _version()
+ * Database version number
+ *
+ * @return string
+ */
+ public function version()
{
- $info = sqlsrv_server_info($this->conn_id);
- return sprintf("select '%s' as ver", $info['SQLServerVersion']);
+ if (isset($this->data_cache['version']))
+ {
+ return $this->data_cache['version'];
+ }
+
+ if (($info = sqlsrv_server_info($this->conn_id)) === FALSE)
+ {
+ return FALSE;
+ }
+
+ return $this->data_cache['version'] = $info['SQLServerVersion'];
}
// --------------------------------------------------------------------