[WIP] Initial proposal for the preupdate hook.#897
Conversation
Created an initial proposal/direction for the preupdate hook. It is heavily based on the update hook, with only minor modifications to that code. This means that it entirely translate the original C API.
Codecov Report
@@ Coverage Diff @@
## master #897 +/- ##
==========================================
- Coverage 77.72% 76.83% -0.90%
==========================================
Files 48 48
Lines 5621 5689 +68
==========================================
+ Hits 4369 4371 +2
- Misses 1252 1318 +66
Continue to review full report at Codecov.
|
|
May I suggest that |
|
@gwenn , of course you can suggest that, that is also the first point I touch in my initial message. However the "problem" with that is that it might be confusing that This is my first time writing something that has an interface with C-code so I'm being very cautious and trying to make as little change as possible at a time. |
By default, SQLite does not encompass all hooks so it seems "normal" that rusqlite does the same, no ? |
The difference (unless I'm mistaken about SQLite itself), is that SQLite will have some hooks by default and you can add a flag for the preupdate_hook. But in rusqlite you have to specify that you want hooks (by using the Just to clarify, I am completely on board with having a separate flag for the preupdate hook since it requires a special compilation of SQLite, but I'm concerned that it might not be clear if or how these different features interact. |
Moved hooks and preupdate_hook into their own modules inside hooks.rs Also created an initial way to access the functions that are available during the callback.
| } | ||
|
|
||
| #[cfg(feature = "hooks")] | ||
| mod datachanged_and_friends { |
There was a problem hiding this comment.
This is just a preliminary name, I couldn't come up with a succint naming for all the hooks, excluding the preupdate_hook.
Function duplication for delete-update and insert-update has been moved, as everything available in insert or delete is available for update.
I created an initial draft for the preupdate hook that seems to work ok after preliminary testing.
Some questions arose and I'm looking for some input/feedback:
libsqlite3-syscrate).hookscode to be included if one or the other is active.If anyone can help me and give some feedback on what the best way forward would be, that would be much appreciated.