android.database.sqlite.SQLiteCursorDriver Java Examples

The following examples show how to use android.database.sqlite.SQLiteCursorDriver. 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: GeoPackageCursorFactory.java    From geopackage-android with MIT License 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public Cursor newCursor(SQLiteDatabase db, SQLiteCursorDriver driver,
                        String editTable, SQLiteQuery query) {

    if (debugLogQueries) {
        Log.d(GeoPackageCursorFactory.class.getSimpleName(), query.toString());
    }

    // Create a standard cursor
    Cursor cursor = new SQLiteCursor(driver, editTable, query);

    // Wrap the cursor
    Cursor wrappedCursor = wrapCursor(cursor, editTable);

    return wrappedCursor;
}
 
Example #2
Source File: GeoPackageCursorFactory.java    From geopackage-android with MIT License 6 votes vote down vote up
/**
 * Get the SQLite Android Bindings cursor factory
 *
 * @return bindings cursor factory
 * @since 3.4.0
 */
public org.sqlite.database.sqlite.SQLiteDatabase.CursorFactory getBindingsCursorFactory() {
    return new org.sqlite.database.sqlite.SQLiteDatabase.CursorFactory() {

        /**
         * {@inheritDoc}
         */
        @Override
        public Cursor newCursor(org.sqlite.database.sqlite.SQLiteDatabase db, org.sqlite.database.sqlite.SQLiteCursorDriver driver, String editTable, org.sqlite.database.sqlite.SQLiteQuery query) {

            if (debugLogQueries) {
                Log.d(GeoPackageCursorFactory.class.getSimpleName(), query.toString());
            }

            // Create a standard cursor
            Cursor cursor = new org.sqlite.database.sqlite.SQLiteCursor(driver, editTable, query);

            // Wrap the cursor
            Cursor wrappedCursor = wrapCursor(cursor, editTable);

            return wrappedCursor;
        }

    };
}
 
Example #3
Source File: Whassup.java    From whassup with Apache License 2.0 6 votes vote down vote up
public SQLiteDatabase openDatabase(final File dbFile) {
    return SQLiteDatabase.openDatabase(dbFile.getAbsolutePath(), new SQLiteDatabase.CursorFactory() {
        @Override
        @SuppressWarnings("deprecation")
        public Cursor newCursor(final SQLiteDatabase db, SQLiteCursorDriver driver, String editTable, SQLiteQuery query) {
            return new SQLiteCursor(db, driver, editTable, query) {
                @Override
                public void close() {
                    Log.d(TAG, "closing cursor");
                    super.close();
                    db.close();
                    if (!dbFile.delete()) {
                        Log.w(TAG, "could not delete database " + dbFile);
                    }
                }
            };
        }
    }, SQLiteDatabase.OPEN_READWRITE);
}
 
Example #4
Source File: AndroidQuery.java    From alchemy with Apache License 2.0 5 votes vote down vote up
@Override
public SQLiteIterator select() {
    mDb.acquireReference();
    try {
        final SQLiteCursorDriver driver = SQLiteCompat.newDriver(mDb, mSql);
        return new CursorIterator(new SQLiteCursor(driver, null, mQuery));
    } finally {
        mDb.releaseReference();
    }
}
 
Example #5
Source File: QuantumFluxCursorFactory.java    From QuantumFlux with Apache License 2.0 5 votes vote down vote up
@Override
public Cursor newCursor(SQLiteDatabase sqLiteDatabase, SQLiteCursorDriver sqLiteCursorDriver, String tableName, SQLiteQuery sqLiteQuery) {
    if (isDebugEnabled) {
        QuantumFluxLog.d(sqLiteQuery.toString());
    }

    return new SQLiteCursor(sqLiteCursorDriver, tableName, sqLiteQuery);
}
 
Example #6
Source File: CPOrmCursorFactory.java    From CPOrm with MIT License 5 votes vote down vote up
@Override
public Cursor newCursor(SQLiteDatabase sqLiteDatabase, SQLiteCursorDriver sqLiteCursorDriver, String tableName, SQLiteQuery sqLiteQuery) {

    if (debugEnabled) {
        CPOrmLog.d(sqLiteQuery.toString());
    }

    return new SQLiteCursor(sqLiteCursorDriver, tableName, sqLiteQuery);
}
 
Example #7
Source File: SugarCursorFactory.java    From ApkTrack with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
public Cursor newCursor(SQLiteDatabase sqLiteDatabase,
        SQLiteCursorDriver sqLiteCursorDriver,
        String editTable,
        SQLiteQuery sqLiteQuery) {

    if (debugEnabled) {
        Log.d("SQL Log", sqLiteQuery.toString());
    }

    return new SQLiteCursor(sqLiteDatabase, sqLiteCursorDriver, editTable, sqLiteQuery);
}
 
Example #8
Source File: DatabaseHelper.java    From NexusData with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
public Cursor newCursor(SQLiteDatabase db, SQLiteCursorDriver masterQuery,
                        String editTable, SQLiteQuery query) {
    LOG.debug(query.toString());

    // non-deprecated API is only available in API 11
    return new SQLiteCursor(db, masterQuery, editTable, query);
}
 
Example #9
Source File: CursorFactoryDebugger.java    From UTubeTV with The Unlicense 5 votes vote down vote up
@Override
public Cursor newCursor(SQLiteDatabase db, SQLiteCursorDriver masterQuery, String editTable, SQLiteQuery query) {
  if (debugQueries) {
    DUtils.log(query.toString());
  }
  return new SQLiteCursor(masterQuery, editTable, query);
}
 
Example #10
Source File: SQLiteCompat.java    From alchemy with Apache License 2.0 4 votes vote down vote up
static SQLiteCursorDriver newDriver(SQLiteDatabase db, String sql) {
    return DRIVER_IMPL.newInstance(db, sql);
}
 
Example #11
Source File: SquidCursorFactory.java    From squidb with Apache License 2.0 4 votes vote down vote up
@Override
public Cursor newCursor(SQLiteDatabase db, SQLiteCursorDriver masterQuery, String editTable, SQLiteQuery query) {
    bindArgumentsToProgram(query, sqlArgs);
    return new SQLiteCursor(masterQuery, editTable, query);
}
 
Example #12
Source File: DecryptingCursor.java    From commcare-android with Apache License 2.0 4 votes vote down vote up
public DecryptingCursor(SQLiteDatabase db, SQLiteCursorDriver driver, String editTable, SQLiteQuery query, EncryptedModel model, CipherPool pool) {
    super(db, driver, editTable, query);
    this.model = model;
    this.pool = pool;
    this.cipher = pool.borrow();
}
 
Example #13
Source File: SQLiteMaster.java    From android-schema-utils with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
public Cursor newCursor(SQLiteDatabase db, SQLiteCursorDriver masterQuery, String editTable, SQLiteQuery query) {
  return new SQLiteCursor(db, masterQuery, editTable, query);
}
 
Example #14
Source File: SQLiteCompat.java    From alchemy with Apache License 2.0 votes vote down vote up
SQLiteCursorDriver newInstance(SQLiteDatabase db, String sql);