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

WordPress Trac noreply at wordpress.org
Fri Nov 22 01:03:36 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 aaroncampbell):

 Replying to [comment:137 dd32]:
 > Quick thoughts on [attachment:21663.3.diff​], Perhaps it'd be best to
 stick to full if's rather than ternaries? It makes the diff nice and
 short, but would be much more readable with full if's instead.

 After creating the diff I thought about that.  I stuck with the ternaries
 because they're beneficial for the while (such as `while ( $row = (
 $this->use_mysqli )? @mysqli_fetch_object( $this->result ) :
 @mysql_fetch_object( $this->result ) )` ) and using them everywhere kept
 things uniform.  I can break most of them into full ifs though.

 Replying to [comment:138 wonderboymusic]:
 > You can set the flags if you you use `mysql_real_connect()` - see here
 where I did this at the end of 3.7 for fun:
 http://core.trac.wordpress.org/attachment/ticket/25282/25282.diff

 Thanks.  I'll look into `mysqli_init()` and `mysql_real_connect()`

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


More information about the wp-trac mailing list