Java Code Examples for android.database.sqlite.SQLiteQuery

The following examples show how to use android.database.sqlite.SQLiteQuery. These examples are extracted from open source projects. 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 Project: geopackage-android   Source File: GeoPackageCursorFactory.java    License: 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 Project: geopackage-android   Source File: GeoPackageCursorFactory.java    License: 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 Project: whassup   Source File: Whassup.java    License: 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 Project: QuantumFlux   Source File: QuantumFluxCursorFactory.java    License: 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 5
Source Project: CPOrm   Source File: CPOrmCursorFactory.java    License: 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 6
Source Project: ApkTrack   Source File: SugarCursorFactory.java    License: 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 7
Source Project: NexusData   Source File: DatabaseHelper.java    License: 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 8
Source Project: UTubeTV   Source File: CursorFactoryDebugger.java    License: 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 9
Source Project: alchemy   Source File: SQLiteCompat.java    License: Apache License 2.0 4 votes vote down vote up
static SQLiteQuery newQuery(SQLiteDatabase db, String sql) {
    return QUERY_IMPL.newInstance(db, sql);
}
 
Example 10
Source Project: squidb   Source File: SquidCursorFactory.java    License: 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 11
Source Project: commcare-android   Source File: DecryptingCursor.java    License: 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 12
Source Project: android-schema-utils   Source File: SQLiteMaster.java    License: 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 13
Source Project: alchemy   Source File: SQLiteCompat.java    License: Apache License 2.0 votes vote down vote up
SQLiteQuery newInstance(SQLiteDatabase db, String sql);