[wp-trac] [WordPress Trac] #11102: $wpdb->prepare should merge all arguments to pass to vsprintf

WordPress Trac wp-trac at lists.automattic.com
Sun Nov 8 11:21:26 UTC 2009


#11102: $wpdb->prepare should merge all arguments to pass to vsprintf
-------------------------+--------------------------------------------------
 Reporter:  westi        |       Owner:  westi            
     Type:  enhancement  |      Status:  new              
 Priority:  normal       |   Milestone:  3.0              
Component:  Database     |     Version:  2.9              
 Severity:  normal       |    Keywords:  needs-patch early
-------------------------+--------------------------------------------------
 Currently you can't do something like this:

 {{{
 $wpdb->prepare("SELECT * FROM $table WHERE `x` = %s AND type IN
 (%d,%d,%d)", $where, $in_array);
 }}}

 You can do:

 {{{
 $wpdb->prepare("SELECT * FROM $table WHERE type IN (%d,%d,%d)",
 $in_array);
 }}}

 It would be really good if prepare took all the replacement arguments and
 built up a single array for you so you had the freedom to pass in arrays
 and strings for different replacement types.

 Inspired by #11100

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/11102>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list