From 3683f775bec4993b3777b012a087e82d6bff8d3f Mon Sep 17 00:00:00 2001 From: Derek Allard Date: Wed, 16 Dec 2009 17:32:33 +0000 Subject: Change to CI's db->version() function to allow a list of exceptions for dbs with functions to return version string, vs SQL queries to return version strings. Currently this list only includes Oracle and SQLite. --- system/database/DB_driver.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'system') diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index 014dfd44e..aee06205b 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -215,14 +215,20 @@ class CI_DB_driver { } return FALSE; } - - if ($this->dbdriver == 'oci8') + + // Some DBs have functions that return the version, and don't run special + // SQL queries per se. In these instances, just return the result. + $driver_version_exceptions = array('oci8', 'sqlite'); + + if (in_array($this->dbdriver, $driver_version_exceptions)) { return $sql; } - - $query = $this->query($sql); - return $query->row('ver'); + else + { + $query = $this->query($sql); + return $query->row('ver'); + } } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b