Code example for SQLiteQueryBuilder

Methods: appendWhere, buildQuery, query, setDistinct, setProjectionMap, setTables

0
				+ Arrays.toString(projection) + ", selection=" + selection
				+ ", selectionArgs=" + Arrays.toString(selectionArgs)
				+ ", sortOrder=" + sortOrder);
 
		SQLiteDatabase db = mDbHelper.getReadableDatabase();
		SQLiteQueryBuilder qBuilder = new SQLiteQueryBuilder();
		qBuilder.setTables(getTablesForUri(uri));
		qBuilder.setProjectionMap(getProjectionMapForUri(uri, projection));
		String where = getAddionalWhereClausesForUri(uri);
		qBuilder.setDistinct(isDistinct(uri));
		if (where != null) {
			qBuilder.appendWhere(where);
		} 
		if (sortOrder != null) {
			sortOrder = disambiguateSortOrder(uri, sortOrder);
		} 
 
		Log.d(TAG, "Doing query: "
				+ qBuilder.buildQuery(projection, selection, null, // groupBy,
						null, // having, 
						sortOrder, null));
 
		// Make the query. 
		Cursor c = qBuilder.query(db, projection, selection, selectionArgs,
				null, // groupBy, 
				null, // having, 
				sortOrder);
		Log.d(TAG, "Found " + c.getCount() + " rows");
		c.setNotificationUri(getContext().getContentResolver(), uri);