Changeset 3154

Show
Ignore:
Timestamp:
05/06/08 13:13:07 (2 months ago)
Author:
pmjones
Message:

Solar_Sql_Select: [FIX] It's not "distinct" that messes things up, it's "group", so check for that instead when counting pages.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Solar/Sql/Select.php

    r3153 r3154  
    11861186        } 
    11871187         
    1188         // look for a DISTINCT setting 
    1189         $is_distinct = $select->_parts['distinct']; 
     1188        // look for a GROUP setting 
     1189        $has_grouping = (bool) $select->_parts['group']; 
    11901190         
    11911191        // look in the WHERE and HAVING clauses for a `COUNT` condition 
     
    11931193                          $this->_hasCountCond($select->_parts['having']); 
    11941194         
    1195         // is there a count condition or a distinct
    1196         if ($has_count_cond || $is_distinct) { 
     1195        // is there a grouping or a count condition
     1196        if ($has_grouping || $has_count_cond) { 
    11971197             
    11981198            // count on a sub-select instead. 
     
    12011201        } else { 
    12021202             
    1203             // "normal" case (no count condition in WHERE or HAVING). 
    1204             // add the one column we're counting on... 
     1203            // "normal" case (no grouping, and no count condition in WHERE or 
     1204            // HAVING).  add the one column we're counting on... 
    12051205            $select->_addSource( 
    12061206                'cols',         // type