Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #32315, comment 19


Ignore:
Timestamp:
11/01/2016 03:24:54 AM (9 years ago)
Author:
mnelson4
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #32315, comment 19

    initial v1  
    1 thanks for the reply @dd32; ya putting error in `$wpdb->last_error` would be conveniently simple for client code.
     1thanks for the reply @dd32; ya putting the error in `$wpdb->last_error` would be conveniently simple for client code.
    22
    3 Now what about `$wpdb->last_query`: should something be put in there when this error occurs? No query is ran, and the SQL statement doesn't even get generated. But I suspect most folks will still want to check it to see what went wrong with their insert or update query.
     3Now what about `$wpdb->last_query`: should something be put in there when this error occurs? No query is ran, and the SQL statement doesn't even get generated. But I suspect most folks will still want to check it to see what went wrong with their insert or update query (in addition to `$wpdb->last_error`).
    44
    5 So when this error occurs, should we finish generating the SQL, put it in `$wpdb->last_query` etc, but not run the query? (I think this would be the most helpful to folks, but it might be confusing for someone reading the code that we detect a error but wait to abort the process.) Or should `$wpdb->last_query` be set to a empty string (indicating no query ran)? or should it be set to some sort of descriptive phrase like "WordPress was about to insert values(x, y, z) into columns (w,v,r), but column 't' was too small" (this has the advantage of allowing us to abort the execution right away, but we're not creating actual SQL like we normally would)?
     5So when this error occurs, should we
     6
     71. finish generating the SQL, put it in `$wpdb->last_query` etc, but not run the query? (I think this would be the most helpful to folks, but it might be confusing for someone reading the code that we detect a error but wait to abort the process.) Or
     8
     92. should `$wpdb->last_query` be set to a empty string (indicating no query ran)? or
     10
     113. should it be set to some sort of descriptive phrase like "WordPress was about to insert values(x, y, z) into columns (w,v,r), but column 't' was too small" (this has the advantage of allowing us to abort the execution right away, but we're not creating actual SQL like we normally would)?
     12
     13Or something else?