Commit 99aadcb8 authored by Benjamin Eberlei's avatar Benjamin Eberlei

Merge pull request #446 from deeky666/DBAL-702

[DBAL-702] Add sslmode connection option to pdo_pgsql driver
parents 390db30f 160a1678
...@@ -156,6 +156,10 @@ pdo\_pgsql ...@@ -156,6 +156,10 @@ pdo\_pgsql
- ``host`` (string): Hostname of the database to connect to. - ``host`` (string): Hostname of the database to connect to.
- ``port`` (integer): Port of the database to connect to. - ``port`` (integer): Port of the database to connect to.
- ``dbname`` (string): Name of the database/schema to connect to. - ``dbname`` (string): Name of the database/schema to connect to.
- ``sslmode`` (string): Determines whether or with what priority
a SSL TCP/IP connection will be negotiated with the server.
See the list of available modes:
`http://www.postgresql.org/docs/9.1/static/libpq-connect.html#LIBPQ-CONNECT-SSLMODE`
PostgreSQL behaves differently with regard to booleans when you use PostgreSQL behaves differently with regard to booleans when you use
``PDO::ATTR_EMULATE_PREPARES`` or not. To switch from using ``'true'`` ``PDO::ATTR_EMULATE_PREPARES`` or not. To switch from using ``'true'``
......
...@@ -58,16 +58,23 @@ class Driver implements \Doctrine\DBAL\Driver, ExceptionConverterDriver ...@@ -58,16 +58,23 @@ class Driver implements \Doctrine\DBAL\Driver, ExceptionConverterDriver
private function _constructPdoDsn(array $params) private function _constructPdoDsn(array $params)
{ {
$dsn = 'pgsql:'; $dsn = 'pgsql:';
if (isset($params['host']) && $params['host'] != '') { if (isset($params['host']) && $params['host'] != '') {
$dsn .= 'host=' . $params['host'] . ' '; $dsn .= 'host=' . $params['host'] . ' ';
} }
if (isset($params['port']) && $params['port'] != '') { if (isset($params['port']) && $params['port'] != '') {
$dsn .= 'port=' . $params['port'] . ' '; $dsn .= 'port=' . $params['port'] . ' ';
} }
if (isset($params['dbname'])) { if (isset($params['dbname'])) {
$dsn .= 'dbname=' . $params['dbname'] . ' '; $dsn .= 'dbname=' . $params['dbname'] . ' ';
} }
if (isset($params['sslmode'])) {
$dsn .= 'sslmode=' . $params['sslmode'] . ' ';
}
return $dsn; return $dsn;
} }
......
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