[wp-trac] [WordPress Trac] #21800: Include error reporting on failed DB INSERT in term_relationships

WordPress Trac wp-trac at lists.automattic.com
Wed Sep 5 13:17:45 UTC 2012


#21800: Include error reporting on failed DB INSERT in term_relationships
-----------------------------------+------------------------------
 Reporter:  jndetlefsen            |       Owner:
     Type:  enhancement            |      Status:  new
 Priority:  normal                 |   Milestone:  Awaiting Review
Component:  Database               |     Version:  2.5
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch 2nd-opinion  |
-----------------------------------+------------------------------

Comment (by jndetlefsen):

 There are already cases where a failed INSERTS causes a WP_Error, for
 example in line 2088 in the same file, taxonomy.php. Or am i missing
 something?


 {{{
 if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug',
 'term_group' ) ) )
     return new WP_Error('db_insert_error', __('Could not insert term into
 the database'), $wpdb->last_error);
 }}}


 https://core.trac.wordpress.org/browser/trunk/wp-includes/taxonomy.php

 Our situation is that we have to update blogposts on >1000 blogs on a
 multisite and in some cases the taxonomy relationships don't get written
 to the database. We want to wrap those updates into mysql transaction but
 as of now we have no way to know when inserts have failed so that we can
 rollback those transactions to avoid to have blogposts with no tags.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21800#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list