summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/pdo
diff options
context:
space:
mode:
authorTimothy Warren <tim@timshomepage.net>2011-10-25 16:37:31 +0200
committerPhil Sturgeon <email@philsturgeon.co.uk>2011-10-31 17:43:04 +0100
commit530becb7e80cb3a2647d31d2cc8ce88328189358 (patch)
tree126c691dcb505f8e3b25acfcfaeb42ab16148079 /system/database/drivers/pdo
parent55027807e4826dfe722598172ab7ffbd9dc0b48c (diff)
Changed mysql charset to PDO option
Diffstat (limited to 'system/database/drivers/pdo')
-rw-r--r--system/database/drivers/pdo/pdo_driver.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php
index 4c911aa6e..e536cc4bf 100644
--- a/system/database/drivers/pdo/pdo_driver.php
+++ b/system/database/drivers/pdo/pdo_driver.php
@@ -46,7 +46,8 @@ class CI_DB_pdo_driver extends CI_DB {
*/
var $_count_string = "SELECT COUNT(*) AS ";
var $_random_keyword;
-
+
+ var $options = array();
function __construct($params)
{
@@ -57,6 +58,9 @@ class CI_DB_pdo_driver extends CI_DB {
{
$this->_like_escape_str = '';
$this->_like_escape_chr = '';
+
+ //Set the charset with the connection options
+ $this->options['PDO::MYSQL_ATTR_INIT_COMMAND'] = "SET NAMES {$this->char_set}";
}
else if (strpos($this->hostname, 'odbc') !== FALSE)
{
@@ -83,9 +87,8 @@ class CI_DB_pdo_driver extends CI_DB {
*/
function db_connect()
{
- return new PDO($this->hostname,$this->username,$this->password, array(
- PDO::ATTR_ERRMODE => PDO::ERRMODE_SILENT
- ));
+ $this->options['PDO::ATTR_ERRMODE'] = PDO::ERRMODE_SILENT;
+ return new PDO($this->hostname,$this->username,$this->password, $this->options);
}
// --------------------------------------------------------------------