Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.2.3

Bug #9734 problem with preg_replace statement in _buildGroup
Submitted: 2007-01-04 17:14 UTC
From: bbaumer at nymets dot com Assigned: quipo
Status: Closed Package: MDB_QueryTool (version 1.1.1)
PHP Version: 5.2.0 OS: Win XP
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 41 + 20 = ?

 
 [2007-01-04 17:14 UTC] bbaumer at nymets dot com (Ben Baumer)
Description: ------------ The "preg_replace" statement on line 1939 of MDB/QueryTool/Query.php does not work as expected. Specifically, this statement will add extraneous table names to the fields in the GROUP BY statement of a query, if the name of the grouped upon field appears as a column name in the table that is being searched. Test script: --------------- <?php require_once "MDB/QueryTool.php"; $dsn='mysqli://user:pass@localhost/mysql'; $query=new MDB_QueryTool($dsn,NULL,2); $query->setSelect("host, count(distinct user) as NumUsers"); $query->setTable("user"); $query->setGroup("host"); echo $query->getGroup(); echo "<br>"; print_r($query->metadata()); echo $query->getQueryString(); echo "<br>"; print_r($query->execute()); ?> Expected result: ---------------- host SELECT host, count(distinct user) as NumUsers FROM user GROUP BY user.host Actual result: -------------- host SELECT host, count(distinct user) as NumUsers FROM user GROUP BY user.user.host

Comments

 [2007-01-10 14:29 UTC] quipo (Lorenzo Alberton)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.