protected function prepareFields($fields, $values) {
        $_fields = [];
        foreach ($fields as $field) {
            if ($field instanceof Query) { // sub-select SQL as field
                $field->setDialect($this->dialect);
                $field->setBindValues($values);
                $as = $field->getAlias();
                if ($as) {
                    $_fields [] = '(' . $field . ') AS ' . $this->sanitize('`' . $as . '`');
                }
            } else if ($field instanceof ImmutableValue) {
                $_fields [] = $field->__toString();
            } else { // this is simple field
                $_fields [] = $this->sanitize($field);
            }
        }
        if ($_fields) {
            return implode(',', $_fields);
        } else {
            return false;
        }
    }
protected function prepareFields($fields, $values) {
        $_fields = [];
        foreach ($fields as $field) {
            if ($field instanceof Query) { // sub-select SQL as field
                $field->setDialect($this->dialect);
                $field->setBindValues($values);
                $as = $field->getAlias();
                if ($as) {
                    $_fields [] = '(' . $field . ') AS ' . $this->sanitize('`' . $as . '`');
                }
            } else if ($field instanceof ImmutableValue) {
                $_fields [] = $field->__toString();
            } else { // this is simple field
                $_fields [] = $this->sanitize($field);
            }
        }
        if ($_fields) {
            return implode(',', $_fields);
        } else {
            return false;
        }
    }
protected function prepareFields ( $ fields , $ values ) { $ _fields = [ ] ; foreach ( $ fields as $ field ) { if ( $ field instanceof Query ) { // sub-select SQL as field $ field -> setDialect ( $ this -> dialect ) ; $ field -> setBindValues ( $ values ) ; $ as = $ field -> getAlias ( ) ; if ( $ as ) { $ _fields [ ] = '(' . $ field . ') AS ' . $ this -> sanitize ( '`' . $ as . '`' ) ; } } else if ( $ field instanceof ImmutableValue ) { $ _fields [ ] = $ field -> __toString ( ) ; } else { // this is simple field $ _fields [ ] = $ this -> sanitize ( $ field ) ; } } if ( $ _fields ) { return implode ( ',' , $ _fields ) ; } else { return false ; } }
prepare the fields in select SQL

@param array      $fields
@param BindValues $values

@return string
prepare the fields in select SQL