Skip to content

Commit

Permalink
Capture query errors for the primary query
Browse files Browse the repository at this point in the history
  • Loading branch information
sanmai committed Jul 8, 2024
1 parent d8f68ef commit 33d0ba8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions db.php
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,8 @@ public function query( $query ) {
$this->ex_mysql_query( $statement_before_query, $this->dbh );
}

$this->result = $this->ex_mysql_query( $query, $this->dbh );
$this->result = $this->ex_mysql_query( $query, $this->dbh );
$this->last_error = $this->ex_mysql_error( $this->dbh );

if ( $statement_after_query ) {
$query_for_log = "$query_for_log; $statement_after_query";
Expand Down Expand Up @@ -996,7 +997,9 @@ public function query( $query ) {
}
}

$this->last_error = $this->ex_mysql_error( $this->dbh );
if ( $this->last_error === '' ) {

Check failure on line 1000 in db.php

View workflow job for this annotation

GitHub Actions / Run code style check

Use Yoda Condition checks, you must.
$this->last_error = $this->ex_mysql_error( $this->dbh );
}

if ( $this->last_error ) {
$this->last_errno = $this->ex_mysql_errno( $this->dbh );
Expand Down

0 comments on commit 33d0ba8

Please sign in to comment.