WordPress.org

Make WordPress Core

Changeset 7431


Ignore:
Timestamp:
03/20/08 23:34:32 (6 years ago)
Author:
ryan
Message:

Capture last db error. Pass it in WP_Error data when term inserts fail. Fix typo in WP_Ajax_Response

Location:
trunk/wp-includes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/classes.php

    r7130 r7431  
    765765 
    766766                if ( is_scalar($error_data) ) { 
    767                     $response .= "<![CDATA[$v]]>"; 
     767                    $response .= "<![CDATA[$error_data]]>"; 
    768768                } elseif ( is_array($error_data) ) { 
    769769                    foreach ( $error_data as $k => $v ) 
  • trunk/wp-includes/taxonomy.php

    r7430 r7431  
    11541154    if ( ! $term_id = is_term($slug) ) { 
    11551155        if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) ) 
    1156             return new WP_Error('db_insert_error', __('Could not insert term into the database')); 
     1156            return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error); 
    11571157        $term_id = (int) $wpdb->insert_id; 
    11581158    } else if ( is_taxonomy_hierarchical($taxonomy) && !empty($parent) ) { 
     
    11611161        $slug = wp_unique_term_slug($slug, (object) $args); 
    11621162        if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) ) 
    1163             return new WP_Error('db_insert_error', __('Could not insert term into the database')); 
     1163            return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error); 
    11641164        $term_id = (int) $wpdb->insert_id; 
    11651165    } 
  • trunk/wp-includes/wp-db.php

    r7419 r7431  
    1919    var $show_errors = false; 
    2020    var $suppress_errors = false; 
     21    var $last_error = ''; 
    2122    var $num_queries = 0; 
    2223    var $last_query; 
     
    279280 
    280281        // If there is an error then take note of it.. 
    281         if ( mysql_error($this->dbh) ) { 
     282        if ( $this->last_error = mysql_error($this->dbh) ) { 
    282283            $this->print_error(); 
    283284            return false; 
Note: See TracChangeset for help on using the changeset viewer.