Java 类android.database.sqlite.SQLiteQuery 实例源码

项目:geopackage-android    文件:GeoPackageCursorFactory.java   
/**
 * {@inheritDoc}
 */
@Override
public Cursor newCursor(SQLiteDatabase db, SQLiteCursorDriver driver,
                        String editTable, SQLiteQuery query) {

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

    // Check if there is an edit table
    if (editTable != null) {
        // Check if the table has a cursor wrapper
        GeoPackageCursorWrapper cursorWrapper = tableCursors.get(editTable);
        if (cursorWrapper != null) {
            cursor = cursorWrapper.wrapCursor(cursor);
        }
    }

    return cursor;
}
项目:whassup    文件:Whassup.java   
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);
}
项目:cerberus    文件:CerberusCursorFactory.java   
@Override
public Cursor newCursor(SQLiteDatabase db, SQLiteCursorDriver masterQuery, String editTable, SQLiteQuery query) {
  Cursor cursor = CURSOR_FACTORY.newCursor(db, masterQuery, editTable, query);

  long start = System.currentTimeMillis();
  cursor.getCount(); // to fill window
  long end = System.currentTimeMillis();

  long elapsed = end - start;
  if (elapsed > mQueryTimeLimit) {
    // ugly hack warning, the next line depends on current SQLiteQuery implementation:
    String queryString = query.toString().substring("SQLiteQuery: ".length());
    List<String> queryPlan = mQueryPlanGetter.getQueryPlan(db, queryString, editTable);

    dumpIssueReport(queryString, queryPlan, elapsed);
  }

  return cursor;
}
项目:beige-software    文件:CursorFactory.java   
@Override
public final Cursor newCursor(final SQLiteDatabase pDb,
  final SQLiteCursorDriver pMasterQuery, final String pEditTable,
    final SQLiteQuery pQuery) {
  return new SQLiteCursor(pDb, pMasterQuery, pEditTable, pQuery) {

    @Override
    public boolean requery() {
        setSelectionArguments(new String[] {"2"});
        return super.requery();
    }
  };
}
项目:forsuredbandroid    文件:FSCursorFactory.java   
@Override
public Cursor newCursor(SQLiteDatabase db, SQLiteCursorDriver masterQuery, String editTable, SQLiteQuery query) {
    if (FSDBHelper.inst().inDebugMode()) {
        Log.d("forsuredb", "Running query: " + masterQuery.toString());
    }
    return new FSCursor(new SQLiteCursor(masterQuery, editTable, query));
}
项目:simpledb    文件:CloseCursorFactory.java   
@Override
public Cursor newCursor(SQLiteDatabase db, SQLiteCursorDriver masterQuery, String editTable, SQLiteQuery query) {
    /**
     * {@link SQLiteDatabase} and {@link android.database.sqlite.SQLiteDirectCursorDriver}
     */
    return new AutoCloseCursor(new SQLiteCursor(masterQuery, editTable, query));
}
项目:QuantumFlux    文件:QuantumFluxCursorFactory.java   
@Override
public Cursor newCursor(SQLiteDatabase sqLiteDatabase, SQLiteCursorDriver sqLiteCursorDriver, String tableName, SQLiteQuery sqLiteQuery) {
    if (isDebugEnabled) {
        QuantumFluxLog.d(sqLiteQuery.toString());
    }

    return new SQLiteCursor(sqLiteCursorDriver, tableName, sqLiteQuery);
}
项目:AndroidLife    文件:FrameworkSQLiteDatabase.java   
@Override
public Cursor rawQuery(final SupportSQLiteQuery supportQuery) {
    return rawQueryWithFactory(new SQLiteDatabase.CursorFactory() {
        @Override
        public Cursor newCursor(SQLiteDatabase db, SQLiteCursorDriver masterQuery,
                                String editTable, SQLiteQuery query) {
            supportQuery.bindTo(new FrameworkSQLiteProgram(query));
            return new SQLiteCursor(masterQuery, editTable, query);
        }
    }, supportQuery.getSql(), EMPTY_STRING_ARRAY, null);
}
项目:joogar    文件:JoogarCursorFactory.java   
@SuppressWarnings("deprecation")
public Cursor newCursor(SQLiteDatabase sqLiteDatabase,
                        SQLiteCursorDriver sqLiteCursorDriver,
                        String editTable,
                        SQLiteQuery sqLiteQuery) {

    if(Joogar.isDebug()) {
        Joogar.getInstance().getLogger().d(sqLiteQuery.toString());
    }

    return new SQLiteCursor(sqLiteDatabase, sqLiteCursorDriver, editTable, sqLiteQuery);
}
项目:CPOrm    文件:CPOrmCursorFactory.java   
@Override
public Cursor newCursor(SQLiteDatabase sqLiteDatabase, SQLiteCursorDriver sqLiteCursorDriver, String tableName, SQLiteQuery sqLiteQuery) {

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

    return new SQLiteCursor(sqLiteCursorDriver, tableName, sqLiteQuery);
}
项目:ApkTrack    文件:SugarCursorFactory.java   
@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);
}
项目:commcare-android    文件:LegacyCommCareDBCursorFactory.java   
@Override
public Cursor newCursor(SQLiteDatabase db, SQLiteCursorDriver masterQuery, String editTable, SQLiteQuery query) {
    if (models == null || !models.containsKey(editTable)) {
        return new SQLiteCursor(db, masterQuery, editTable, query);
    } else {
        EncryptedModel model = models.get(editTable);
        return new DecryptingCursor(db, masterQuery, editTable, query, model, getCipherPool());
    }
}
项目:NexusData    文件:DatabaseHelper.java   
@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);
}
项目:mv-fieldguide-android    文件:FieldGuideDatabase.java   
@Override
public Cursor newCursor(SQLiteDatabase db, SQLiteCursorDriver masterQuery, 
                        String editTable, SQLiteQuery query) {
    if (debugQueries) {
        Log.d("SQL", query.toString());
    }
    return new SQLiteCursor(db, masterQuery, editTable, query);
}
项目:scrumchatter    文件:ScrumChatterProvider.java   
/**
 * Log the query of the given cursor.
 */
