Skip to content

Commit 0bb7119

Browse files
committed
refactor: avoid repetitive call pg_last_error()
1 parent 9805121 commit 0bb7119

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

system/Database/Postgre/Connection.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,9 +461,10 @@ protected function _enableForeignKeyChecks()
461461
*/
462462
public function error(): array
463463
{
464+
$lastError = pg_last_error($this->connID);
464465
return [
465466
'code' => '',
466-
'message' => ! in_array(pg_last_error($this->connID), ['', '0'], true) ? pg_last_error($this->connID) : '',
467+
'message' => ! in_array($lastError, ['', '0'], true) ? $lastError : '',
467468
];
468469
}
469470

0 commit comments

Comments
 (0)