Search in sources :

Example 1 with WhereConditionElement

use of io.requery.query.element.WhereConditionElement in project requery by requery.

the class WhereGenerator method write.

@Override
public void write(Output output, WhereElement query) {
    QueryBuilder qb = output.builder();
    ExistsElement<?> whereExists = query.getWhereExistsElement();
    if (whereExists != null) {
        qb.keyword(WHERE);
        if (whereExists.isNotExists()) {
            qb.keyword(NOT);
        }
        qb.keyword(EXISTS);
        qb.openParenthesis();
        Supplier<?> wrapper = whereExists.getQuery();
        output.appendQuery((QueryWrapper) wrapper);
        qb.closeParenthesis().space();
    } else if (query.getWhereElements() != null && query.getWhereElements().size() > 0) {
        qb.keyword(WHERE);
        for (WhereConditionElement<?> w : query.getWhereElements()) {
            output.appendConditional(w);
        }
    }
}
Also used : WhereConditionElement(io.requery.query.element.WhereConditionElement) QueryBuilder(io.requery.sql.QueryBuilder)

Aggregations

WhereConditionElement (io.requery.query.element.WhereConditionElement)1 QueryBuilder (io.requery.sql.QueryBuilder)1