Name
sqlite3_commit_hook() — Register a commit callback
Definition
void* sqlite3_commit_hook( sqlite3* db, commit_callback, void* udp ); int commit_callback( void* udp );
-
db
A database connection.
-
commit_callback
Function pointer to an application-defined commit callback function.
-
udp
An application-defined user-data pointer. This value is made available to the commit callback.
- Returns (
sqlite3_commit_hook()
) The previous user-data pointer, if applicable.
- Returns (
commit_callback()
) If nonzero, the commit is converted into a callback.
Description
This function registers a commit callback. This callback function is called any time the database performs a commit (including an autocommit). Each database connection can have only one commit callback. Registering a new commit callback will overwrite any previously registered callback. To remove the commit callback, set a NULL function pointer.
A commit callback must not use the associated database
connection to modify any databases, nor may it call sqlite3_prepare_v2()
or sqlite3_step()
. If the commit
callback returns a nonzero value, the commit will be canceled
and the transaction will be rolled back.
Get Using SQLite now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.