[wp-trac] [WordPress Trac] #12819: wpdb::prepare support for null
WordPress Trac
noreply at wordpress.org
Mon Dec 24 15:46:55 UTC 2012
#12819: wpdb::prepare support for null
-------------------------+-----------------------------
Reporter: roxaz | Owner: ryan
Type: enhancement | Status: reopened
Priority: normal | Milestone: Future Release
Component: Database | Version:
Severity: normal | Resolution:
Keywords: needs-patch |
-------------------------+-----------------------------
Comment (by miqrogroove):
Replying to [comment:9 jbutkus]:
> Why I propose replacement-based solution is that other way round would
be implementing fully-fledged string parsing, to decode positional
information, and one would have to take into account all sorts of
possibilies (i.e. {{{INSERT INTO foo ( col1, col2, col3 ) VALUES ( %2$s,
%3$d, %s ) ON DUPLICATE KEY UPDATE SET col3 = %3$s, col2 = %s }}}).
That syntax is neither used nor supported by wpdb::prepare, thankfully.
What we're discussing is a simple matter of replacing the three supported
placeholders with a literal NULL. The only syntactical complication is
that this operation must avoid the regexp quoting of strings for the null
args.
Random hashes are not needed here, because in a worst-case replacement
strategy it would be adequate to use a static placeholder string that is
invalid in SQL.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/12819#comment:10>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list