summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/pdo/pdo_driver.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-07-05 20:57:41 +0200
committerAndrey Andreev <narf@bofh.bg>2012-07-05 20:57:41 +0200
commit9e3a83a65668cc26b685f0b35a4428809435f7c9 (patch)
tree21542aa63e8776c34fb2048cebce8c3eb3cfb2ba /system/database/drivers/pdo/pdo_driver.php
parent35c7adc7f3d3058a29b177dcaa888c67dd174613 (diff)
Fix PDO version()
Diffstat (limited to 'system/database/drivers/pdo/pdo_driver.php')
-rw-r--r--system/database/drivers/pdo/pdo_driver.php17
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();
+ }
}
// --------------------------------------------------------------------