From 951443e793f2d30a3cc66a3a8619465b565753e9 Mon Sep 17 00:00:00 2001 From: Office <11071985+kkmuffme@users.noreply.github.com> Date: Wed, 8 Jan 2025 19:14:07 +0100 Subject: [PATCH] add changes that were added in wpdb at some point --- ludicrousdb/includes/class-ludicrousdb.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ludicrousdb/includes/class-ludicrousdb.php b/ludicrousdb/includes/class-ludicrousdb.php index c125dcd..07991a6 100644 --- a/ludicrousdb/includes/class-ludicrousdb.php +++ b/ludicrousdb/includes/class-ludicrousdb.php @@ -1833,9 +1833,16 @@ public function query( $query ) { // If there is an error then take note of it if ( $this->dbh_type_check( $this->dbh ) ) { $this->last_error = mysqli_error( $this->dbh ); + } else { + $this->last_error = __( 'Unable to retrieve the error message from MySQL' ); } if ( ! empty( $this->last_error ) ) { + // Clear insert_id on a subsequent failed insert. + if ( $this->insert_id && preg_match( '/^\s*(insert|replace)\s/i', $query ) ) { + $this->insert_id = 0; + } + $this->print_error( $this->last_error ); $retval = false;