CI_DB_query_builder::_compile_group_by PHP Method

_compile_group_by() protected method

Escapes identifiers in GROUP BY statements at execution time. Required so that aliases are tracked properly, regardless of wether group_by() is called prior to from(), join() and dbprefix is added only if needed.
protected _compile_group_by ( ) : string
return string SQL statement
    protected function _compile_group_by()
    {
        if (count($this->qb_groupby) > 0) {
            for ($i = 0, $c = count($this->qb_groupby); $i < $c; $i++) {
                // Is it already compiled?
                if (is_string($this->qb_groupby[$i])) {
                    continue;
                }
                $this->qb_groupby[$i] = ($this->qb_groupby[$i]['escape'] === FALSE or $this->_is_literal($this->qb_groupby[$i]['field'])) ? $this->qb_groupby[$i]['field'] : $this->protect_identifiers($this->qb_groupby[$i]['field']);
            }
            return "\nGROUP BY " . implode(', ', $this->qb_groupby);
        }
        return '';
    }