[wp-trac] [WordPress Trac] #42352: Support use of native MySQLi prepared queries

WordPress Trac noreply at wordpress.org
Fri Oct 27 04:15:53 UTC 2017


#42352: Support use of native MySQLi prepared queries
-------------------------+-----------------------------
 Reporter:  dd32         |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Database     |    Version:
 Severity:  normal       |   Keywords:  early
  Focuses:               |
-------------------------+-----------------------------
 When we added `$wpdb->prepare()` back in WordPress 2.3, we were forced to
 roll our own MySQL Prepared queries as the MySQL extension didn't support
 it.
 While the MySQL extension still doesn't, the majority of WordPress sites
 are likely using the newer MySQLi engine (by default, enabled for PHP 5.5+
 which accounts for 70~80% of sites). That makes now a good time to start
 investigating the potential implementation and usage of native prepared
 queries in the future.

 Attached is a first-draft of implementing native prepared queries into
 WPDB, it has no fallbacks for MySQL at present, but it would be possible
 to force support in for it using a "simple" SQL parser.
 Unfortunately I expect that this draft is incompatible with many DB drop-
 ins, which is okay, this is only a draft and proof-of-concept.

 I'll attach some examples of how this first draft could be used in a
 comment below.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42352>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list