[wp-trac] Re: [WordPress Trac] #2721: Add filter for wp-db query

WordPress Trac wp-trac at lists.automattic.com
Fri Sep 1 11:37:34 GMT 2006


#2721: Add filter for wp-db query
-----------------------------------+----------------------------------------
 Reporter:  filosofo               |        Owner:  anonymous
     Type:  defect                 |       Status:  new      
 Priority:  normal                 |    Milestone:  2.1      
Component:  Administration         |      Version:  2.1      
 Severity:  normal                 |   Resolution:           
 Keywords:  wp-db has-patch query  |  
-----------------------------------+----------------------------------------
Comment (by majelbstoat):

 I believe he means that you could do something like this:


 {{{
 class Mywpdb extends wpdb {

 function query($query) {
   str_replace('SELECT', 'SELECT DISTINCT', $query);
   parent::query($query);
 }

 }

 $mywpdb = new MyWpdb();
 $mywpdb->get_results("SELECT id FROM post WHERE name like '%filosofo%'");
 }}}


 which would only get you distinct results.  Not a good example obviously,
 but you get the idea.  Nevertheless, I also would like the extra
 flexibility that this filter would provide.

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


More information about the wp-trac mailing list