Skip to content

Commit

Permalink
refactor: avoid repetitive call pg_last_error()
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Dec 27, 2024
1 parent 9805121 commit 0bb7119
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion system/Database/Postgre/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,10 @@ protected function _enableForeignKeyChecks()
*/
public function error(): array
{
$lastError = pg_last_error($this->connID);
return [
'code' => '',
'message' => ! in_array(pg_last_error($this->connID), ['', '0'], true) ? pg_last_error($this->connID) : '',
'message' => ! in_array($lastError, ['', '0'], true) ? $lastError : '',
];
}

Expand Down

0 comments on commit 0bb7119

Please sign in to comment.