[Solar-svn] Revision 3154
pmjones at solarphp.com
pmjones at solarphp.com
Tue May 6 13:13:12 CDT 2008
Solar_Sql_Select: [FIX] It's not "distinct" that messes things up, it's "group", so check for that instead when counting pages.
Modified: trunk/Solar/Sql/Select.php
===================================================================
--- trunk/Solar/Sql/Select.php 2008-05-05 23:14:16 UTC (rev 3153)
+++ trunk/Solar/Sql/Select.php 2008-05-06 18:13:07 UTC (rev 3154)
@@ -1185,23 +1185,23 @@
$select->_sources[$key]['cols'] = array();
}
- // look for a DISTINCT setting
- $is_distinct = $select->_parts['distinct'];
+ // look for a GROUP setting
+ $has_grouping = (bool) $select->_parts['group'];
// look in the WHERE and HAVING clauses for a `COUNT` condition
$has_count_cond = $this->_hasCountCond($select->_parts['where']) ||
$this->_hasCountCond($select->_parts['having']);
- // is there a count condition or a distinct?
- if ($has_count_cond || $is_distinct) {
+ // is there a grouping or a count condition?
+ if ($has_grouping || $has_count_cond) {
// count on a sub-select instead.
$count = $this->_countSubSelect($select, $col);
} else {
- // "normal" case (no count condition in WHERE or HAVING).
- // add the one column we're counting on...
+ // "normal" case (no grouping, and no count condition in WHERE or
+ // HAVING). add the one column we're counting on...
$select->_addSource(
'cols', // type
null, // name
More information about the Solar-svn
mailing list