[wp-trac] [WordPress Trac] #31624: $wpdb->prepare() named placeholders
WordPress Trac
noreply at wordpress.org
Fri Mar 13 08:36:54 UTC 2015
#31624: $wpdb->prepare() named placeholders
-------------------------+-----------------------------
Reporter: ozthegreat | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Database | Version: trunk
Severity: normal | Keywords:
Focuses: |
-------------------------+-----------------------------
I think it would be handy to add named placeholders to $wpdb->prepare().
The functionality exists in most modern frameworks and cuts out the need
for having to worry about the order of variables, (or repetition) in the
current vsprint like syntax.
What I'm proposing is that the second parameter of prepare() can
optionally be an associative array where the $key is the named placeholder
and the $value is the value associated with it.
This wont affect any existing functionality of prepare() and is fully
backwards compatible. If no associative array is passed it will continue
to work as always.
Patch with the described functionality is attached for testing.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/31624>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list