-
Notifications
You must be signed in to change notification settings - Fork 510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a SqlDriver for Androidx SQLiteDriver #5283
base: master
Are you sure you want to change the base?
Conversation
b7ca0b5
to
76bc146
Compare
Once I'm here, this line from AndroidSqliteDriver tripped me up. I can't figure out in what scenario the previous connection should be closed, because if |
drivers/kmp-driver/src/commonMain/kotlin/app/cash/sqldelight/driver/kmp/KmpSqliteSchema.kt
Outdated
Show resolved
Hide resolved
Two threads racing at the same time. |
Should've been my first guess 😅 cache4k doesn't have the same semantics as LruCache so to handle that you need to listen for an Update event, and if the values don't match each other, close the old one. |
68dff3e
to
2dda23e
Compare
Some weird stuff going on with tests that I'm working through. Also had an idea for how to make this work on native. Should I do that here, or have a follow up PR? |
14cf97a
to
131fab9
Compare
Got a native implementation in. I don't have the most experience with Native APIs, but I think this should clean up after itself since in I'm also good with removing that part for now. In any case this should be ready to go. |
5e697c2
to
b7669b4
Compare
7c89bfc
to
8d6fe34
Compare
Currently blocked by cashapp/sqldelight#5283
8d6fe34
to
d2ca1b1
Compare
d2ca1b1
to
0ea3fef
Compare
9ead49e
to
7a9cd5f
Compare
- The issue was this driver executes more than the Android one because of the PRAGMA version calls - Solution was to increment the identifier so it doesn't clash with the previous one (using a cached query for a statement and vice versa - There was also a Robolectric issue with unclosed Closeables - I fixed that for the existing AndroidSqliteDriver tests as well
7a9cd5f
to
603c354
Compare
Androidx has a
SQLiteDriver
that targets Android, iOS, Mac, Linux, and JVM Desktop.This PR provides a
SqlDriver
that wraps it. Currently the implementation only works for Android and JVM (it uses aThreadLocal
and I wanted to get some feedback before expanding that functionality to the native targets).