summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/database/drivers/cubrid/cubrid_driver.php15
-rw-r--r--system/database/drivers/mysql/mysql_driver.php18
-rw-r--r--system/database/drivers/mysqli/mysqli_driver.php13
-rw-r--r--system/database/drivers/oci8/oci8_driver.php18
-rw-r--r--system/database/drivers/pdo/pdo_driver.php4
-rw-r--r--system/database/drivers/postgre/postgre_driver.php6
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_driver.php6
7 files changed, 66 insertions, 14 deletions
diff --git a/system/database/drivers/cubrid/cubrid_driver.php b/system/database/drivers/cubrid/cubrid_driver.php
index 48b904286..c89a924d3 100644
--- a/system/database/drivers/cubrid/cubrid_driver.php
+++ b/system/database/drivers/cubrid/cubrid_driver.php
@@ -179,9 +179,18 @@ class CI_DB_cubrid_driver extends CI_DB {
*/
public function version()
{
- return isset($this->data_cache['version'])
- ? $this->data_cache['version']
- : $this->data_cache['version'] = cubrid_get_server_info($this->conn_id);
+ if (isset($this->data_cache['version']))
+ {
+ return $this->data_cache['version'];
+ }
+ elseif ( ! $this->conn_id)
+ {
+ $this->initialize();
+ }
+
+ return ( ! $this->conn_id OR ($version = cubrid_get_server_info($this->conn_id)) === FALSE)
+ ? FALSE
+ : $this->data_cache['version'] = $version;
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index 2457e558c..b1edc2925 100644
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
@@ -191,9 +191,21 @@ class CI_DB_mysql_driver extends CI_DB {
*/
public function version()
{
- return isset($this->data_cache['version'])
- ? $this->data_cache['version']
- : $this->data_cache['version'] = @mysql_get_server_info($this->conn_id);
+ if (isset($this->data_cache['version']))
+ {
+ return $this->data_cache['version'];
+ }
+ elseif ( ! $this->conn_id)
+ {
+ $this->initialize();
+ }
+
+ if ( ! $this->conn_id OR ($version = @mysql_get_server_info($this->conn_id)) === FALSE)
+ {
+ return FALSE;
+ }
+
+ return $this->data_cache['version'] = $version;
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php
index 7d2507b40..ae17703ac 100644
--- a/system/database/drivers/mysqli/mysqli_driver.php
+++ b/system/database/drivers/mysqli/mysqli_driver.php
@@ -173,9 +173,16 @@ class CI_DB_mysqli_driver extends CI_DB {
*/
public function version()
{
- return isset($this->data_cache['version'])
- ? $this->data_cache['version']
- : $this->data_cache['version'] = $this->conn_id->server_info;
+ if (isset($this->data_cache['version']))
+ {
+ return $this->data_cache['version'];
+ }
+ elseif ( ! $this->conn_id)
+ {
+ $this->initialize();
+ }
+
+ return $this->data_cache['version'] = $this->conn_id->server_info;
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php
index 38d2395b6..b2663e2c5 100644
--- a/system/database/drivers/oci8/oci8_driver.php
+++ b/system/database/drivers/oci8/oci8_driver.php
@@ -240,9 +240,21 @@ class CI_DB_oci8_driver extends CI_DB {
*/
public function version()
{
- return isset($this->data_cache['version'])
- ? $this->data_cache['version']
- : $this->data_cache['version'] = oci_server_version($this->conn_id);
+ if (isset($this->data_cache['version']))
+ {
+ return $this->data_cache['version'];
+ }
+ elseif ( ! $this->conn_id)
+ {
+ $this->initialize();
+ }
+
+ if ( ! $this->conn_id OR ($version = oci_server_version($this->conn_id)) === FALSE)
+ {
+ return FALSE;
+ }
+
+ return $this->data_cache['version'] = $version;
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php
index 57a3c5c98..923f0e125 100644
--- a/system/database/drivers/pdo/pdo_driver.php
+++ b/system/database/drivers/pdo/pdo_driver.php
@@ -165,6 +165,10 @@ class CI_DB_pdo_driver extends CI_DB {
{
return $this->data_cache['version'];
}
+ elseif ( ! $this->conn_id)
+ {
+ $this->initialize();
+ }
// Not all subdrivers support the getAttribute() method
try
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php
index 028dc1996..40f21b1e8 100644
--- a/system/database/drivers/postgre/postgre_driver.php
+++ b/system/database/drivers/postgre/postgre_driver.php
@@ -204,8 +204,12 @@ class CI_DB_postgre_driver extends CI_DB {
{
return $this->data_cache['version'];
}
+ elseif ( ! $this->conn_id)
+ {
+ $this->initialize();
+ }
- if (($pg_version = pg_version($this->conn_id)) === FALSE)
+ if ( ! $this->conn_id OR ($pg_version = pg_version($this->conn_id)) === FALSE)
{
return FALSE;
}
diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php
index de3d87312..d3999bf75 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_driver.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php
@@ -275,8 +275,12 @@ class CI_DB_sqlsrv_driver extends CI_DB {
{
return $this->data_cache['version'];
}
+ elseif ( ! $this->conn_id)
+ {
+ $this->initialize();
+ }
- if (($info = sqlsrv_server_info($this->conn_id)) === FALSE)
+ if ( ! $this->conn_id OR ($info = sqlsrv_server_info($this->conn_id)) === FALSE)
{
return FALSE;
}