From 9244cf0f5edae3491bd5d117f065f8a3d2831e72 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Sun, 16 Dec 2018 17:16:37 +0000 Subject: [PATCH] open SQLite db with write-ahead logging enabled this allows writers not to block readers --- app/src/main/java/net/ktnx/mobileledger/utils/MLDB.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/net/ktnx/mobileledger/utils/MLDB.java b/app/src/main/java/net/ktnx/mobileledger/utils/MLDB.java index 5fd4e0e6..9d8950a6 100644 --- a/app/src/main/java/net/ktnx/mobileledger/utils/MLDB.java +++ b/app/src/main/java/net/ktnx/mobileledger/utils/MLDB.java @@ -35,7 +35,8 @@ import static net.ktnx.mobileledger.utils.MLDB.DatabaseMode.READ; import static net.ktnx.mobileledger.utils.MLDB.DatabaseMode.WRITE; public final class MLDB { - public enum DatabaseMode { READ, WRITE }; + public enum DatabaseMode {READ, WRITE} + public static final String ACCOUNTS_TABLE = "accounts"; public static final String DESCRIPTION_HISTORY_TABLE = "description_history"; private static MobileLedgerDatabase helperForReading, helperForWriting; @@ -124,6 +125,7 @@ class MobileLedgerDatabase extends SQLiteOpenHelper implements AutoCloseable { super(context, DB_NAME, null, LATEST_REVISION); Log.d("db", "creating helper instance"); mContext = context; + super.setWriteAheadLoggingEnabled(true); } @Override -- 2.39.5