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  


 [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] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!