Make WordPress Core

Ticket #22115: ticket-22115-save-query-errors.2.patch

File ticket-22115-save-query-errors.2.patch, 941 bytes (added by bpetty, 10 years ago)
  • src/wp-includes/wp-db.php

    diff --git src/wp-includes/wp-db.php src/wp-includes/wp-db.php
    index 1eb3970..439c30c 100644
    class wpdb { 
    13661366                }
    13671367
    13681368                // If there is an error then take note of it..
    1369                 if ( $this->last_error = mysql_error( $this->dbh ) ) {
     1369                if ( $this->last_error ) {
    13701370                        // Clear insert_id on a subsequent failed insert.
    13711371                        if ( $this->insert_id && preg_match( '/^\s*(insert|replace)\s/i', $query ) )
    13721372                                $this->insert_id = 0;
    class wpdb { 
    14191419                $this->result = @mysql_query( $query, $this->dbh );
    14201420                $this->num_queries++;
    14211421
     1422                $this->last_error = mysql_error( $this->dbh );
     1423
    14221424                if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES ) {
    1423                         $this->queries[] = array( $query, $this->timer_stop(), $this->get_caller() );
     1425                        $this->queries[] = array( $query, $this->timer_stop(),
     1426                                                  $this->get_caller(), $this->last_error );
    14241427                }
    14251428        }
    14261429