1
0
mirror of https://github.com/danog/postgres.git synced 2024-12-02 17:37:57 +01:00

Move sql argument

This commit is contained in:
Aaron Piotrowski 2020-05-22 18:26:54 -05:00
parent 1e0355cf4c
commit 43c8dab5c2
No known key found for this signature in database
GPG Key ID: ADD1EF783EDE9EEB
3 changed files with 4 additions and 4 deletions

View File

@ -268,7 +268,7 @@ final class PgSqlHandle implements Handle
foreach (self::DIAGNOSTIC_CODES as $fieldCode => $description) { foreach (self::DIAGNOSTIC_CODES as $fieldCode => $description) {
$diagnostics[$description] = \pg_result_error_field($result, $fieldCode); $diagnostics[$description] = \pg_result_error_field($result, $fieldCode);
} }
throw new QueryExecutionError(\pg_result_error($result), $diagnostics, null, $sql); throw new QueryExecutionError(\pg_result_error($result), $diagnostics, $sql);
case \PGSQL_BAD_RESPONSE: case \PGSQL_BAD_RESPONSE:
throw new FailureException(\pg_result_error($result)); throw new FailureException(\pg_result_error($result));
@ -419,7 +419,7 @@ final class PgSqlHandle implements Handle
foreach (self::DIAGNOSTIC_CODES as $fieldCode => $description) { foreach (self::DIAGNOSTIC_CODES as $fieldCode => $description) {
$diagnostics[$description] = \pg_result_error_field($result, $fieldCode); $diagnostics[$description] = \pg_result_error_field($result, $fieldCode);
} }
throw new QueryExecutionError(\pg_result_error($result), $diagnostics, null, $sql); throw new QueryExecutionError(\pg_result_error($result), $diagnostics, $sql);
case \PGSQL_BAD_RESPONSE: case \PGSQL_BAD_RESPONSE:
throw new FailureException(\pg_result_error($result)); throw new FailureException(\pg_result_error($result));

View File

@ -240,7 +240,7 @@ final class PqHandle implements Handle
case pq\Result::NONFATAL_ERROR: case pq\Result::NONFATAL_ERROR:
case pq\Result::FATAL_ERROR: case pq\Result::FATAL_ERROR:
throw new QueryExecutionError($result->errorMessage, $result->diag, null, $sql ?? ''); throw new QueryExecutionError($result->errorMessage, $result->diag, $sql ?? '');
case pq\Result::BAD_RESPONSE: case pq\Result::BAD_RESPONSE:
throw new FailureException($result->errorMessage); throw new FailureException($result->errorMessage);

View File

@ -9,7 +9,7 @@ class QueryExecutionError extends QueryError
/** @var mixed[] */ /** @var mixed[] */
private $diagnostics; private $diagnostics;
public function __construct(string $message, array $diagnostics, \Throwable $previous = null, string $query = '') public function __construct(string $message, array $diagnostics, string $query = '', \Throwable $previous = null)
{ {
parent::__construct($message, $query, $previous); parent::__construct($message, $query, $previous);
$this->diagnostics = $diagnostics; $this->diagnostics = $diagnostics;