Skip to content

Commit

Permalink
Remove unneeded arg
Browse files Browse the repository at this point in the history
  • Loading branch information
trowski committed Nov 21, 2024
1 parent 660c00f commit c62555c
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/Internal/PgSqlHandle.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ private function createResult(\PgSql\Result $result, string $sql): PostgresResul

\assert($this->types !== null, 'Expected type array to be populated before creating a result');

switch (\pg_result_status($result)) {
switch ($status = \pg_result_status($result)) {
case \PGSQL_EMPTY_QUERY:
throw new SqlQueryError("Empty query string");

Expand Down Expand Up @@ -353,7 +353,11 @@ private function createResult(\PgSql\Result $result, string $sql): PostgresResul
default:
// @codeCoverageIgnoreStart
$this->close();
throw new SqlException("Unknown result status");
throw new SqlException(\sprintf(
"Unknown result status: %d; error: %s",
$status,
\pg_result_error($result) ?: 'none',
));
// @codeCoverageIgnoreEnd
}
}
Expand Down Expand Up @@ -471,7 +475,7 @@ public function prepare(string $sql): PostgresStatement
$future = async(function () use ($name, $modifiedSql, $sql): string {
$result = $this->send(\pg_send_prepare(...), $name, $modifiedSql);

switch (\pg_result_status($result, \PGSQL_STATUS_LONG)) {
switch ($status = \pg_result_status($result)) {
case \PGSQL_COMMAND_OK:
return $name; // Statement created successfully.

Expand All @@ -488,7 +492,11 @@ public function prepare(string $sql): PostgresStatement

default:
// @codeCoverageIgnoreStart
throw new SqlException("Unknown result status");
throw new SqlException(\sprintf(
"Unknown result status: %d; error: %s",
$status,
\pg_result_error($result) ?: 'none',
));
// @codeCoverageIgnoreEnd
}
});
Expand Down

0 comments on commit c62555c

Please sign in to comment.