Always use emulate_prepares

master
Vitaliy Filippov 2018-09-18 16:11:35 +03:00
parent 4f857a1cd5
commit be74f89d55
1 changed files with 3 additions and 4 deletions

View File

@ -3,7 +3,7 @@
/** /**
* PDO/PostgreSQL wrapper with (mostly) DatabaseMySQL interface :) * PDO/PostgreSQL wrapper with (mostly) DatabaseMySQL interface :)
* Select builder is inspired by MediaWiki's one. * Select builder is inspired by MediaWiki's one.
* Version: 2018-08-12 * Version: 2018-09-18
* (c) Vitaliy Filippov, 2015-2018 * (c) Vitaliy Filippov, 2015-2018
*/ */
@ -38,7 +38,7 @@ if (!interface_exists('Database'))
class DatabasePdoPgsql implements Database class DatabasePdoPgsql implements Database
{ {
var $host, $port, $socket, $username, $password, $dbname, $pgbouncer; var $host, $port, $socket, $username, $password, $dbname;
var $tableNames = array(); var $tableNames = array();
var $init = array(); var $init = array();
@ -84,7 +84,6 @@ class DatabasePdoPgsql implements Database
'queryLogFile' => '', 'queryLogFile' => '',
'autoBegin' => false, 'autoBegin' => false,
'ondestroy' => 'commit', 'ondestroy' => 'commit',
'pgbouncer' => false,
'init' => array(), 'init' => array(),
); );
$options += $defOpts; $options += $defOpts;
@ -117,7 +116,7 @@ class DatabasePdoPgsql implements Database
$this->link = new PDO($str, $this->username, $this->password, array( $this->link = new PDO($str, $this->username, $this->password, array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => !empty($this->pgbouncer), PDO::ATTR_EMULATE_PREPARES => true,
)); ));
foreach ($this->init as $q) foreach ($this->init as $q)
$this->link->query($q); $this->link->query($q);