Add support for PostgreSQL schemas in DSN (#6150)

If schema is set in the dsn, set search_path to the schema value.

Example:

$config['db_dsnw'] = 'pgsql://user:pass@localhost/dbname?schema=exampleschema';
pull/6153/head
laodc 8 years ago committed by Aleksander Machniak
parent 59a63c95a4
commit edeb5d7ab4

@ -56,6 +56,11 @@ class rcube_db_pgsql extends rcube_db
{
$dbh->query("SET NAMES 'utf8'");
$dbh->query("SET DATESTYLE TO ISO");
// if ?schema= is set in dsn, set the search_path
if ($dsn['schema']) {
$dbh->query("SET search_path TO " . $this->quote($dsn['schema']));
}
}
/**

Loading…
Cancel
Save