Search in sources :

Example 1 with RowExpression

use of io.requery.query.RowExpression in project requery by requery.

the class DefaultOutput method appendColumnExpression.

private void appendColumnExpression(Expression expression) {
    switch(expression.getExpressionType()) {
        case ATTRIBUTE:
            Attribute attribute = (Attribute) expression;
            qb.attribute(attribute);
            break;
        default:
            if (expression instanceof RowExpression) {
                RowExpression collection = (RowExpression) expression;
                qb.openParenthesis();
                qb.commaSeparated(collection.getExpressions(), new QueryBuilder.Appender<Expression<?>>() {

                    @Override
                    public void append(QueryBuilder qb, Expression<?> value) {
                        appendColumnForSelect(value);
                    }
                });
                qb.closeParenthesis().space();
            } else {
                qb.append(expression.getName()).space();
            }
            break;
    }
}
Also used : QueryAttribute(io.requery.meta.QueryAttribute) Attribute(io.requery.meta.Attribute) Expression(io.requery.query.Expression) NamedExpression(io.requery.query.NamedExpression) RowExpression(io.requery.query.RowExpression) RowExpression(io.requery.query.RowExpression) QueryBuilder(io.requery.sql.QueryBuilder)

Aggregations

Attribute (io.requery.meta.Attribute)1 QueryAttribute (io.requery.meta.QueryAttribute)1 Expression (io.requery.query.Expression)1 NamedExpression (io.requery.query.NamedExpression)1 RowExpression (io.requery.query.RowExpression)1 QueryBuilder (io.requery.sql.QueryBuilder)1