Skip to content
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

feat: Add set_update_hook on SqliteConnection #3260

Merged
merged 3 commits into from
Jun 6, 2024

Conversation

gridbox
Copy link
Contributor

@gridbox gridbox commented Jun 3, 2024

Fixes #3114

This is an initial pass at exposing the Sqlite update hook. I used set_progress_handler as a guide. This allows the consuming code to register a callback on the connection and receive the operation, database name, table name, and rowid of the affected record.

I'm in the process of adding listener functionality in my own code which will use channels to publish data changes but thought that may be out of scope for sqlx itself.

sqlx-sqlite/src/connection/mod.rs Outdated Show resolved Hide resolved
sqlx-sqlite/src/statement/mod.rs Outdated Show resolved Hide resolved
sqlx-sqlite/src/connection/mod.rs Outdated Show resolved Hide resolved
sqlx-sqlite/src/connection/mod.rs Outdated Show resolved Hide resolved
sqlx-sqlite/src/statement/mod.rs Outdated Show resolved Hide resolved
@abonander abonander merged commit 0ea9088 into launchbadge:main Jun 6, 2024
4 checks passed
jayy-lmao pushed a commit to jayy-lmao/sqlx that referenced this pull request Jun 6, 2024
* feat: Add set_update_hook on SqliteConnection

* refactor: Address PR comments

* fix: Expose UpdateHookResult for public use

---------

Co-authored-by: John Smith <asserta4@gmail.com>
@Mek101
Copy link

Mek101 commented Jun 6, 2024

When will the next release be published?

jrasanen pushed a commit to jrasanen/sqlx that referenced this pull request Oct 14, 2024
* feat: Add set_update_hook on SqliteConnection

* refactor: Address PR comments

* fix: Expose UpdateHookResult for public use

---------

Co-authored-by: John Smith <asserta4@gmail.com>
jrasanen pushed a commit to jrasanen/sqlx that referenced this pull request Oct 14, 2024
* feat: Add set_update_hook on SqliteConnection

* refactor: Address PR comments

* fix: Expose UpdateHookResult for public use

---------

Co-authored-by: John Smith <asserta4@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[SQLite] Expose sqlite3_update_hook
3 participants