Colton Idle
10/11/2023, 6:12 PMandroid.database.sqlite.SQLiteDatabaseLockedException: database is locked (code 5 SQLITE_BUSY): , while compiling: PRAGMA journal_mode
the stacktrace has some mentions of Sentry (the crash reporting tool) and it also points me to this block of code.
1. Does it seem like sentry could be the culprit?
at io.sentry.android.sqlite.SentrySupportSQLiteOpenHelper$sentryWritableDatabase$2.invoke(SentrySupportSQLiteOpenHelper.kt:40)
2. or is my code here somehow bad?
suspend fun itemExists(id: String): Boolean {
var result = false
withContext(myIoDispatcher) {
val foo = myQueries.selectById(id).executeAsOneOrNull()
if (foo != null) {
result = true
}
}
return result
}Colton Idle
10/11/2023, 6:38 PMsuspend fun deleteAllThenInsertAll(bufferedReader: BufferedReader) =
withContext(myIoDispatcher) {
myQueries.transaction {
myQueries.deleteAll()
// read bufferedReader line by line and insert in the transactionColton Idle
10/11/2023, 6:49 PM@Provides
fun provideDelight(@ApplicationContext context: Context): DbService {
val driver = AndroidSqliteDriver(The.Schema, context, "the.db")
return DbService(driver)
}Daniel Perez
10/12/2023, 2:08 AMColton Idle
10/12/2023, 5:12 PMPaul Woitaschek
10/13/2023, 5:11 AMMatt Nelson
10/14/2023, 8:32 AMAndroidSqliteDriver and all that android glue being used under the hood (and needing Context). sqlite-jdbc is where it's at, and loads the latest version of SQLite instead of using whatever version of SQLite is on that device.
Checkout https://github.com/toxicity-io/sqlite-mc
Can simply pass Key.Empty and not even use the encryption if you don't want to.