summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/pdo/pdo_driver.php
diff options
context:
space:
mode:
authorTimothy Warren <tim@timshomepage.net>2011-10-26 17:26:17 +0200
committerTimothy Warren <tim@timshomepage.net>2011-10-26 17:26:17 +0200
commit7d834be1501dcc3dc85af546f973f27fefcbd0f4 (patch)
tree7372f112bf2d5cbc01d8933322206ed9958f4735 /system/database/drivers/pdo/pdo_driver.php
parentc377081a4f9e2bda31401f61b2d21318326e60ee (diff)
Set charset in DSN if PHP >= 5.3.6
Diffstat (limited to 'system/database/drivers/pdo/pdo_driver.php')
-rw-r--r--system/database/drivers/pdo/pdo_driver.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php
index 0c41bfffe..b727b8098 100644
--- a/system/database/drivers/pdo/pdo_driver.php
+++ b/system/database/drivers/pdo/pdo_driver.php
@@ -70,6 +70,12 @@ class CI_DB_pdo_driver extends CI_DB {
$this->_like_escape_str = '';
$this->_like_escape_chr = '';
+ //Prior to this version, the charset can't be set in the dsn
+ if(is_php('5.3.6'))
+ {
+ $this->hostname .= ";charset={$this->char_set}";
+ }
+
//Set the charset with the connection options
$this->options['PDO::MYSQL_ATTR_INIT_COMMAND'] = "SET NAMES {$this->char_set}";
}