mirror of
https://github.com/silverstripe/silverstripe-postgresql
synced 2024-10-22 15:05:45 +00:00
BUG Fix pg_query / pg_query_params not correctly raising exceptions on error
This commit is contained in:
parent
946d429c41
commit
f797f49aeb
@ -221,14 +221,16 @@ class PostgreSQLConnector extends DBConnector
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Execute query
|
// Execute query
|
||||||
|
// Unfortunately error-suppression is required in order to handle sql errors elegantly.
|
||||||
|
// Please use PDO if you can help it
|
||||||
if (!empty($parameters)) {
|
if (!empty($parameters)) {
|
||||||
$result = pg_query_params($this->dbConn, $sql, $parameters);
|
$result = @pg_query_params($this->dbConn, $sql, $parameters);
|
||||||
} else {
|
} else {
|
||||||
$result = pg_query($this->dbConn, $sql);
|
$result = @pg_query($this->dbConn, $sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle error
|
// Handle error
|
||||||
if ($result === false) {
|
if (!$result) {
|
||||||
$this->databaseError($this->getLastError(), $errorLevel, $sql, $parameters);
|
$this->databaseError($this->getLastError(), $errorLevel, $sql, $parameters);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user