Commit bca20314 authored by Davi Koscianski Vidal's avatar Davi Koscianski Vidal Committed by Steve Müller

Add application_name to PostgreSQL driver

PostgreSQL allows the user to set the application_name is connecting
to database. It is useful for monitoring purposes.
Currently one could just manually add 'application_name=foo' to DSN,
but having a parameter eases setting it using DoctrineBundle.
parent a2701b52
...@@ -259,6 +259,8 @@ pdo\_pgsql ...@@ -259,6 +259,8 @@ pdo\_pgsql
the server's certificate will be verified to be signed by one of these the server's certificate will be verified to be signed by one of these
authorities. authorities.
See http://www.postgresql.org/docs/9.0/static/libpq-connect.html#LIBPQ-CONNECT-SSLROOTCERT See http://www.postgresql.org/docs/9.0/static/libpq-connect.html#LIBPQ-CONNECT-SSLROOTCERT
- ``application_name`` (string): Name of the application that is
connecting to database. Optional. It will be displayed at ``pg_stat_activity``.
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'``
......
...@@ -103,6 +103,10 @@ class Driver extends AbstractPostgreSQLDriver ...@@ -103,6 +103,10 @@ class Driver extends AbstractPostgreSQLDriver
$dsn .= 'sslrootcert=' . $params['sslrootcert'] . ' '; $dsn .= 'sslrootcert=' . $params['sslrootcert'] . ' ';
} }
if (isset($params['application_name'])) {
$dsn .= 'application_name=' . $params['application_name'] . ' ';
}
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