本文整理汇总了Java中net.sqlcipher.database.SQLiteQueryBuilder.appendWhere方法的典型用法代码示例。如果您正苦于以下问题:Java SQLiteQueryBuilder.appendWhere方法的具体用法?Java SQLiteQueryBuilder.appendWhere怎么用?Java SQLiteQueryBuilder.appendWhere使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sqlcipher.database.SQLiteQueryBuilder
的用法示例。
在下文中一共展示了SQLiteQueryBuilder.appendWhere方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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());
}
示例2: 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;
}
示例3: 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;
}
示例4: 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());
}
示例5: 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;
}
示例6: appendAccountIdFromParameter
import net.sqlcipher.database.SQLiteQueryBuilder; //导入方法依赖的package包/类
private void appendAccountIdFromParameter(SQLiteQueryBuilder qb, Uri uri) {
qb.appendWhere("1");
}
示例7: 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;
}