mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2025-01-03 14:32:40 +00:00
PostgreSQL fixes
Errors were not correctly throwing exceptions For the sake of SQLite compatibility booleans should be bound as integers in PDO
This commit is contained in:
parent
e2b6cb8360
commit
d52af6db5a
2 changed files with 2 additions and 2 deletions
|
@ -15,7 +15,7 @@ class PDOStatement extends AbstractStatement {
|
||||||
"datetime" => \PDO::PARAM_STR,
|
"datetime" => \PDO::PARAM_STR,
|
||||||
"binary" => \PDO::PARAM_LOB,
|
"binary" => \PDO::PARAM_LOB,
|
||||||
"string" => \PDO::PARAM_STR,
|
"string" => \PDO::PARAM_STR,
|
||||||
"boolean" => \PDO::PARAM_BOOL,
|
"boolean" => \PDO::PARAM_INT, // FIXME: using \PDO::PARAM_BOOL leads to incompatibilities with versions of SQLite bundled prior to PHP 7.3
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $st;
|
protected $st;
|
||||||
|
|
|
@ -22,7 +22,7 @@ class PDODriver extends Driver {
|
||||||
|
|
||||||
protected function makeConnection(string $user, string $pass, string $db, string $host, int $port, string $service) {
|
protected function makeConnection(string $user, string $pass, string $db, string $host, int $port, string $service) {
|
||||||
$dsn = $this->makeconnectionString(true, $user, $pass, $db, $host, $port, $service);
|
$dsn = $this->makeconnectionString(true, $user, $pass, $db, $host, $port, $service);
|
||||||
$this->db = new \PDO("pgsql:$dsn", $user, $pass);
|
$this->db = new \PDO("pgsql:$dsn", $user, $pass, [\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __destruct() {
|
public function __destruct() {
|
||||||
|
|
Loading…
Reference in a new issue