Commit 4d536e8e authored by Matteo Beccati's avatar Matteo Beccati Committed by Marco Pivetta

Skip PDO::PGSQL_ATTR_DISABLE_PREPARES if already set

parent 24255923
......@@ -23,6 +23,7 @@ use Doctrine\DBAL\Driver\AbstractPostgreSQLDriver;
use Doctrine\DBAL\Driver\PDOConnection;
use Doctrine\DBAL\DBALException;
use PDOException;
use PDO;
/**
* Driver that connects through pdo_pgsql.
......@@ -37,21 +38,18 @@ class Driver extends AbstractPostgreSQLDriver
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
{
try {
$pdo = new PDOConnection(
if (PHP_VERSION_ID >= 50600 && !isset($driverOptions[PDO::PGSQL_ATTR_DISABLE_PREPARES])) {
$driverOptions[PDO::PGSQL_ATTR_DISABLE_PREPARES] = true;
}
return new PDOConnection(
$this->_constructPdoDsn($params),
$username,
$password,
$driverOptions
);
if (PHP_VERSION_ID >= 50600) {
$pdo->setAttribute(\PDO::PGSQL_ATTR_DISABLE_PREPARES, true);
}
} catch (PDOException $e) {
throw DBALException::driverException($this, $e);
}
return $pdo;
}
/**
......
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