[wp-trac] [WordPress Trac] #32315: $wpdb->insert fails without error msg

WordPress Trac noreply at wordpress.org
Tue Nov 8 02:41:17 UTC 2016


#32315: $wpdb->insert fails without error msg
------------------------------------------+------------------------------
 Reporter:  dlt101                        |       Owner:
     Type:  defect (bug)                  |      Status:  reopened
 Priority:  normal                        |   Milestone:  Awaiting Review
Component:  Database                      |     Version:
 Severity:  normal                        |  Resolution:
 Keywords:  needs-patch needs-unit-tests  |     Focuses:
------------------------------------------+------------------------------

Comment (by pento):

 Thanks for the reminder, @mnelson4. :-)

 Replying to [comment:20 dd32]:
 > This one is a little more difficult, as in some cases a query hasn't
 been provided.
 >  - For the case in `wpdb::query()` it makes sense IMHO to set
 `last_query` to the aborted query.

 Yup.

 >  - For the cases in `wpdb::_insert_replace_helper()`, `wpdb::delete()`
 and `wpdb::update()` it seems like not setting a query would be OK,
 continuing to build the query seems like it'll add significant code for
 small benefit. Could also set it to something non-query-like such as
 `\$wpdb->update( $table )`

 I'm inclined to leave `last_query` blank, and have `last_error` include
 which table/column it failed on, in which CRUD method. As @dd32 mentioned,
 generating the actual query is a lot of effort, and the query has minimal
 relation to the method call.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/32315#comment:27>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list