I notice, on Android, sqldelight grabs a writeable...
# squarelibraries
m
I notice, on Android, sqldelight grabs a writeable database when passed in a
SupportSQLiteOpenHelper
but what if the database is read-only (as in, you never want to modify it)? Are there any best practices/optimizations for opening such a database? I know there are some cases where
readableDatabase
returns a non-null value when
writeableDatabase
returns null, so there could be cases where it makes more sense to call
readableDatabase
. A nasty workaround is to override the helper so that the result of
readableDatabase
is returned when
writeableDatabase
is called. https://github.com/cashapp/sqldelight/blob/51e0621abe103761717d3d9078dcde3734ad8c0[…]ain/java/com/squareup/sqldelight/android/AndroidSqliteDriver.kt
j
Is this hypothetical? If no, file a bug. We can add a parameter to only take a readable database
m
It’s documented behaviour though I don’t know the likelihood/circumstances https://stackoverflow.com/a/11751696/444761