aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-01-13 10:56:29 +0100
committerDaniel Gultsch <daniel@gultsch.de>2016-01-13 10:56:29 +0100
commit5f63c397fa7e6790e4a94bd3ae193af23946c7c9 (patch)
treed869a1796258af6727b44ece4750aaba23690f64 /src/main
parent3e9fd0185a792b349ce2f8b9e8b6a5967c16fee0 (diff)
parentffb49c72177d71f1efaff944a52ca43a1fb63428 (diff)
Merge pull request #1649 from dhiru1602/master
use batch transactions when writing roster
Diffstat (limited to '')
-rw-r--r--src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java
index 3077c488..c73a0564 100644
--- a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java
+++ b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java
@@ -577,6 +577,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
public void writeRoster(final Roster roster) {
final Account account = roster.getAccount();
final SQLiteDatabase db = this.getWritableDatabase();
+ db.beginTransaction();
for (Contact contact : roster.getContacts()) {
if (contact.getOption(Contact.Options.IN_ROSTER)) {
db.insert(Contact.TABLENAME, null, contact.getContentValues());
@@ -586,6 +587,8 @@ public class DatabaseBackend extends SQLiteOpenHelper {
db.delete(Contact.TABLENAME, where, whereArgs);
}
}
+ db.setTransactionSuccessful();
+ db.endTransaction();
account.setRosterVersion(roster.getVersion());
updateAccount(account);
}