Search in sources :

Example 1 with QueryComparison

use of com.infiniteautomation.mango.db.query.QueryComparison in project ma-core-public by infiniteautomation.

the class QueryModel method toString.

public String toString() {
    StringBuilder builder = new StringBuilder();
    for (QueryComparison c : andComparisons) {
        builder.append(c.toString());
        builder.append(" AND ");
    }
    for (QueryComparison c : orComparisons) {
        builder.append(c.toString());
        builder.append(" OR ");
    }
    if (sort.size() > 0) {
        builder.append(" SORT ON ");
        for (SortOption o : sort) {
            builder.append(o.getAttribute());
            if (o.isDesc()) {
                builder.append(" DESC ");
            } else {
                builder.append(" ASC ");
            }
        }
    }
    if (limit != null) {
        builder.append(" LIMIT ");
        builder.append(limit);
    }
    return builder.toString();
}
Also used : SortOption(com.infiniteautomation.mango.db.query.SortOption) QueryComparison(com.infiniteautomation.mango.db.query.QueryComparison)

Aggregations

QueryComparison (com.infiniteautomation.mango.db.query.QueryComparison)1 SortOption (com.infiniteautomation.mango.db.query.SortOption)1