android.database.sqlite.SQLiteCursorDriver#androidx.sqlite.db.SupportSQLiteQuery源码实例Demo

下面列出了android.database.sqlite.SQLiteCursorDriver#androidx.sqlite.db.SupportSQLiteQuery 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: FairEmail   文件: DBUtil.java
/**
 * Performs the SQLiteQuery on the given database.
 * <p>
 * This util method encapsulates copying the cursor if the {@code maybeCopy} parameter is
 * {@code true} and either the api level is below a certain threshold or the full result of the
 * query does not fit in a single window.
 *
 * @param db          The database to perform the query on.
 * @param sqLiteQuery The query to perform.
 * @param maybeCopy   True if the result cursor should maybe be copied, false otherwise.
 * @param signal      The cancellation signal to be attached to the query.
 * @return Result of the query.
 */
@NonNull
public static Cursor query(@NonNull RoomDatabase db, @NonNull SupportSQLiteQuery sqLiteQuery,
        boolean maybeCopy, @Nullable CancellationSignal signal) {
    final Cursor cursor = db.query(sqLiteQuery, signal);
    if (maybeCopy && cursor instanceof AbstractWindowedCursor) {
        AbstractWindowedCursor windowedCursor = (AbstractWindowedCursor) cursor;
        int rowsInCursor = windowedCursor.getCount(); // Should fill the window.
        int rowsInWindow;
        if (windowedCursor.hasWindow()) {
            rowsInWindow = windowedCursor.getWindow().getNumRows();
        } else {
            rowsInWindow = rowsInCursor;
        }
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M || rowsInWindow < rowsInCursor) {
            return CursorUtil.copyAndClose(windowedCursor);
        }
    }

    return cursor;
}
 
源代码2 项目: sqlite-android   文件: SQLiteDatabase.java
/**
 * Runs the provided SQL and returns a {@link Cursor} over the result set.
 *
 * @param supportQuery the SQL query. The SQL string must not be ; terminated
 * @param signal 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.
 * @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.
 */
@Override
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
public Cursor query(SupportSQLiteQuery supportQuery, android.os.CancellationSignal signal) {
    if (signal != null) {
        final CancellationSignal supportCancellationSignal = new CancellationSignal();
        signal.setOnCancelListener(new android.os.CancellationSignal.OnCancelListener() {
            @Override
            public void onCancel() {
                supportCancellationSignal.cancel();
            }
        });
        return query(supportQuery, supportCancellationSignal);
    } else {
        return query(supportQuery, (CancellationSignal) null);
    }
}
 
源代码3 项目: FairEmail   文件: LimitOffsetDataSource.java
protected LimitOffsetDataSource(RoomDatabase db, SupportSQLiteQuery query,
        boolean inTransaction, String... tables) {
    this(db, RoomSQLiteQuery.copyFrom(query), inTransaction, tables);
}
 
源代码4 项目: cwac-saferoom   文件: Database.java
/**
 * {@inheritDoc}
 */
@Override
public Cursor query(final SupportSQLiteQuery supportQuery) {
  return(query(supportQuery, null));
}
 
源代码5 项目: kripton   文件: SQLiteDatabase.java
@Override
public android.database.Cursor query(final SupportSQLiteQuery supportQuery, CancellationSignal cancellationSignal) {
	throw (new RuntimeException("Not implements"));
}
 
/**
 * {@inheritDoc}
 */
@Override
public Cursor query(final SupportSQLiteQuery supportQuery) {
	return (query(supportQuery, null));
}
 
源代码7 项目: kripton   文件: Database.java
/**
 * {@inheritDoc}
 */
@Override
public Cursor query(final SupportSQLiteQuery supportQuery) {
	return (query(supportQuery, null));
}
 
源代码8 项目: FairEmail   文件: DBUtil.java
/**
 * Performs the SQLiteQuery on the given database.
 * <p>
 * This util method encapsulates copying the cursor if the {@code maybeCopy} parameter is
 * {@code true} and either the api level is below a certain threshold or the full result of the
 * query does not fit in a single window.
 *
 * @param db          The database to perform the query on.
 * @param sqLiteQuery The query to perform.
 * @param maybeCopy   True if the result cursor should maybe be copied, false otherwise.
 * @return Result of the query.
 *
 * @deprecated This is only used in the generated code and shouldn't be called directly.
 */
@Deprecated
@NonNull
public static Cursor query(RoomDatabase db, SupportSQLiteQuery sqLiteQuery, boolean maybeCopy) {
    return query(db, sqLiteQuery, maybeCopy, null);
}
 
源代码9 项目: sqlite-android   文件: SQLiteDatabase.java
/**
 * Runs the provided SQL and returns a {@link Cursor} over the result set.
 *
 * @param supportQuery the SQL query.
 * @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.
 */
@Override
public Cursor query(final SupportSQLiteQuery supportQuery) {
    return query(supportQuery, (CancellationSignal) null);
}