diff options
author | Timothy Warren <tim@timshomepage.net> | 2011-10-26 17:26:17 +0200 |
---|---|---|
committer | Phil Sturgeon <email@philsturgeon.co.uk> | 2011-10-31 17:44:31 +0100 |
commit | d019fd673a730bf87f1410a752818f16b6ced713 (patch) | |
tree | cb67ac2d9315e40a6f7d73ff03178a6ed1784856 /system/database/drivers/pdo | |
parent | 530becb7e80cb3a2647d31d2cc8ce88328189358 (diff) |
Set charset in DSN if PHP >= 5.3.6
Diffstat (limited to 'system/database/drivers/pdo')
-rw-r--r-- | system/database/drivers/pdo/pdo_driver.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index e536cc4bf..b4c3102ed 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -59,6 +59,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}"; } @@ -236,7 +242,7 @@ class CI_DB_pdo_driver extends CI_DB { // Reset the transaction failure flag. // If the $test_mode flag is set to TRUE transactions will be rolled back // even if the queries produce a successful result. - $this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE; + $this->_trans_failure = (bool) ($test_mode === TRUE); return $this->conn_id->beginTransaction(); } |