https://kotlinlang.org logo
#squarelibraries
Title
# squarelibraries
s

s3rius

11/19/2023, 5:24 PM
Hey there, a question about SQLDelight: I'm using the in-memory JdbcSqliteDriver in a jvmTest and I'm greeted with a
SQLiteException: [SQLITE_ERROR] SQL error or missing database (cannot start a transaction within a transaction)
. This probably happens because the tested object ends up creating two non-related coroutines which both call
db.transaction { ... }
. And particularly in the test environment there's a good chance they run at exactly the same time. So if someone could help me out with these questions it'd be great: • Does this only happen with the InMemory JdbcSqliteDriver driver, or potentially also with the regular JdbcSqliteDriver and Android drivers? • What are my options to handle this scenario? The easiest I can think of is a single-threaded Dispatcher that I use for all database transactions.
3 Views