From: Damyan Ivanov Date: Sun, 16 Dec 2018 17:16:37 +0000 (+0000) Subject: open SQLite db with write-ahead logging enabled X-Git-Tag: v0.3~210 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=9244cf0f5edae3491bd5d117f065f8a3d2831e72;p=mobile-ledger.git open SQLite db with write-ahead logging enabled this allows writers not to block readers --- 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