[ticket/9518] Correctly create new connection on PostgreSQL when new connection is forced.

pg_connect() takes an integer as the second parameter, but we were passing a boolean parameter. The function especially requires passing the PGSQL_CONNECT_FORCE_NEW constant if a new connection is to be forced. Passing 0 as the second parameter for 'do not force a new connection' doesn't work as expected, hence we're calling the function without a second parameter in this case.

PHPBB3-9518
This commit is contained in:
Andreas Fischer 2010-04-06 17:56:54 +02:00 committed by Nils Adermann
parent 925a135613
commit 970848409d

View file

@ -76,7 +76,14 @@ class dbal_postgres extends dbal
$this->persistency = $persistency;
$this->db_connect_id = ($this->persistency) ? @pg_pconnect($connect_string, $new_link) : @pg_connect($connect_string, $new_link);
if ($this->persistency)
{
$this->db_connect_id = (!$new_link) ? @pg_pconnect($connect_string) : @pg_pconnect($connect_string, PGSQL_CONNECT_FORCE_NEW);
}
else
{
$this->db_connect_id = (!$new_link) ? @pg_connect($connect_string) : @pg_connect($connect_string, PGSQL_CONNECT_FORCE_NEW);
}
if ($this->db_connect_id)
{