summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/pdo
diff options
context:
space:
mode:
authorTimothy Warren <tim@timshomepage.net>2011-10-25 16:37:31 +0200
committerTimothy Warren <tim@timshomepage.net>2011-10-25 16:37:31 +0200
commit7aae368144a1e2e4b891a4ce88f5bf75585eb266 (patch)
treefa559688c47ba46e00f6cc1317b2e83661b7d5d9 /system/database/drivers/pdo
parenta662da365bf3cacebcb8669a55a75b656ac8b508 (diff)
Changed mysql charset to PDO option
Diffstat (limited to 'system/database/drivers/pdo')
-rw-r--r--system/database/drivers/pdo/pdo_driver.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php
index c63bb9f2f..0c41bfffe 100644
--- a/system/database/drivers/pdo/pdo_driver.php
+++ b/system/database/drivers/pdo/pdo_driver.php
@@ -57,7 +57,8 @@ class CI_DB_pdo_driver extends CI_DB {
*/
var $_count_string = "SELECT COUNT(*) AS ";
var $_random_keyword;
-
+
+ var $options = array();
function __construct($params)
{
@@ -69,8 +70,8 @@ class CI_DB_pdo_driver extends CI_DB {
$this->_like_escape_str = '';
$this->_like_escape_chr = '';
- //Set the charset with the connection string
- $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}";
}
else if (strpos($this->hostname, 'odbc') !== FALSE)
{
@@ -98,9 +99,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);
}
// --------------------------------------------------------------------