Opened 8 years ago
Last modified 4 years ago
#31624 new enhancement
$wpdb->prepare() named placeholders
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.2 |
Component: | Database | Keywords: | needs-unit-tests |
Focuses: | Cc: |
Description
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.
Attachments (1)
Change History (3)
Note: See
TracTickets for help on using
tickets.
->prepare() named placeholders