Small. Fast. Reliable.
Choose any three.

About Sitemap Documentation Download License News Developers Support

## SQLite C Interface

### Commit And Rollback Notification Callbacks

>     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.

This page last modified 2007/12/14 14:37:57 UTC