本文整理汇总了Java中net.sqlcipher.database.SQLiteQueryBuilder.setProjectionMap方法的典型用法代码示例。如果您正苦于以下问题:Java SQLiteQueryBuilder.setProjectionMap方法的具体用法?Java SQLiteQueryBuilder.setProjectionMap怎么用?Java SQLiteQueryBuilder.setProjectionMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sqlcipher.database.SQLiteQueryBuilder
的用法示例。
在下文中一共展示了SQLiteQueryBuilder.setProjectionMap方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getContactId
import net.sqlcipher.database.SQLiteQueryBuilder; //导入方法依赖的package包/类
private long getContactId(final SQLiteDatabase db, final String accountId, final String contact) {
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
qb.setTables(TABLE_CONTACTS);
qb.setProjectionMap(sContactsProjectionMap);
mQueryContactIdSelectionArgs2[0] = accountId;
mQueryContactIdSelectionArgs2[1] = contact;
Cursor c = qb.query(db, CONTACT_ID_PROJECTION, CONTACT_ID_QUERY_SELECTION,
mQueryContactIdSelectionArgs2, null, null, null, null);
long contactId = 0;
try {
if (c.moveToFirst()) {
contactId = c.getLong(CONTACT_ID_COLUMN);
}
} finally {
c.close();
}
return contactId;
}
示例2: setTablesAndProjectionMapForContactsWithSnippet
import net.sqlcipher.database.SQLiteQueryBuilder; //导入方法依赖的package包/类
/**
* Finds name lookup records matching the supplied filter, picks one arbitrary match per
* contact and joins that with other contacts tables.
*/
private void setTablesAndProjectionMapForContactsWithSnippet(SQLiteQueryBuilder qb, Uri uri,
String[] projection, String filter, long directoryId, boolean deferSnippeting) {
StringBuilder sb = new StringBuilder();
sb.append(Views.RAW_CONTACTS);
if (filter != null) {
filter = filter.trim();
}
Log.d(TAG, "*** SNIPPET: filter: " + filter + ", defer: " + deferSnippeting);
if (TextUtils.isEmpty(filter) || (directoryId != -1 && directoryId != Directory.DEFAULT)) {
sb.append(" JOIN (SELECT NULL AS " + SearchSnippetColumns.SNIPPET + " WHERE 0)");
} else {
appendSearchIndexJoin(sb, uri, projection, filter, deferSnippeting);
}
// appendContactStatusUpdateJoin(sb, projection, ContactsColumns.LAST_STATUS_UPDATE_ID);
Log.d(TAG, "**** SNIPPET string: " + sb.toString());
qb.setTables(sb.toString());
qb.setProjectionMap(sContactsProjectionWithSnippetMap);
}
示例3: buildQueryContactsByProvider
import net.sqlcipher.database.SQLiteQueryBuilder; //导入方法依赖的package包/类
private void buildQueryContactsByProvider(SQLiteQueryBuilder qb, StringBuilder whereClause,
Uri url) {
qb.setTables(CONTACT_JOIN_PRESENCE_CHAT_AVATAR_TABLE);
qb.setProjectionMap(sContactsProjectionMap);
// we don't really need the provider id in query. account id is enough.
appendWhere(whereClause, Imps.Contacts.ACCOUNT, "=", url.getLastPathSegment());
}
示例4: query
import net.sqlcipher.database.SQLiteQueryBuilder; //导入方法依赖的package包/类
private Cursor query(final SQLiteDatabase db, SQLiteQueryBuilder qb, String[] projection,
String selection, String[] selectionArgs, String sortOrder, String groupBy,
String having, String limit /*, CancellationSignal cancellationSignal*/) {
if (projection != null && projection.length == 1
&& ScBaseColumns._COUNT.equals(projection[0])) {
qb.setProjectionMap(sCountProjectionMap);
}
final Cursor c = qb.query(db, projection, selection, selectionArgs, groupBy, having,
sortOrder, limit/*, cancellationSignal*/);
if (c != null) {
c.setNotificationUri(getContext().getContentResolver(), ScContactsContract.AUTHORITY_URI);
}
return c;
}
示例5: setTablesAndProjectionMapForRawContacts
import net.sqlcipher.database.SQLiteQueryBuilder; //导入方法依赖的package包/类
private void setTablesAndProjectionMapForRawContacts(SQLiteQueryBuilder qb, Uri uri) {
StringBuilder sb = new StringBuilder();
sb.append(Views.RAW_CONTACTS);
qb.setTables(sb.toString());
qb.setProjectionMap(sRawContactsProjectionMap);
appendAccountIdFromParameter(qb, uri);
}
示例6: setTablesAndProjectionMapForStreamItemPhotos
import net.sqlcipher.database.SQLiteQueryBuilder; //导入方法依赖的package包/类
private void setTablesAndProjectionMapForStreamItemPhotos(SQLiteQueryBuilder qb) {
qb.setTables(Tables.PHOTO_FILES
+ " JOIN " + Tables.STREAM_ITEM_PHOTOS + " ON ("
+ StreamItemPhotosColumns.CONCRETE_PHOTO_FILE_ID + "="
+ PhotoFilesColumns.CONCRETE_ID
+ ") JOIN " + Tables.STREAM_ITEMS + " ON ("
+ StreamItemPhotosColumns.CONCRETE_STREAM_ITEM_ID + "="
+ StreamItemsColumns.CONCRETE_ID + ")"
+ " JOIN " + Tables.RAW_CONTACTS + " ON ("
+ StreamItemsColumns.CONCRETE_RAW_CONTACT_ID + "=" + RawContactsColumns.CONCRETE_ID
+ ")");
qb.setProjectionMap(sStreamItemPhotosProjectionMap);
}
示例7: setTablesAndProjectionMapForData
import net.sqlcipher.database.SQLiteQueryBuilder; //导入方法依赖的package包/类
private void setTablesAndProjectionMapForData(SQLiteQueryBuilder qb, Uri uri,
String[] projection, boolean distinct, boolean addSipLookupColumns, Integer usageType) {
StringBuilder sb = new StringBuilder();
sb.append(Views.DATA);
sb.append(" data");
// appendContactPresenceJoin(sb, projection, RawContacts.CONTACT_ID);
// appendContactStatusUpdateJoin(sb, projection, ContactsColumns.LAST_STATUS_UPDATE_ID);
// appendDataPresenceJoin(sb, projection, DataColumns.CONCRETE_ID);
// appendDataStatusUpdateJoin(sb, projection, DataColumns.CONCRETE_ID);
//
// if (usageType != null) {
// appendDataUsageStatJoin(sb, usageType, DataColumns.CONCRETE_ID);
// }
//
qb.setTables(sb.toString());
boolean useDistinct = distinct || !ScContactsDatabaseHelper.isInProjection(projection, DISTINCT_DATA_PROHIBITING_COLUMNS);
qb.setDistinct(useDistinct);
final ProjectionMap projectionMap;
if (addSipLookupColumns) {
projectionMap = useDistinct ? sDistinctDataSipLookupProjectionMap : sDataSipLookupProjectionMap;
} else {
projectionMap = useDistinct ? sDistinctDataProjectionMap : sDataProjectionMap;
}
qb.setProjectionMap(projectionMap);
appendAccountIdFromParameter(qb, uri);
}
示例8: queryEntities
import net.sqlcipher.database.SQLiteQueryBuilder; //导入方法依赖的package包/类
public Cursor queryEntities(String[] projection, String selection, String[] selectionArgs, String order) {
SQLiteQueryBuilder builder = new SQLiteQueryBuilder();
builder.setTables(TABLE_KEYSTORE);
builder.setProjectionMap(mGeoTrackColumnMap);
Cursor cursor = builder.query( getReadableDatabase(), projection, selection, selectionArgs, null, null, order);
return cursor;
}
示例9: getFastScrollingIndexExtras43
import net.sqlcipher.database.SQLiteQueryBuilder; //导入方法依赖的package包/类
/**
* Computes counts by the address book index labels and returns it as {@link Bundle} which
* will be appended to a {@link Cursor} as extras.
*
* This function does not use the Android specific SQLite extension GET_PHONEBOOK_INDEX(...) anymore.
* Instead it uses some new fields of the RawContact that hold the primary and secondary labels and
* counts. Refer to the database helper class. This was copied from Jelly Bean 4.3 Contact application.
*/
private static Bundle getFastScrollingIndexExtras43(final Uri queryUri, final SQLiteDatabase db,
final SQLiteQueryBuilder qb, final String selection, final String[] selectionArgs,
final String sortOrder, String countExpression) {
String sortKey;
// The sort order suffix could be something like "DESC".
// We want to preserve it in the query even though we will change
// the sort column itself.
String sortOrderSuffix = "";
if (sortOrder != null) {
int spaceIndex = sortOrder.indexOf(' ');
if (spaceIndex != -1) {
sortKey = sortOrder.substring(0, spaceIndex);
sortOrderSuffix = sortOrder.substring(spaceIndex);
} else {
sortKey = sortOrder;
}
} else {
sortKey = RawContacts.SORT_KEY_PRIMARY;
}
String bucketKey;
String labelKey;
if (TextUtils.equals(sortKey, RawContacts.SORT_KEY_PRIMARY)) {
bucketKey = RawContactsColumns.PHONEBOOK_BUCKET_PRIMARY;
labelKey = RawContactsColumns.PHONEBOOK_LABEL_PRIMARY;
} else if (TextUtils.equals(sortKey, RawContacts.SORT_KEY_ALTERNATIVE)) {
bucketKey = RawContactsColumns.PHONEBOOK_BUCKET_ALTERNATIVE;
labelKey = RawContactsColumns.PHONEBOOK_LABEL_ALTERNATIVE;
} else {
return null;
}
HashMap<String, String> projectionMap = Maps.newHashMap();
projectionMap.put(AddressBookIndexQuery43.NAME,
sortKey + " AS " + AddressBookIndexQuery43.NAME);
projectionMap.put(AddressBookIndexQuery43.BUCKET,
bucketKey + " AS " + AddressBookIndexQuery43.BUCKET);
projectionMap.put(AddressBookIndexQuery43.LABEL,
labelKey + " AS " + AddressBookIndexQuery43.LABEL);
// If "what to count" is not specified, we just count all records.
if (TextUtils.isEmpty(countExpression)) {
countExpression = "*";
}
projectionMap.put(AddressBookIndexQuery43.COUNT,
"COUNT(" + countExpression + ") AS " + AddressBookIndexQuery43.COUNT);
qb.setProjectionMap(projectionMap);
String orderBy = AddressBookIndexQuery43.BUCKET + sortOrderSuffix
+ ", " + AddressBookIndexQuery43.NAME + " COLLATE "
+ PHONEBOOK_COLLATOR_NAME + sortOrderSuffix;
Cursor indexCursor = qb.query(db, AddressBookIndexQuery43.COLUMNS, selection, selectionArgs,
AddressBookIndexQuery43.GROUP_BY, null /* having */,
orderBy, null);
try {
int numLabels = indexCursor.getCount();
String labels[] = new String[numLabels];
int counts[] = new int[numLabels];
for (int i = 0; i < numLabels; i++) {
indexCursor.moveToNext();
labels[i] = indexCursor.getString(AddressBookIndexQuery43.COLUMN_LABEL);
counts[i] = indexCursor.getInt(AddressBookIndexQuery43.COLUMN_COUNT);
}
return FastScrollingIndexCache.buildExtraBundle(labels, counts);
} finally {
indexCursor.close();
}
}
示例10: setTablesAndProjectionMapForRawEntities
import net.sqlcipher.database.SQLiteQueryBuilder; //导入方法依赖的package包/类
private void setTablesAndProjectionMapForRawEntities(SQLiteQueryBuilder qb, Uri uri) {
qb.setTables(Views.RAW_ENTITIES);
qb.setProjectionMap(sRawEntityProjectionMap);
appendAccountIdFromParameter(qb, uri);
}
示例11: setTablesAndProjectionMapForStreamItems
import net.sqlcipher.database.SQLiteQueryBuilder; //导入方法依赖的package包/类
private void setTablesAndProjectionMapForStreamItems(SQLiteQueryBuilder qb) {
qb.setTables(Views.STREAM_ITEMS);
qb.setProjectionMap(sStreamItemsProjectionMap);
}
示例12: query
import net.sqlcipher.database.SQLiteQueryBuilder; //导入方法依赖的package包/类
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
// Don't block caller if NON_BLOCK parameter is true and if DB is not ready
if (returnOnBlocking(uri))
return null;
final SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
qb.setTables(Tables.CALLS);
qb.setProjectionMap(sCallsProjectionMap);
// qb.setStrict(true); TODO - available since API 14
final SelectionBuilder selectionBuilder = new SelectionBuilder(selection);
final int match = sURIMatcher.match(uri);
switch (match) {
case CALLS:
break;
case CALLS_ID: {
selectionBuilder.addClause(DbQueryUtils.getEqualityClause(ScCalls._ID, parseCallIdFromUri(uri)));
break;
}
case CALLS_FILTER: {
String phoneNumber = uri.getPathSegments().get(2);
qb.appendWhere("PHONE_NUMBERS_EQUAL(number, ");
qb.appendWhereEscapeString(phoneNumber);
qb.appendWhere(mUseStrictPhoneNumberComparation ? ", 1)" : ", 0)");
break;
}
default:
throw new IllegalArgumentException("Unknown URL " + uri);
}
final int limit = getIntParam(uri, ScCalls.LIMIT_PARAM_KEY, 0);
final int offset = getIntParam(uri, ScCalls.OFFSET_PARAM_KEY, 0);
String limitClause = null;
if (limit > 0) {
limitClause = offset + "," + limit;
}
final SQLiteDatabase db = mDbHelper.getDatabase(false);
final Cursor c = qb.query(db, projection, selectionBuilder.build(), selectionArgs, null, null, sortOrder, limitClause);
if (c != null) {
c.setNotificationUri(getContext().getContentResolver(), CallLog.CONTENT_URI);
}
return c;
}