-
Notifications
You must be signed in to change notification settings - Fork 545
Closed
Description
SQLDelight Version
1.5.5
Application Operating System
JVM
Describe the Bug
Using the file-based JdbcSqliteDriver
, which uses ThreadedConnectionManager
internally, has inconsistent connection handling for queries in and outside of transactions. Outside of a transaction, queries always close the connection. However, queries in a transaction will leave the connection open post-transaction. Additionally, these open connections are not closed when the db is close()
'd either; which is a problem on Windows because no file level operations can occur if the file is "open".
Code example:
val file = File(realPath)
val database = SQLDelightDatabase(driver = JdbcSqliteDriver("jdbc:sqlite:$realPath"), ...)
database.transaction { } // Leaves a connection open
database.close() // Does nothing, the connection is still open
file.delete() // This will fail to delete the file on Windows because of the open connection
database.queries.getData().executeAsOneOrNull() // Closes the connection
file.delete() // Will now succeed
Stacktrace
No stacktrace.
morki, MathiasDL and sphrak