Commit 9aadacd4 authored by Bill Schaller's avatar Bill Schaller

Merge pull request #828 from rocksfrow/master

rehashed charset option implementation to support old and new versions of postgresql, and pgbouncer
parents 8e65cdc7 cef58bdb
......@@ -53,6 +53,14 @@ class Driver extends AbstractPostgreSQLDriver
$pdo->setAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES, true);
}
/* defining client_encoding via SET NAMES to avoid inconsistent DSN support
* - the 'client_encoding' connection param only works with postgres >= 9.1
* - passing client_encoding via the 'options' param breaks pgbouncer support
*/
if (isset($params['charset'])) {
$pdo->query('SET NAMES \''.$params['charset'].'\'');
}
return $pdo;
} catch (PDOException $e) {
throw DBALException::driverException($this, $e);
......@@ -82,10 +90,6 @@ class Driver extends AbstractPostgreSQLDriver
$dsn .= 'dbname=' . $params['dbname'] . ' ';
}
if (isset($params['charset'])) {
$dsn .= 'client_encoding=' . $params['charset'] . ' ';
}
if (isset($params['sslmode'])) {
$dsn .= 'sslmode=' . $params['sslmode'] . ' ';
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment