本文整理汇总了Java中net.sqlcipher.database.SQLiteQueryBuilder.setTables方法的典型用法代码示例。如果您正苦于以下问题:Java SQLiteQueryBuilder.setTables方法的具体用法?Java SQLiteQueryBuilder.setTables怎么用?Java SQLiteQueryBuilder.setTables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sqlcipher.database.SQLiteQueryBuilder
的用法示例。
在下文中一共展示了SQLiteQueryBuilder.setTables方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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());
}
示例4: 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());
}
示例5: 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;
}
示例6: 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;
}
示例7: 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;
}
示例8: 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;
}
示例9: 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);
}
示例10: 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);
}
示例11: 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);
}
示例12: 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());
}
示例13: 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;
}
示例14: 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;
}
示例15: 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;
}