Home » Structures » Structures_DataGrid_DataSource_MDB2 » Bug #9342
function count() gives wrong answer with UNION query
Details
| Submitted | 2006-11-15 17:49 UTC |
|---|---|
| From | HarrySchool at netscape dot net |
| Assigned | olivierg |
| Status | Closed |
| Package | Structures_DataGrid_DataSource_MDB2 |
| PHP Version | 4.4.3 |
| OS | windows & linux |
| Roadmaps | (Not assigned) |
Comments
[2006-11-15 17:49 UTC] HarrySchool at netscape dot net
Description:
------------
In function count(), line 258
GROUP BY and DISTINCT are treated as special cases.
Als UNION should be treated as such.
See patch below
Test script:
---------------
Path: function count(), line 258
original:
elseif (preg_match('#GROUP\s*BY#is', $this->_query) === 1 ||
reg_match('#SELECT.*DISTINCT.*FROM#is', $this->_query) === 1
should be replaced by:
elseif (preg_match('#GROUP\s*BY#is', $this->_query) === 1 ||
preg_match('#\s*UNION\s*#is', $this->_query) === 1 ||
reg_match('#SELECT.*DISTINCT.*FROM#is', $this->_query) === 1
[2006-11-16 12:29 UTC] olivierg at php dot net
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.