|
void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*); void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
The sqlite3_commit_hook() interface registers a callback function to be invoked whenever a transaction is committed. Any callback set by a previous call to sqlite3_commit_hook() for the same database connection is overridden. The sqlite3_rollback_hook() interface registers a callback function to be invoked whenever a transaction is committed. Any callback set by a previous call to sqlite3_commit_hook() for the same database connection is overridden. The pArg argument is passed through to the callback. If the callback on a commit hook function returns non-zero, then the commit is converted into a rollback.
If another function was previously registered, its pArg value is returned. Otherwise NULL is returned.
Registering a NULL function disables the callback.
For the purposes of this API, a transaction is said to have been rolled back if an explicit "ROLLBACK" statement is executed, or an error or constraint causes an implicit rollback to occur. The rollback callback is not invoked if a transaction is automatically rolled back because the database connection is closed. The rollback callback is not invoked if a transaction is rolled back because a commit callback returned non-zero. (TODO: Check on this )
These are experimental interfaces and are subject to change.
See also lists of Objects, Constants, and Functions.