Java Code Examples for net.sqlcipher.database.SQLiteQueryBuilder#setProjectionMap()

The following examples show how to use net.sqlcipher.database.SQLiteQueryBuilder#setProjectionMap() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImpsProvider.java    From Zom-Android-XMPP with GNU General Public License v3.0 6 votes vote down vote up
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;
}
 
Example 2
Source File: ImpsProvider.java    From Zom-Android-XMPP with GNU General Public License v3.0 5 votes vote down vote up
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());
}