[wp-trac] [WordPress Trac] #15158: wpdb insert & update with null values

WordPress Trac noreply at wordpress.org
Fri Dec 28 17:15:44 UTC 2012


#15158: wpdb insert & update with null values
-------------------------+-----------------------------
 Reporter:  westi        |       Owner:  sorich87
     Type:  enhancement  |      Status:  accepted
 Priority:  normal       |   Milestone:  Future Release
Component:  Database     |     Version:  3.0.1
 Severity:  normal       |  Resolution:
 Keywords:  needs-patch  |
-------------------------+-----------------------------

Comment (by jbutkus):

 Replying to [comment:20 TechDagan]:
 > In the case of an INSERT, that would work fine. But a field cannot be
 updated to become NULL, only to contain an empty string or, in the case of
 an integer, 0. Boolean fields are completely unmanageable.

 I would go for one of:
     - do not provide a field (in format, or values list) if you don't want
 it to be touched;
     - provide field with it's indended format (be it %s, or %d, etc.) and
 a value of NULL, in case you want to INSERT/UPDATE field with NULL.

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


More information about the wp-trac mailing list