private void logCursor(Cursor cursor, String[] selectionArgs) {
    try {
        Field queryField = SQLiteCursor.class.getDeclaredField("mQuery");
        queryField.setAccessible(true);
        SQLiteQuery sqliteQuery = (SQLiteQuery) queryField.get(cursor);
        Log.v(TAG, sqliteQuery.toString() + ": " + Arrays.toString(selectionArgs));
    } catch (Exception e) {
        Log.v(TAG, e.getMessage(), e);
    }
}
项目:bunurong-fieldguide-Android    文件:FieldGuideDatabase.java   
@Override
public Cursor newCursor(SQLiteDatabase db, SQLiteCursorDriver masterQuery, 
                        String editTable, SQLiteQuery query) {
    if (debugQueries) {
        Log.d("SQL", query.toString());
    }
    return new SQLiteCursor(db, masterQuery, editTable, query);
}
项目:UTubeTV    文件:CursorFactoryDebugger.java   
@Override
public Cursor newCursor(SQLiteDatabase db, SQLiteCursorDriver masterQuery, String editTable, SQLiteQuery query) {
  if (debugQueries) {
    DUtils.log(query.toString());
  }
  return new SQLiteCursor(masterQuery, editTable, query);
}
项目:oma-riista-android    文件:AsyncCursor.java   
public AsyncCursor(SQLiteDatabase db, SQLiteCursorDriver driver, String editTable, SQLiteQuery query) {
    super(db, driver, editTable, query);
}
项目:oma-riista-android    文件:AsyncCursorFactory.java   
@Override
public Cursor newCursor(SQLiteDatabase db, SQLiteCursorDriver driver, String editTable, SQLiteQuery query) {
    return new AsyncCursor(db, driver, editTable, query);
}
项目:aos-MediaLib    文件:CustomCursorFactory.java   
@Override
public Cursor newCursor(SQLiteDatabase db, SQLiteCursorDriver masterQuery,
        String editTable, SQLiteQuery query) {
    Cursor cursor = new SQLiteCursor(masterQuery, editTable, query);
    return new CustomCursor(cursor);
}
项目:aos-MediaLib    文件:ScraperCursorFactory.java   
public Cursor newCursor(SQLiteDatabase db, SQLiteCursorDriver masterQuery,
        String editTable, SQLiteQuery query) {
    return new ScraperCursor(masterQuery, editTable, query);
}
项目:aos-MediaLib    文件:ScraperCursor.java   
public ScraperCursor(SQLiteCursorDriver driver,
        String editTable, SQLiteQuery query) {
    super(driver, editTable, query);
}
项目:alchemy    文件:SQLiteCompat.java   
static SQLiteQuery newQuery(SQLiteDatabase db, String sql) {
    return QUERY_IMPL.newInstance(db, sql);
}
项目:core-doppl    文件:DatabaseCursorTest.java   
@MediumTest
public void testRequeryWithAlteredSelectionArgs() throws Exception {
    /**
     * Test the ability of a subclass of SQLiteCursor to change its query arguments.
     */
    populateDefaultTable();

    SQLiteDatabase.CursorFactory factory = new SQLiteDatabase.CursorFactory() {
        public Cursor newCursor(
                SQLiteDatabase db, SQLiteCursorDriver masterQuery, String editTable,
                SQLiteQuery query) {
            return new SQLiteCursor(db, masterQuery, editTable, query) {
                @Override
                public boolean requery() {
                    setSelectionArguments(new String[]{"2"});
                    return super.requery();
                }
            };
        }
    };
    Cursor c = mDatabase.rawQueryWithFactory(
            factory, "SELECT data FROM test WHERE _id <= ?", new String[]{"1"},
            null);
    assertNotNull(c);
    assertEquals(1, c.getCount());
    assertTrue(c.moveToFirst());
    assertEquals(sString1, c.getString(0));

    // Our hacked requery() changes the query arguments in the cursor.
    c.requery();

    assertEquals(2, c.getCount());
    assertTrue(c.moveToFirst());
    assertEquals(sString1, c.getString(0));
    assertTrue(c.moveToNext());
    assertEquals(sString2, c.getString(0));

    // Test that setting query args on a deactivated cursor also works.
    c.deactivate();
    c.requery();
}
项目:squidb    文件:SquidCursorFactory.java   
@Override
public Cursor newCursor(SQLiteDatabase db, SQLiteCursorDriver masterQuery, String editTable, SQLiteQuery query) {
    bindArgumentsToProgram(query, sqlArgs);
    return new SQLiteCursor(masterQuery, editTable, query);
}
项目:Viz    文件:VizDatabase.java   
private DownloadsCursor(SQLiteDatabase db, SQLiteCursorDriver driver,
        String editTable, SQLiteQuery query) {
    super(db, driver, editTable, query);
}
项目:Viz    文件:VizDatabase.java   
@Override
public Cursor newCursor(SQLiteDatabase db,
        SQLiteCursorDriver driver, String editTable,
        SQLiteQuery query) {
    return new DownloadsCursor(db, driver, editTable, query);
}
项目:Viz    文件:VizDatabase.java   
private FavoritesCursor(SQLiteDatabase db, SQLiteCursorDriver driver,
        String editTable, SQLiteQuery query) {
    super(db, driver, editTable, query);
}
项目:Viz    文件:VizDatabase.java   
@Override
public Cursor newCursor(SQLiteDatabase db,
        SQLiteCursorDriver driver, String editTable,
        SQLiteQuery query) {
    return new FavoritesCursor(db, driver, editTable, query);
}
项目:Viz    文件:VizDatabase.java   
private DirectoriesCursor(SQLiteDatabase db, SQLiteCursorDriver driver,
        String editTable, SQLiteQuery query) {
    super(db, driver, editTable, query);
}
项目:Viz    文件:VizDatabase.java   
private DirectoriesCursor(SQLiteCursorDriver driver, String editTable, SQLiteQuery query) {
    super(driver, editTable, query);
}
项目:Viz    文件:VizDatabase.java   
@Override
public Cursor newCursor(SQLiteDatabase db,
        SQLiteCursorDriver driver, String editTable,
        SQLiteQuery query) {
    return new DirectoriesCursor(db, driver, editTable, query);
}
项目:commcare-android    文件:DecryptingCursor.java   
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();
}
项目:EffectiveAndroid    文件:PermissionCheckActivity.java   
public Cursor newCursor(SQLiteDatabase db, SQLiteCursorDriver driver,
        String editTable, SQLiteQuery query) {
    return new SQLiteCursor(db, driver, editTable, query);
}
项目:EffectiveAndroid    文件:PermissionCheckActivity.java   
public Cursor newCursor(SQLiteDatabase db, SQLiteCursorDriver driver,
        String editTable, SQLiteQuery query) {
    return new SQLiteCursor(db, driver, editTable, query);
}
项目:S1314V-LI61N    文件:SQLiteTestCase.java   
@Override
public Cursor newCursor(SQLiteDatabase db, SQLiteCursorDriver driver,
        String editTable, SQLiteQuery query) {
    d("newCursor");
    return new TestCursor(db, driver, editTable, query);        
}
项目:S1314V-LI61N    文件:SQLiteTestCase.java   
public TestCursor(SQLiteDatabase db, SQLiteCursorDriver driver,
        String editTable, SQLiteQuery query) {
    super(driver, editTable, query);
    _db = db;       
}
项目:android-schema-utils    文件:SQLiteMaster.java   
@SuppressWarnings("deprecation")
@Override
public Cursor newCursor(SQLiteDatabase db, SQLiteCursorDriver masterQuery, String editTable, SQLiteQuery query) {
  return new SQLiteCursor(db, masterQuery, editTable, query);
}
项目:cerberus    文件:DefaultCursorFactory.java   
@SuppressWarnings("deprecation")
@Override
public Cursor newCursor(SQLiteDatabase db, SQLiteCursorDriver masterQuery, String editTable, SQLiteQuery query) {
  return new SQLiteCursor(db, masterQuery, editTable, query);
}
项目:sqlitemaster    文件:SQLiteMaster.java   
@SuppressWarnings("deprecation")
@Override
public Cursor newCursor(SQLiteDatabase db, SQLiteCursorDriver masterQuery, String editTable, SQLiteQuery query) {
  return new SQLiteCursor(db, masterQuery, editTable, query);
}