use of android.database.sqlite.SQLiteQueryBuilder in project storymaker by StoryMaker.
the class Table method queryAll.
public Cursor queryAll(Context context, Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();
queryBuilder.setTables(getTableName());
Cursor cursor = queryBuilder.query(mDB, projection, selection, selectionArgs, null, null, sortOrder);
cursor.setNotificationUri(context.getContentResolver(), uri);
return cursor;
}
use of android.database.sqlite.SQLiteQueryBuilder in project storymaker by StoryMaker.
the class Table method queryAllDistinct.
public Cursor queryAllDistinct(Context context, Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();
queryBuilder.setTables(getTableName());
// "true" specifies distinct results
queryBuilder.setDistinct(true);
Cursor cursor = queryBuilder.query(mDB, projection, selection, selectionArgs, null, null, sortOrder);
cursor.setNotificationUri(context.getContentResolver(), uri);
return cursor;
}
use of android.database.sqlite.SQLiteQueryBuilder in project SunDay by iQuick.
the class DataProvider method query.
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
synchronized (DBLock) {
SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();
String table = matchTable(uri);
queryBuilder.setTables(table);
SQLiteDatabase db = getDBHelper().getReadableDatabase();
// Cursor cursor = query(uri, projection, selection, selectionArgs, sortOrder);
Cursor cursor = queryBuilder.query(db, projection, selection, selectionArgs, null, null, sortOrder);
cursor.setNotificationUri(getContext().getContentResolver(), uri);
return cursor;
}
}
use of android.database.sqlite.SQLiteQueryBuilder in project android_packages_apps_Launcher2 by CyanogenMod.
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;
}
use of android.database.sqlite.SQLiteQueryBuilder in project android_frameworks_base by DirtyUnicorns.
the class LocalProvider method query.
@Override
public Cursor query(Uri url, String[] projectionIn, String selection, String[] selectionArgs, String sort) {
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
// Generate the body of the query
int match = sURLMatcher.match(url);
switch(match) {
case DATA:
qb.setTables("data");
break;
case DATA_ID:
qb.setTables("data");
qb.appendWhere("_id=");
qb.appendWhere(url.getPathSegments().get(1));
break;
default:
throw new IllegalArgumentException("Unknown URL " + url);
}
SQLiteDatabase db = mOpenHelper.getReadableDatabase();
Cursor ret = qb.query(db, projectionIn, selection, selectionArgs, null, null, sort);
if (ret == null) {
if (false)
Log.d(TAG, "Alarms.query: failed");
} else {
ret.setNotificationUri(getContext().getContentResolver(), url);
}
return ret;
}
Aggregations