Name

sqlite3_rollback_hook() — Register a rollback callback

Definition

void* sqlite3_rollback_hook( sqlite3* db, rollback_callback, void* udp );

void commit_callback( void* udp );
db

A database connection.

rollback_callback

Function pointer to an application-defined commit callback function.

udp

An application-defined user-data pointer. This value is made available to the rollback callback.

Returns (sqlite3_rollback_hook())

The previous user-data pointer, if applicable.

Description

This function registers a rollback callback. This callback function is called when the database performs a rollback from an explicit ROLLBACK, or due to an error condition (including a commit callback returning nonzero). The callback is not called when an in-flight transaction is rolled back due to the database connection being closed.

Each database connection can have only one callback. Registering a new callback will overwrite any previously registered callback. To remove the callback, set a NULL function pointer.

The callback must not use the associated database connection to modify any databases, nor may it call sqlite3_prepare_v2() or sqlite3_step().

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.