Java Code Examples for com.activeandroid.util.SQLiteUtils#intQuery()

The following examples show how to use com.activeandroid.util.SQLiteUtils#intQuery() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Dao.java    From 10000sentences with Apache License 2.0 4 votes vote down vote up
public SentenceCollection reloadCollectionCounter(SentenceCollection collection) {
    DBG.todo("Threads");

    int rows = SQLiteUtils.intQuery(
            "select count(*) from sentence where collection_id = ?",
            new String[] {collection.getCollectionID()});
    int todoRows = SQLiteUtils.intQuery(
            "select count(*) from sentence where collection_id = ? and status = ?",
            new String[] {collection.getCollectionID(), String.valueOf(SentenceStatus.TODO.getStatus())});
    int againRows = SQLiteUtils.intQuery(
            "select count(*) from sentence where collection_id = ? and status = ?",
            new String[] {collection.getCollectionID(), String.valueOf(SentenceStatus.REPEAT.getStatus())});
    int doneRows = SQLiteUtils.intQuery(
            "select count(*) from sentence where collection_id = ? and status = ?",
            new String[] {collection.getCollectionID(), String.valueOf(SentenceStatus.DONE.getStatus())});
    int ignoreRows = SQLiteUtils.intQuery(
            "select count(*) from sentence where collection_id = ? and status = ?",
            new String[] {collection.getCollectionID(), String.valueOf(SentenceStatus.IGNORE.getStatus())});
    int skippedRows = SQLiteUtils.intQuery(
            "select count(*) from sentence where collection_id = ? and status = ?",
            new String[] {collection.getCollectionID(), String.valueOf(SentenceStatus.SKIPPED.getStatus())});
    int annotationCount = SQLiteUtils.intQuery(
            "select count(*) from annotation where collection_id = ?",
            new String[] {collection.getCollectionID()});

    if (todoRows > SentenceCollection.MAX_SENTENCES) {
        todoRows = SentenceCollection.MAX_SENTENCES;
    }
    todoRows = todoRows - doneRows - skippedRows;

    collection.count = rows;
    collection.todoCount = todoRows;
    collection.repeatCount = againRows;
    collection.doneCount = doneRows;
    collection.ignoreCount = ignoreRows;
    collection.annotationCount = annotationCount;
    collection.skippedCount = skippedRows;
    collection.save();

    return collection;
}
 
Example 2
Source File: From.java    From clear-todolist with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Gets the number of rows returned by the query.
 */
public int count() {
    return SQLiteUtils.intQuery(toCountSql(), getArguments());
}
 
Example 3
Source File: From.java    From mobile-android-survey-app with MIT License 4 votes vote down vote up
/**
 * Gets the number of rows returned by the query.
 */
public int count() {
    return SQLiteUtils.intQuery(toCountSql(), getArguments());
}
 
Example 4
Source File: From.java    From clear-todolist with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Gets a value indicating whether the query returns any rows.
 * @return <code>true</code> if the query returns at least one row; otherwise, <code>false</code>.
 */
public boolean exists() {
    return SQLiteUtils.intQuery(toExistsSql(), getArguments()) != 0;
}
 
Example 5
Source File: From.java    From mobile-android-survey-app with MIT License 2 votes vote down vote up
/**
 * Gets a value indicating whether the query returns any rows.
 * @return <code>true</code> if the query returns at least one row; otherwise, <code>false</code>.
 */
public boolean exists() {
    return SQLiteUtils.intQuery(toExistsSql(), getArguments()) != 0;
}