Commit 1e130ff5 authored by Marco Pivetta's avatar Marco Pivetta

#714 - aligning setting `PDO::PGSQL_ATTR_DISABLE_PREPARES` with test specification

parent f11e14c5
...@@ -38,16 +38,22 @@ class Driver extends AbstractPostgreSQLDriver ...@@ -38,16 +38,22 @@ class Driver extends AbstractPostgreSQLDriver
public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
{ {
try { try {
if (PHP_VERSION_ID >= 50600 && ! isset($driverOptions[PDO::PGSQL_ATTR_DISABLE_PREPARES])) { $pdo = new PDOConnection(
$driverOptions[PDO::PGSQL_ATTR_DISABLE_PREPARES] = true;
}
return new PDOConnection(
$this->_constructPdoDsn($params), $this->_constructPdoDsn($params),
$username, $username,
$password, $password,
$driverOptions $driverOptions
); );
if (PHP_VERSION_ID >= 50600
&& (! isset($driverOptions[PDO::PGSQL_ATTR_DISABLE_PREPARES])
|| true === $driverOptions[PDO::PGSQL_ATTR_DISABLE_PREPARES]
)
) {
$pdo->setAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES, true);
}
return $pdo;
} catch (PDOException $e) { } catch (PDOException $e) {
throw DBALException::driverException($this, $e); throw DBALException::driverException($this, $e);
} }
......
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