本文整理汇总了Java中net.sqlcipher.database.SQLiteQueryBuilder类的典型用法代码示例。如果您正苦于以下问题:Java SQLiteQueryBuilder类的具体用法?Java SQLiteQueryBuilder怎么用?Java SQLiteQueryBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SQLiteQueryBuilder类属于net.sqlcipher.database包,在下文中一共展示了SQLiteQueryBuilder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:zom,项目名称:Zom-Android,代码行数:24,代码来源:ImpsProvider.java
示例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);
}
开发者ID:SilentCircle,项目名称:silent-contacts-android,代码行数:26,代码来源:ScContactsProvider.java
示例3: buildFallbackPhoneLookupAndContactQuery
import net.sqlcipher.database.SQLiteQueryBuilder; //导入依赖的package包/类
/**
* Phone lookup method that uses the custom SQLite function phone_number_compare_loose
* that serves as a fallback in case the regular lookup does not return any results.
* @param qb The query builder.
* @param number The phone number to search for.
*/
public void buildFallbackPhoneLookupAndContactQuery(SQLiteQueryBuilder qb, String number) {
final String minMatch = PhoneNumberUtils.toCallerIDMinMatch(number);
final StringBuilder sb = new StringBuilder();
//append lookup tables
sb.append(Tables.RAW_CONTACTS);
// Removed the Views.CONTACTS join - no support of aggregated Contacts
sb.append(" JOIN (SELECT " + PhoneLookupColumns.DATA_ID + "," +
PhoneLookupColumns.NORMALIZED_NUMBER + " FROM "+ Tables.PHONE_LOOKUP + " "
+ "WHERE (" + Tables.PHONE_LOOKUP + "." + PhoneLookupColumns.MIN_MATCH + " = '");
sb.append(minMatch);
sb.append("')) AS lookup " +
"ON lookup." + PhoneLookupColumns.DATA_ID + "=" + Tables.DATA + "." + Data._ID
+ " JOIN " + Tables.DATA + " "
+ "ON " + Tables.DATA + "." + Data.RAW_CONTACT_ID + "=" + Tables.RAW_CONTACTS + "."
+ RawContacts._ID);
qb.setTables(sb.toString());
sb.setLength(0);
sb.append("PHONE_NUMBERS_EQUAL(" + Tables.DATA + "." + Phone.NUMBER + ", ");
DatabaseUtils.appendEscapedSQLString(sb, number);
sb.append(mUseStrictPhoneNumberComparison ? ", 1)" : ", 0)");
qb.appendWhere(sb.toString());
}
开发者ID:SilentCircle,项目名称:silent-contacts-android,代码行数:32,代码来源:ScContactsDatabaseHelper.java
示例4: queryOne
import net.sqlcipher.database.SQLiteQueryBuilder; //导入依赖的package包/类
public Cursor queryOne(Context context, Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();
queryBuilder.setTables(getTableName());
queryBuilder.appendWhere(getIDColumnName() + "=" + uri.getLastPathSegment());
Cursor cursor = queryBuilder.query(mDB, projection, selection, selectionArgs, null, null, sortOrder);
cursor.setNotificationUri(context.getContentResolver(), uri);
return cursor;
}
开发者ID:scalio,项目名称:openarchive,代码行数:10,代码来源:Table.java
示例5: 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());
}
开发者ID:zom,项目名称:Zom-Android,代码行数:8,代码来源:ImpsProvider.java
示例6: getIDsForValues
import net.sqlcipher.database.SQLiteQueryBuilder; //导入依赖的package包/类
@Override
public Vector<Integer> getIDsForValues(String[] fieldNames, Object[] values, LinkedHashSet returnSet) {
SQLiteDatabase db = helper.getHandle();
Pair<String, String[]> whereClause = helper.createWhereAndroid(fieldNames, values, em, null);
if (STORAGE_OUTPUT_DEBUG) {
String sql = SQLiteQueryBuilder.buildQueryString(false, table, new String[]{DatabaseHelper.ID_COL}, whereClause.first, null, null, null, null);
DbUtil.explainSql(db, sql, whereClause.second);
}
Cursor c = db.query(table, new String[]{DatabaseHelper.ID_COL}, whereClause.first, whereClause.second, null, null, null);
return fillIdWindow(c, DatabaseHelper.ID_COL, returnSet);
}
开发者ID:dimagi,项目名称:commcare-android,代码行数:15,代码来源:SqlStorage.java
示例7: queryAll
import net.sqlcipher.database.SQLiteQueryBuilder; //导入依赖的package包/类
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;
}
开发者ID:scalio,项目名称:openarchive,代码行数:9,代码来源:Table.java
示例8: queryOneDistinct
import net.sqlcipher.database.SQLiteQueryBuilder; //导入依赖的package包/类
public Cursor queryOneDistinct(Context context, Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();
queryBuilder.setTables(getTableName());
queryBuilder.appendWhere(getIDColumnName() + "=" + uri.getLastPathSegment());
queryBuilder.setDistinct(true); // "true" specifies distinct results
Cursor cursor = queryBuilder.query(mDB, projection, selection, selectionArgs, null, null, sortOrder);
cursor.setNotificationUri(context.getContentResolver(), uri);
return cursor;
}
开发者ID:scalio,项目名称:openarchive,代码行数:11,代码来源:Table.java
示例9: queryAllDistinct
import net.sqlcipher.database.SQLiteQueryBuilder; //导入依赖的package包/类
public Cursor queryAllDistinct(Context context, Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();
queryBuilder.setTables(getTableName());
queryBuilder.setDistinct(true); // "true" specifies distinct results
Cursor cursor = queryBuilder.query(mDB, projection, selection, selectionArgs, null, null, sortOrder);
cursor.setNotificationUri(context.getContentResolver(), uri);
return cursor;
}
开发者ID:scalio,项目名称:openarchive,代码行数:10,代码来源:Table.java
示例10: 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;
}
开发者ID:SilentCircle,项目名称:silent-contacts-android,代码行数:16,代码来源:ScContactsProvider.java
示例11: 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);
}
开发者ID:SilentCircle,项目名称:silent-contacts-android,代码行数:8,代码来源:ScContactsProvider.java
示例12: 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);
}
开发者ID:SilentCircle,项目名称:silent-contacts-android,代码行数:14,代码来源:ScContactsProvider.java
示例13: 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);
}
开发者ID:SilentCircle,项目名称:silent-contacts-android,代码行数:32,代码来源:ScContactsProvider.java
示例14: buildPhoneLookupAndContactQuery
import net.sqlcipher.database.SQLiteQueryBuilder; //导入依赖的package包/类
public void buildPhoneLookupAndContactQuery(SQLiteQueryBuilder qb, String normalizedNumber, String numberE164) {
String minMatch = PhoneNumberUtils.toCallerIDMinMatch(normalizedNumber);
StringBuilder sb = new StringBuilder();
appendPhoneLookupTables(sb, minMatch);
qb.setTables(sb.toString());
sb = new StringBuilder();
appendPhoneLookupSelection(sb, normalizedNumber, numberE164);
qb.appendWhere(sb.toString());
}
开发者ID:SilentCircle,项目名称:silent-contacts-android,代码行数:11,代码来源:ScContactsDatabaseHelper.java
示例15: 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;
}
开发者ID:gabuzomeu,项目名称:geoPingProject,代码行数:8,代码来源:SecureDatabase.java
示例16: query_internal
import net.sqlcipher.database.SQLiteQueryBuilder; //导入依赖的package包/类
private Cursor query_internal(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder){
Timber.d("Querying URI: %s", uri);
// find object from uri
Object sourceObject = getObjectFromUri(uri);
initializeDependencies();
SQLiteDatabase database = openHelper.get().getReadableDatabase();
if (database == null) {
Timber.e("Database could not be opened");
return null;
}
Cursor cursor;
// check type of instance data set
if (Dataset.class.isInstance(sourceObject)) {
Dataset dataset = ((Dataset) sourceObject);
// logQuery(dataset, projection, selection, selectionArgs, sortOrder);
switch (dataset.getType()) {
case QUERY:
String query = prepareQuery(dataset.getSource(), projection, selection, sortOrder);
cursor = database.rawQuery(query, selectionArgs);
break;
case SQL:
cursor = database.rawQuery(selection, selectionArgs);
break;
case TABLE:
case VIEW:
SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();
queryBuilder.setTables(dataset.getSource());
cursor = queryBuilder.query(database, projection, selection, selectionArgs, null, null, sortOrder);
break;
default:
throw new IllegalArgumentException("Type of dataset not defined");
}
} else {
throw new IllegalArgumentException("Object sourceObject of mapContent is not instance of dataset");
}
// notify listeners waiting for the data is ready
cursor.setNotificationUri(getContext().getContentResolver(), uri);
if (!cursor.isClosed()) {
Timber.d("Rows returned: %d", cursor.getCount());
}
return cursor;
}
开发者ID:moneymanagerex,项目名称:android-money-manager-ex,代码行数:53,代码来源:MmxContentProvider.java
示例17: query
import net.sqlcipher.database.SQLiteQueryBuilder; //导入依赖的package包/类
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder)
{
// Using SQLiteQueryBuilder instead of query() method
SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();
int uriType = sURIMatcher.match(uri);
// Check if the caller has requested a column which does not exists
checkColumns(projection, uriType);
switch (uriType)
{
case ADDRESS_ID:
// Adding the ID to the original query
queryBuilder.appendWhere(AddressesTable.COLUMN_ID + "=" + uri.getLastPathSegment());
case ADDRESSES:
queryBuilder.setTables(AddressesTable.TABLE_ADDRESSES);
break;
case ADDRESS_BOOK_RECORD_ID:
// Adding the ID to the original query
queryBuilder.appendWhere(AddressBookRecordsTable.COLUMN_ID + "=" + uri.getLastPathSegment());
case ADDRESS_BOOK_RECORDS:
queryBuilder.setTables(AddressBookRecordsTable.TABLE_ADDRESS_BOOK_RECORDS);
break;
case MESSAGE_ID:
// Adding the ID to the original query
queryBuilder.appendWhere(MessagesTable.COLUMN_ID + "=" + uri.getLastPathSegment());
case MESSAGES:
queryBuilder.setTables(MessagesTable.TABLE_MESSAGES);
break;
case QUEUE_RECORD_ID:
// Adding the ID to the original query
queryBuilder.appendWhere(QueueRecordsTable.COLUMN_ID + "=" + uri.getLastPathSegment());
case QUEUE_RECORDS:
queryBuilder.setTables(QueueRecordsTable.TABLE_QUEUE_RECORDS);
break;
case PAYLOAD_ID:
// Adding the ID to the original query
queryBuilder.appendWhere(PayloadsTable.COLUMN_ID + "=" + uri.getLastPathSegment());
case PAYLOADS:
queryBuilder.setTables(PayloadsTable.TABLE_PAYLOADS);
break;
case PUBKEY_ID:
// Adding the ID to the original query
queryBuilder.appendWhere(PubkeysTable.COLUMN_ID + "=" + uri.getLastPathSegment());
case PUBKEYS:
queryBuilder.setTables(PubkeysTable.TABLE_PUBKEYS);
break;
case SERVER_RECORD_ID:
// Adding the ID to the original query
queryBuilder.appendWhere(ServerRecordsTable.COLUMN_ID + "=" + uri.getLastPathSegment());
case SERVER_RECORDS:
queryBuilder.setTables(ServerRecordsTable.TABLE_SERVER_RECORDS);
break;
default:
throw new IllegalArgumentException("Unknown URI: " + uri + " Exception occurred in DatabaseContentProvider.query()");
}
Cursor cursor = queryBuilder.query(sDatabase, projection, selection, selectionArgs, null, null, sortOrder);
// make sure that potential listeners are getting notified
cursor.setNotificationUri(sContext.getContentResolver(), uri);
return cursor;
}
开发者ID:JonathanCoe,项目名称:bitseal,代码行数:72,代码来源:DatabaseContentProvider.java
示例18: bundleFastScrollingIndexExtras
import net.sqlcipher.database.SQLiteQueryBuilder; //导入依赖的package包/类
/**
* Add the "fast scrolling index" bundle, generated by {@link #getFastScrollingIndexExtras43},
* to a cursor as extras. It first checks {@link FastScrollingIndexCache} to see if we
* already have a cached result.
*/
private void bundleFastScrollingIndexExtras(Cursor cursor, Uri queryUri, final SQLiteDatabase db, SQLiteQueryBuilder qb,
String selection, String[] selectionArgs, String sortOrder, String countExpression) {
Bundle b;
// Note even though FastScrollingIndexCache is thread-safe, we really need to put the
// put-get pair in a single synchronized block, so that even if multiple-threads request the
// same index at the same time (which actually happens on the phone app) we only execute
// the query once.
//
// This doesn't cause deadlock, because only reader threads get here but not writer
// threads. (Writer threads may call invalidateFastScrollingIndexCache(), but it doesn't
// synchronize on mFastScrollingIndexCache)
//
// All reader and writer threads share the single lock object internally in
// FastScrollingIndexCache, but the lock scope is limited within each put(), get() and
// invalidate() call, so it won't deadlock.
// Synchronizing on a non-static field is generally not a good idea, but nobody should
// modify mFastScrollingIndexCache once initialized, and it shouldn't be null at this point.
synchronized (mFastScrollingIndexCache) {
// First, try the cache.
mFastScrollingIndexCacheRequestCount++;
b = mFastScrollingIndexCache.get(queryUri, selection, selectionArgs, sortOrder, countExpression);
if (b == null) {
mFastScrollingIndexCacheMissCount++;
// Not in the cache. Generate and put.
final long start = System.currentTimeMillis();
b = getFastScrollingIndexExtras43(queryUri, db, qb, selection, selectionArgs, sortOrder, countExpression);
final long end = System.currentTimeMillis();
final int time = (int) (end - start);
mTotalTimeFastScrollingIndexGenerate += time;
if (VERBOSE_DEBUG) {
Log.v(TAG, "getLetterCountExtraBundle took " + time + "ms");
}
mFastScrollingIndexCache.put(queryUri, selection, selectionArgs, sortOrder, countExpression, b);
}
}
if (!(cursor instanceof AbstractCursor)) {
dirtyTrickBundle = b;
return;
}
// setExtras() is hidden in AbstractCursor, do a lookup, make it accessible and use it
Class<?> c = ((Object)cursor).getClass(); // overcome some issues in AS (IntelliJ)
try {
java.lang.reflect.Method m = c.getMethod("setExtras", Bundle.class);
m.setAccessible(true);
m.invoke(cursor, b);
} catch (Exception e) {
Log.i(TAG, "AbstractCursor setExtra - bundleFastScrollingIndexExtras: " + e);
}
}
开发者ID:SilentCircle,项目名称:silent-contacts-android,代码行数:60,代码来源:ScContactsProvider.java
示例19: 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();
}
}
开发者ID:SilentCircle,项目名称:silent-contacts-android,代码行数:82,代码来源:ScContactsProvider.java
示例20: 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);
}
开发者ID:SilentCircle,项目名称:silent-contacts-android,代码行数:6,代码来源:ScContactsProvider.java
注:本文中的net.sqlcipher.database.SQLiteQueryBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论