[Solar-svn] Revision 3151
pmjones at solarphp.com
pmjones at solarphp.com
Mon May 5 17:45:21 CDT 2008
Solar_Sql_Select: [CHG] In method countPages(), use subselect counting on DISTINCT queries, too.
Modified: trunk/Solar/Sql/Select.php
===================================================================
--- trunk/Solar/Sql/Select.php 2008-05-04 22:18:45 UTC (rev 3150)
+++ trunk/Solar/Sql/Select.php 2008-05-05 22:45:21 UTC (rev 3151)
@@ -1185,12 +1185,15 @@
$select->_sources[$key]['cols'] = array();
}
+ // look for a DISTINCT setting
+ $is_distinct = $select->_parts['distinct'];
+
// 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?
- if ($has_count_cond) {
+ // is there a count condition or a distinct?
+ if ($has_count_cond || $is_distinct) {
// count on a sub-select instead.
$count = $this->_countSubSelect($select, $col);
More information about the Solar-svn
mailing list