[wp-trac] [WordPress Trac] #15158: wpdb insert & update with null values
WordPress Trac
noreply at wordpress.org
Fri Jan 4 18:34:35 UTC 2013
#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: has-patch |
-------------------------+-----------------------------
Comment (by jbutkus):
Replying to [comment:27 deltafactory]:
> While I support the addition of NULL support, I wonder if it would break
some plugins that rely on wpdb::prepare() to convert null to zero or an
empty string. Would it make sense to support nulls when explicitly
enabled, for example:
>
> `$wpdb->enable_nulls = true;`
I think that (`$wpdb->enable_nulls = true;`) would introduce more trouble,
than anything else. As somebody would set it, and then forget to reset,
while others would expect it to be in one position.
Either it must be another method, that would allow something like this
(i.e. create method `wpdb::prepare_with_nulls( x, y )`), or just attempt
to ignore.
How a developer might expect this to be true, when there is no use for
NULL values, if __wpdb__ is used regularly, so far?
Albeit it is hard to guess, what a developer might expect.
I, for once, expect `wpdb::prepare( x, y )` to work correctly with
positional arguments (`'INSERT INTO foo SET bar = %2$s, baz = %d'`),
despite the fact, that it is clearly stated otherwise. And I think there
are people who use this, thus I tried to add support for such cases in
NULL checking.
So, yes, this is an oldish ticket, which needs some political resolution,
I suspect.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/15158#comment:29>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list