SQLite User Forum

Disabling a hook from sqlite3_update_hook ?
Login

Disabling a hook from sqlite3_update_hook ?

(1) By lovasoa on 2025-03-12 10:29:43 [source]

Hello !

The documentation for sqlite3_update_hook does not mention a way to disable the update hook once it's set up.

This contrasts with the documentation for sqlite3_preupdate_hook, which mentions:

The preupdate hook is disabled by invoking sqlite3_preupdate_hook() with a NULL pointer as the second parameter.

Is this just something that was overlooked when writing the docs, or is passing NULL to sqlite3_update_hook not officially supported?

Initial discussion: https://github.com/sql-js/sql.js/pull/604#issuecomment-2717032099

(2) By Stephan Beal (stephan) on 2025-03-12 11:06:15 in reply to 1 [link] [source]

Is this just something that was overlooked when writing the docs, or is passing NULL to sqlite3_update_hook not officially supported?

It looks to be a simple documentation oversight, and that NULL is perfectly legal, but we'll get that confirmed and update the docs accordingly. Thank you for the report.

(3) By Stephan Beal (stephan) on 2025-03-12 11:43:10 in reply to 1 [link] [source]

Is this just something that was overlooked when writing the docs, or is passing NULL to sqlite3_update_hook not officially supported?

That's now been addressed as a doc-only change: NULL is the correct way to unset the hook. It won't show up on the website until the 3.50 release nears, but the behavior applies retroactively, very probably since that API was first introduced.

Thank you for the report!

(4) By lovasoa on 2025-03-12 11:53:10 in reply to 3 [link] [source]

Thank you for the quick response!