requery / sqlite-android

Android SQLite support library
Apache License 2.0
1.05k stars 138 forks source link

Open to a PR to support sqlite3_update_hook, sqlite3_commit_hook, sqlite3_rollback_hook? #187

Open hborders opened 7 months ago

hborders commented 7 months ago

I'd like to add support for sqlite3_update_hook and sqlite3_commit_hook and sqlite3_rollback_hook, and ideally, I'd like to do so as part of this project. Do you have any contribution guidelines?

I think implementing the sqlite3_update_hook API is most important because it could avoid a re-query when dependent data changes. Similar APIs exist in SqlBrite and SqlDelight Query (which requires users to maintain their own dependencies outside sqlite, and which notifies outside sqlite after the transaction completes in Transacter), but they always requery all data. Instead, a sqlite3_update_hook could allow a client to requery only the data that changed rather than the entire data set.

If including API that doesn't exist either directly or in spirit within Android or AndroidX is not within the bounds of this project, do you have any advice for how to add sqlite_*_hook support to a project consuming requery/sqlite-android?

Thanks!

npurushe commented 6 months ago

Hi yes that makes sense to me since its an optional hook, feel free to open a PR. I think this can be implemented similarly to SQLiteFunction.