Skip to content

Commit

Permalink
Reuse connections to Postgre if existing
Browse files Browse the repository at this point in the history
 - to force new connection set connection parameter 'persistent' to false
  • Loading branch information
Juergen Kurzmann committed Jan 24, 2020
1 parent efe1cbd commit 1e717ba
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Dibi/Drivers/PostgreDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ public function __construct(array $config)
set_error_handler(function (int $severity, string $message) use (&$error) {
$error = $message;
});
if (empty($config['persistent'])) {
if (isset($config['persistent']) && !$config['persistent']) {
$this->connection = pg_connect($string, PGSQL_CONNECT_FORCE_NEW);
} else {
$this->connection = pg_pconnect($string, PGSQL_CONNECT_FORCE_NEW);
$this->connection = pg_pconnect($string);
}
restore_error_handler();
}
Expand Down

0 comments on commit 1e717ba

Please sign in to comment.