diff options
Diffstat (limited to 'include/dba/dba_pdo.php')
-rw-r--r-- | include/dba/dba_pdo.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/include/dba/dba_pdo.php b/include/dba/dba_pdo.php index 49f741601..c8a1b6c85 100644 --- a/include/dba/dba_pdo.php +++ b/include/dba/dba_pdo.php @@ -14,7 +14,7 @@ class dba_pdo extends dba_driver { * {@inheritDoc} * @see dba_driver::connect() */ - function connect($server, $scheme, $port, $user, $pass, $db) { + function connect($server, $scheme, $port, $user, $pass, $db, $db_charset) { $this->driver_dbtype = $scheme; @@ -27,6 +27,13 @@ class dba_pdo extends dba_driver { $dsn .= ';dbname=' . $db; + if ($this->driver_dbtype === 'mysql') { + $dsn .= ';charset=' . $db_charset; + } + else { + $dsn .= ";options='--client_encoding=" . $db_charset . "'"; + } + try { $this->db = new PDO($dsn,$user,$pass); $this->db->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); |