[wp-trac] [WordPress Trac] #15158: wpdb insert & update with null values
WordPress Trac
noreply at wordpress.org
Fri Dec 28 11:29:25 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:18 miqrogroove]:
> I would also like to remind everyone that NULL is often invalid in
MySQL, e.g.
>
> "To search for column values that are NULL, you cannot use an expr =
NULL test ... because expr = NULL is never true for any expression" --
MySQL refman
The {{{NULL}}} is not invalid.
It is just that there is special operation for NULL checking {{{IS
NULL}}}, instead of {{{= NULL}}}.
That is just to be expected, as field value is not NULL. The NULL is just
an indicator, that field does not have any value.
But I fully agree with [comment:18 comment 18 by miqrogroove], where
'null' (string) usage in favor of NULL (literary PHP **NULL** value) is
questioned. It would raise much more questions and issues, than come of
use to developers.
And if [comment:6 nacin] was talking about format string purely (i.e. use
'null' instead of '%s') - I can hardly understand the purpose of this. If
I would like to use NULL for field, I would just skip that field from SQL
statement, instead of adding 'null' format mask.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/15158#comment:19>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list