Search in sources :

Example 1 with SQLSubQuery

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

the class AbstractBasicDao method createQuery.

/**
 * @param root
 * @param selectCallback
 * @param countCallback
 * @param modelMap
 * @param modifiers
 * @param applyLimitToSelectSql
 * @return
 */
public StreamableSqlQuery<T> createQuery(ASTNode root, StreamableRowCallback<T> selectCallback, StreamableRowCallback<Long> countCallback, Map<String, String> modelMap, Map<String, SQLColumnQueryAppender> modifiers, boolean applyLimitToSelectSql) {
    SQLStatement statement;
    if (useSubQuery) {
        statement = new SQLSubQuery(SELECT_ALL_BASE, COUNT_BASE, joins, getTableName(), TABLE_PREFIX, applyLimitToSelectSql, Common.envProps.getBoolean("db.forceUseIndex", false), null, this.indexes, this.databaseType);
    } else {
        statement = new SQLStatement(SELECT_ALL_BASE, COUNT_BASE, joins, getTableName(), TABLE_PREFIX, applyLimitToSelectSql, Common.envProps.getBoolean("db.forceUseIndex", false), this.indexes, this.databaseType);
    }
    if (root != null)
        root.accept(new RQLToSQLSelect<T>(this, modelMap, modifiers), statement);
    statement.build();
    return new StreamableSqlQuery<T>(this, Common.envProps.getBoolean("db.stream", false), statement, selectCallback, countCallback);
}
Also used : SQLSubQuery(com.infiniteautomation.mango.db.query.SQLSubQuery) StreamableSqlQuery(com.infiniteautomation.mango.db.query.StreamableSqlQuery) SQLStatement(com.infiniteautomation.mango.db.query.SQLStatement) RQLToSQLSelect(com.infiniteautomation.mango.db.query.RQLToSQLSelect)

Aggregations

RQLToSQLSelect (com.infiniteautomation.mango.db.query.RQLToSQLSelect)1 SQLStatement (com.infiniteautomation.mango.db.query.SQLStatement)1 SQLSubQuery (com.infiniteautomation.mango.db.query.SQLSubQuery)1 StreamableSqlQuery (com.infiniteautomation.mango.db.query.StreamableSqlQuery)1