当前位置: 首页>>代码示例>>Java>>正文


Java SQLiteQueryBuilder类代码示例

本文整理汇总了Java中net.sqlcipher.database.SQLiteQueryBuilder的典型用法代码示例。如果您正苦于以下问题:Java SQLiteQueryBuilder类的具体用法?Java SQLiteQueryBuilder怎么用?Java SQLiteQueryBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SQLiteQueryBuilder类属于net.sqlcipher.database包,在下文中一共展示了SQLiteQueryBuilder类的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;
}
 
开发者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


注:本文中的net.sqlcipher.database.SQLiteQueryBuilder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。