From 9fe6be3604067ae1a1bd8b9c576b014023bff6ec Mon Sep 17 00:00:00 2001 From: Igor Bubelov Date: Mon, 23 Sep 2024 20:45:12 +0700 Subject: [PATCH] Add full mutex flag --- app/src/androidMain/kotlin/db/Database.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/androidMain/kotlin/db/Database.kt b/app/src/androidMain/kotlin/db/Database.kt index 27ce85af..06e8d140 100644 --- a/app/src/androidMain/kotlin/db/Database.kt +++ b/app/src/androidMain/kotlin/db/Database.kt @@ -2,6 +2,9 @@ package db import androidx.sqlite.SQLiteConnection import androidx.sqlite.driver.bundled.BundledSQLiteDriver +import androidx.sqlite.driver.bundled.SQLITE_OPEN_CREATE +import androidx.sqlite.driver.bundled.SQLITE_OPEN_FULLMUTEX +import androidx.sqlite.driver.bundled.SQLITE_OPEN_READWRITE import androidx.sqlite.execSQL import androidx.sqlite.use import area.AreaQueries @@ -17,7 +20,10 @@ import java.util.concurrent.locks.ReentrantLock class Database(path: String) { private val conn: SQLiteConnection = - BundledSQLiteDriver().open(path) + BundledSQLiteDriver().open( + path, + SQLITE_OPEN_READWRITE or SQLITE_OPEN_CREATE or SQLITE_OPEN_FULLMUTEX + ) .apply { execSQL("PRAGMA journal_mode=WAL") execSQL("PRAGMA synchronous=NORMAL")