use of net.sqlcipher.database.SQLiteDatabase in project Signal-Android by signalapp.
the class GroupDatabase method setActive.
public void setActive(String groupId, boolean active) {
SQLiteDatabase database = databaseHelper.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(ACTIVE, active ? 1 : 0);
database.update(TABLE_NAME, values, GROUP_ID + " = ?", new String[] { groupId });
}
use of net.sqlcipher.database.SQLiteDatabase in project Signal-Android by signalapp.
the class GroupReceiptDatabase method update.
public void update(Address address, long mmsId, int status, long timestamp) {
SQLiteDatabase db = databaseHelper.getWritableDatabase();
ContentValues values = new ContentValues(2);
values.put(STATUS, status);
values.put(TIMESTAMP, timestamp);
db.update(TABLE_NAME, values, MMS_ID + " = ? AND " + ADDRESS + " = ? AND " + STATUS + " < ?", new String[] { String.valueOf(mmsId), address.serialize(), String.valueOf(status) });
}
use of net.sqlcipher.database.SQLiteDatabase in project Signal-Android by signalapp.
the class IdentityDatabase method setApproval.
public void setApproval(Address address, boolean nonBlockingApproval) {
SQLiteDatabase database = databaseHelper.getWritableDatabase();
ContentValues contentValues = new ContentValues(2);
contentValues.put(NONBLOCKING_APPROVAL, nonBlockingApproval);
database.update(TABLE_NAME, contentValues, ADDRESS + " = ?", new String[] { address.serialize() });
}
use of net.sqlcipher.database.SQLiteDatabase in project Signal-Android by signalapp.
the class IdentityDatabase method getIdentity.
public Optional<IdentityRecord> getIdentity(Address address) {
SQLiteDatabase database = databaseHelper.getReadableDatabase();
Cursor cursor = null;
try {
cursor = database.query(TABLE_NAME, null, ADDRESS + " = ?", new String[] { address.serialize() }, null, null, null);
if (cursor != null && cursor.moveToFirst()) {
return Optional.of(getIdentityRecord(cursor));
}
} catch (InvalidKeyException | IOException e) {
throw new AssertionError(e);
} finally {
if (cursor != null)
cursor.close();
}
return Optional.absent();
}
use of net.sqlcipher.database.SQLiteDatabase in project Signal-Android by signalapp.
the class MediaDatabase method getDocumentMediaForThread.
public Cursor getDocumentMediaForThread(long threadId) {
SQLiteDatabase database = databaseHelper.getReadableDatabase();
Cursor cursor = database.rawQuery(DOCUMENT_MEDIA_QUERY, new String[] { threadId + "" });
setNotifyConverationListeners(cursor, threadId);
return cursor;
}
Aggregations