Search in sources :

Example 61 with SQLiteQueryBuilder

use of android.database.sqlite.SQLiteQueryBuilder in project cw-advandroid by commonsguy.

the class Provider method query.

@Override
public Cursor query(Uri url, String[] projection, String selection, String[] selectionArgs, String sort) {
    SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
    qb.setTables(TABLE);
    String orderBy;
    if (TextUtils.isEmpty(sort)) {
        orderBy = Constants.DEFAULT_SORT_ORDER;
    } else {
        orderBy = sort;
    }
    Cursor c = qb.query(db.getReadableDatabase(), projection, selection, selectionArgs, null, null, orderBy);
    c.setNotificationUri(getContext().getContentResolver(), url);
    return (c);
}
Also used : Cursor(android.database.Cursor) SQLiteQueryBuilder(android.database.sqlite.SQLiteQueryBuilder)

Example 62 with SQLiteQueryBuilder

use of android.database.sqlite.SQLiteQueryBuilder in project cw-omnibus by commonsguy.

the class Provider method query.

@Override
public Cursor query(Uri url, String[] projection, String selection, String[] selectionArgs, String sort) {
    SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
    qb.setTables(TABLE);
    String orderBy;
    if (TextUtils.isEmpty(sort)) {
        orderBy = Constants.DEFAULT_SORT_ORDER;
    } else {
        orderBy = sort;
    }
    Cursor c = qb.query(db.getReadableDatabase(), projection, selection, selectionArgs, null, null, orderBy);
    c.setNotificationUri(getContext().getContentResolver(), url);
    return (c);
}
Also used : Cursor(android.database.Cursor) SQLiteQueryBuilder(android.database.sqlite.SQLiteQueryBuilder)

Example 63 with SQLiteQueryBuilder

use of android.database.sqlite.SQLiteQueryBuilder in project ADWLauncher2 by boombuler.

the class LauncherProvider method query.

@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
    SqlArguments args = new SqlArguments(uri, selection, selectionArgs);
    SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
    qb.setTables(args.table);
    SQLiteDatabase db = mOpenHelper.getWritableDatabase();
    Cursor result = qb.query(db, projection, args.where, args.args, null, null, sortOrder);
    result.setNotificationUri(getContext().getContentResolver(), uri);
    return result;
}
Also used : SQLiteDatabase(android.database.sqlite.SQLiteDatabase) Cursor(android.database.Cursor) SQLiteQueryBuilder(android.database.sqlite.SQLiteQueryBuilder)

Example 64 with SQLiteQueryBuilder

use of android.database.sqlite.SQLiteQueryBuilder in project Brion-Learns-OAuth by brione.

the class BloaProvider method query.

@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
    SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
    SQLiteDatabase db = mOpenHelper.getReadableDatabase();
    Cursor c = null;
    switch(sUriMatcher.match(uri)) {
        case USER_STATUS_RECORDS:
            qb.setTables(USER_STATUS_RECORDS_TABLE_NAME);
            qb.setProjectionMap(sUserStatusProjectionMap);
            c = qb.query(db, projection, selection, selectionArgs, null, null, sortOrder);
            break;
        case USER_STATUS_RECORD_ID:
            qb.setTables(USER_STATUS_RECORDS_TABLE_NAME);
            qb.setProjectionMap(sUserStatusProjectionMap);
            qb.appendWhere(UserStatusRecords.UserStatusRecord._ID + "=" + uri.getPathSegments().get(1));
            c = qb.query(db, projection, selection, selectionArgs, null, null, sortOrder);
            break;
        default:
            throw new IllegalArgumentException("Unknown URI " + uri);
    }
    // Tell the cursor what uri to watch, so it knows when its source data
    // changes
    c.setNotificationUri(mCR, uri);
    return c;
}
Also used : SQLiteDatabase(android.database.sqlite.SQLiteDatabase) Cursor(android.database.Cursor) SQLiteQueryBuilder(android.database.sqlite.SQLiteQueryBuilder)

Example 65 with SQLiteQueryBuilder

use of android.database.sqlite.SQLiteQueryBuilder in project Launcher3 by chislon.

the class LauncherProvider method query.

@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
    SqlArguments args = new SqlArguments(uri, selection, selectionArgs);
    SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
    qb.setTables(args.table);
    SQLiteDatabase db = mOpenHelper.getWritableDatabase();
    Cursor result = qb.query(db, projection, args.where, args.args, null, null, sortOrder);
    result.setNotificationUri(getContext().getContentResolver(), uri);
    return result;
}
Also used : SQLiteDatabase(android.database.sqlite.SQLiteDatabase) Cursor(android.database.Cursor) SQLiteQueryBuilder(android.database.sqlite.SQLiteQueryBuilder)

Aggregations

SQLiteQueryBuilder (android.database.sqlite.SQLiteQueryBuilder)106 Cursor (android.database.Cursor)93 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)44 ContentValues (android.content.ContentValues)8 Account (android.accounts.Account)7 SQLiteException (android.database.sqlite.SQLiteException)7 File (java.io.File)7 HashMap (java.util.HashMap)7 SyncStatusInfo (android.content.SyncStatusInfo)6 MatrixCursor (android.database.MatrixCursor)5 RowBuilder (android.database.MatrixCursor.RowBuilder)5 ContentResolver (android.content.ContentResolver)4 Test (org.junit.Test)2 Matchers.anyLong (org.mockito.Matchers.anyLong)2 Returns (org.mockito.internal.stubbing.answers.Returns)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2 AbstractCursor (android.database.AbstractCursor)1 MergeCursor (android.database.MergeCursor)1 AtomicFile (android.util.AtomicFile)1 AtomicFile (com.android.internal.os.AtomicFile)1