src/ORM/Connect/DBQueryBuilder.php
protected function buildSelectFragment(SQLSelect $query, array &$parameters)
    {
        $distinct = $query->getDistinct();
        $select = $query->getSelect();
        $clauses = array();

        foreach ($select as $alias => $field) {
            // Don't include redundant aliases.
            $fieldAlias = "\"{$alias}\"";
            if ($alias === $field || substr($field, -strlen($fieldAlias)) === $fieldAlias) {
                $clauses[] = $field;
            } else {
                $clauses[] = "$field AS $fieldAlias";
            }
        }

        $text = 'SELECT ';
        if ($distinct) {
            $text .= 'DISTINCT ';
        }
        return $text . implode(', ', $clauses);
    }
protected function buildSelectFragment(SQLSelect $query, array &$parameters)
    {
        $distinct = $query->getDistinct();
        $select = $query->getSelect();
        $clauses = array();

        foreach ($select as $alias => $field) {
            // Don't include redundant aliases.
            $fieldAlias = "\"{$alias}\"";
            if ($alias === $field || substr($field, -strlen($fieldAlias)) === $fieldAlias) {
                $clauses[] = $field;
            } else {
                $clauses[] = "$field AS $fieldAlias";
            }
        }

        $text = 'SELECT ';
        if ($distinct) {
            $text .= 'DISTINCT ';
        }
        return $text . implode(', ', $clauses);
    }
protected function buildSelectFragment ( SQLSelect $ query , array & $ parameters ) { $ distinct = $ query -> getDistinct ( ) ; $ select = $ query -> getSelect ( ) ; $ clauses = array ( ) ; foreach ( $ select as $ alias => $ field ) { // Don't include redundant aliases. $ fieldAlias = "\"{$alias}\"" ; if ( $ alias === $ field || substr ( $ field , - strlen ( $ fieldAlias ) ) === $ fieldAlias ) { $ clauses [ ] = $ field ; } else { $ clauses [ ] = "$field AS $fieldAlias" ; } } $ text = 'SELECT ' ; if ( $ distinct ) { $ text .= 'DISTINCT ' ; } return $ text . implode ( ', ' , $ clauses ) ; }
Returns the SELECT clauses ready for inserting into a query.

@param SQLSelect $query The expression object to build from
@param array $parameters Out parameter for the resulting query parameters
@return string Completed select part of statement
Returns the SELECT clauses ready for inserting into a query .