You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not sure if it's a good suggestion, but can we undo Android sqlite bad API design by making the name parameter mandatory in sqldriver constructor and adding an optional isInMemory parameter (default false)?
I mean do you think it'll be a good addition? If yes I can raise a pr with this.
Context:
In Android Sqlite openhelper, the name parameter is optional, not providing it creates an in-memory database. This API design is very confusing and easy to make mistakes.
Sqldelight follows the same for AndroidSqliteDriver construction, if we pass schema and context, but don't pass name, it creates an in-memory db, passing it creates a persistent db.
While this makes it consistent with the platforms db framework behaviour, I think we can take a better approach.
If we make the name parameter mandatory (like iOS or other platforms than Android), and add an additional parameter isInMemory with default value false, then it'll be easier for developers to understand and work on db type and less easier to make mistakes.
However, this might be slightly out of scope from the original premises of sqldelight, hence not sure if it's worth adding.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Not sure if it's a good suggestion, but can we undo Android sqlite bad API design by making the name parameter mandatory in sqldriver constructor and adding an optional isInMemory parameter (default false)?
I mean do you think it'll be a good addition? If yes I can raise a pr with this.
Context:
In Android Sqlite openhelper, the name parameter is optional, not providing it creates an in-memory database. This API design is very confusing and easy to make mistakes.
Sqldelight follows the same for AndroidSqliteDriver construction, if we pass schema and context, but don't pass name, it creates an in-memory db, passing it creates a persistent db.
While this makes it consistent with the platforms db framework behaviour, I think we can take a better approach.
If we make the name parameter mandatory (like iOS or other platforms than Android), and add an additional parameter
isInMemory
with default value false, then it'll be easier for developers to understand and work on db type and less easier to make mistakes.However, this might be slightly out of scope from the original premises of sqldelight, hence not sure if it's worth adding.
Beta Was this translation helpful? Give feedback.
All reactions