public function toSQL(Parameters $params, bool $inner_clause)
    {
        $groups = $this->getGroups();
        $having = $this->getHaving();

        if (count($groups) === 0)
            throw new QueryException("No groups in GROUP BY clause");
            
        $drv = $params->getDriver();

        $parts = array();
        foreach ($groups as $group)
        {
            $parts[] = $drv->toSQL($params, $group);
        }
        
        $having = !empty($having) ? ' ' . $drv->toSQL($params, $having) : "";

        return "GROUP BY " . implode(", ", $parts) . $having;
    }
public function toSQL(Parameters $params, bool $inner_clause)
    {
        $groups = $this->getGroups();
        $having = $this->getHaving();

        if (count($groups) === 0)
            throw new QueryException("No groups in GROUP BY clause");
            
        $drv = $params->getDriver();

        $parts = array();
        foreach ($groups as $group)
        {
            $parts[] = $drv->toSQL($params, $group);
        }
        
        $having = !empty($having) ? ' ' . $drv->toSQL($params, $having) : "";

        return "GROUP BY " . implode(", ", $parts) . $having;
    }
public function toSQL ( Parameters $ params , bool $ inner_clause ) { $ groups = $ this -> getGroups ( ) ; $ having = $ this -> getHaving ( ) ; if ( count ( $ groups ) === 0 ) throw new QueryException ( "No groups in GROUP BY clause" ) ; $ drv = $ params -> getDriver ( ) ; $ parts = array ( ) ; foreach ( $ groups as $ group ) { $ parts [ ] = $ drv -> toSQL ( $ params , $ group ) ; } $ having = ! empty ( $ having ) ? ' ' . $ drv -> toSQL ( $ params , $ having ) : "" ; return "GROUP BY " . implode ( ", " , $ parts ) . $ having ; }
Write a GROUPBY clause as SQL query syntax
@param Parameters $params The query parameters: tables and placeholder values
@param bool $inner_clause Unused
@return string The generated SQL
Write a GROUPBY clause as SQL query syntax