[wp-trac] [WordPress Trac] #21663: Use PDO or mysqli for MySQL queries when available

WordPress Trac noreply at wordpress.org
Wed Nov 27 20:53:45 UTC 2013


#21663: Use PDO or mysqli for MySQL queries when available
--------------------------------------------------+------------------
 Reporter:  scottconnerly                         |       Owner:
     Type:  task (blessed)                        |      Status:  new
 Priority:  normal                                |   Milestone:  3.8
Component:  Database                              |     Version:  3.5
 Severity:  normal                                |  Resolution:
 Keywords:  dev-feedback has-patch needs-testing  |
--------------------------------------------------+------------------

Comment (by nacin):

 [attachment:21663.5.diff] looks solid. Some thoughts:
  * The filter is too early for a plugin to modify it. We should remove it.
 If you want to use mysqli, then for 3.8, you have to use the latest
 version of PHP. Or, we *could* add a constant here, as I don't think it
 would be difficult to keep around in a backwards compatible manner.
  * The mysqli_set_charset conditional likely still needs the has_cap()
 check. Or was it removed deliberately?
  * I double-checked that the client flags are the same value, whether
 MYSQL_* or MYSQLI_*, so that's cool.
  * The wpdb::load_col_info() should do the for loop inside the use_mysqli
 conditionals. It merges to conditionals into one and makes it easier to
 read.
  * Let's set `$this->last_error = mysqli_error( $this->dbh )` in its own
 conditional, rather than duplicating the logic inside both branches of the
 if statement.
  * It may be cleaner to reverse the nesting of WP_DEBUG and use_mysqli,
 that way the mysqli commands are together. mysqli_init() also doesn't need
 to be silenced, so this will reduce that to one line.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/21663#comment:143>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list