Java Code Examples for com.squareup.sqlbrite.BriteDatabase#Transaction
The following examples show how to use
com.squareup.sqlbrite.BriteDatabase#Transaction .
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: SessionsDao.java From droidconat-2016 with Apache License 2.0 | 6 votes |
public void toggleSelectedSessionState(com.nilhcem.droidconat.data.app.model.Session session, boolean insert) { Preconditions.checkNotOnMainThread(); String slotTime = adapter.toText(session.getFromTime()); BriteDatabase.Transaction transaction = database.newTransaction(); try { database.delete(SelectedSession.TABLE, SelectedSession.SLOT_TIME + "=?", slotTime); if (insert) { database.insert(SelectedSession.TABLE, new SelectedSession.Builder().slotTime(slotTime).sessionId(session.getId()).build()); } selectedSessionsMemory.toggleSessionState(session, insert); transaction.markSuccessful(); } finally { transaction.end(); } }
Example 2
Source File: DatabaseHelper.java From StatusSaver-for-Whatsapp with Apache License 2.0 | 5 votes |
public void additem(SampleModel item) { BriteDatabase.Transaction transaction = mDb.newTransaction(); try { long result = mDb.insert(Db.TheSampleTable.TABLE_NAME, Db.TheSampleTable.toContentValues(item)); if (result <0) Log.e(TAG, "addItem: Error inserting to table " + Db.TheSampleTable.TABLE_NAME); transaction.markSuccessful(); } finally { transaction.end(); } }
Example 3
Source File: SpeakersDao.java From droidconat-2016 with Apache License 2.0 | 5 votes |
public void saveSpeakers(List<com.nilhcem.droidconat.data.app.model.Speaker> toSave) { Preconditions.checkNotOnMainThread(); BriteDatabase.Transaction transaction = database.newTransaction(); try { database.delete(Speaker.TABLE, null); for (com.nilhcem.droidconat.data.app.model.Speaker speaker : toSave) { database.insert(Speaker.TABLE, Speaker.createContentValues(dbMapper.fromAppSpeaker(speaker))); } transaction.markSuccessful(); } finally { transaction.end(); } }
Example 4
Source File: SessionsDao.java From droidconat-2016 with Apache License 2.0 | 5 votes |
public void saveSessions(List<com.nilhcem.droidconat.data.app.model.Session> toSave) { Preconditions.checkNotOnMainThread(); BriteDatabase.Transaction transaction = database.newTransaction(); try { database.delete(Session.TABLE, null); for (com.nilhcem.droidconat.data.app.model.Session session : toSave) { database.insert(Session.TABLE, Session.createContentValues(dbMapper.fromAppSession(session))); } transaction.markSuccessful(); } finally { transaction.end(); } }
Example 5
Source File: ElifutDataStore.java From android with Apache License 2.0 | 5 votes |
public void create(List<? extends Persistable> persistables) { BriteDatabase.Transaction transaction = db.newTransaction(); try { for (Persistable persistable : persistables) { create(persistable); } transaction.markSuccessful(); } finally { transaction.end(); } }