diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-07-05 20:57:41 +0200 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-07-05 20:57:41 +0200 |
commit | 9e3a83a65668cc26b685f0b35a4428809435f7c9 (patch) | |
tree | 21542aa63e8776c34fb2048cebce8c3eb3cfb2ba /system/database/drivers/pdo/pdo_driver.php | |
parent | 35c7adc7f3d3058a29b177dcaa888c67dd174613 (diff) |
Fix PDO version()
Diffstat (limited to 'system/database/drivers/pdo/pdo_driver.php')
-rw-r--r-- | system/database/drivers/pdo/pdo_driver.php | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index 3ef376ca5..38a9fec80 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -250,9 +250,20 @@ class CI_DB_pdo_driver extends CI_DB { */ public function version() { - return isset($this->data_cache['version']) - ? $this->data_cache['version'] - : $this->data_cache['version'] = $this->conn_id->getAttribute(PDO::ATTR_SERVER_VERSION); + if (isset($this->data_cache['version'])) + { + return $this->data_cache['version']; + } + + // Not all subdrivers support the getAttribute() method + try + { + return $this->data_cache['version'] = $this->conn_id->getAttribute(PDO::ATTR_SERVER_VERSION); + } + catch (PDOException $e) + { + return parent::version(); + } } // -------------------------------------------------------------------- |