Search in sources :

Example 1 with RQLToSQLSelect

use of com.infiniteautomation.mango.db.query.RQLToSQLSelect 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)

Example 2 with RQLToSQLSelect

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

the class AbstractBasicDao method createQuery.

/**
 * @param root
 * @param applyLimitToSelectSql
 * @return
 */
public BaseSqlQuery<T> createQuery(ASTNode root, boolean applyLimitToSelectSql) {
    SQLStatement 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), statement);
    statement.build();
    return new BaseSqlQuery<T>(this, statement);
}
Also used : BaseSqlQuery(com.infiniteautomation.mango.db.query.BaseSqlQuery) SQLStatement(com.infiniteautomation.mango.db.query.SQLStatement) RQLToSQLSelect(com.infiniteautomation.mango.db.query.RQLToSQLSelect)

Aggregations

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