Example usage for android.database.sqlite SQLiteCursorDriver query

List of usage examples for android.database.sqlite SQLiteCursorDriver query

Introduction

In this page you can find the example usage for android.database.sqlite SQLiteCursorDriver query.

Prototype

Cursor query(CursorFactory factory, String[] bindArgs);

Source Link

Document

Executes the query returning a Cursor over the result set.

Usage

From source file:io.requery.android.database.sqlite.SQLiteDatabase.java

/**
 * Runs the provided SQL and returns a cursor over the result set.
 *
 * @param cursorFactory the cursor factory to use, or null for the default factory
 * @param sql the SQL query. The SQL string must not be ; terminated
 * @param selectionArgs You may include ?s in where clause in the query,
 *     which will be replaced by the values from selectionArgs.
 * @param editTable the name of the first table, which is editable
 * @param cancellationSignal A signal to cancel the operation in progress, or null if none.
 * If the operation is canceled, then {@link OperationCanceledException} will be thrown
 * when the query is executed./*from  w  w  w  .j av  a 2  s .  c o m*/
 * @return A {@link Cursor} object, which is positioned before the first entry. Note that
 * {@link Cursor}s are not synchronized, see the documentation for more details.
 */
public Cursor rawQueryWithFactory(CursorFactory cursorFactory, String sql, Object[] selectionArgs,
        String editTable, CancellationSignal cancellationSignal) {
    acquireReference();
    try {
        SQLiteCursorDriver driver = new SQLiteDirectCursorDriver(this, sql, editTable, cancellationSignal);
        return driver.query(cursorFactory != null ? cursorFactory : mCursorFactory, selectionArgs);
    } finally {
        releaseReference();
    }
}