Small. Fast. Reliable.
Choose any three.

SQLite C Interface

Query Progress Callbacks

void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);

This routine configures a callback function - the progress callback - that is invoked periodically during long running calls to sqlite3_exec(), sqlite3_step() and sqlite3_get_table(). An example use for this interface is to keep a GUI updated during a large query.

If the progress callback returns non-zero, the opertion is interrupted. This feature can be used to implement a "Cancel" button on a GUI dialog box.

Invariants:

F12911 The callback function registered by sqlite3_progress_handler() is invoked periodically during long running calls to sqlite3_step().
F12912 The progress callback is invoked once for every N virtual machine opcodes, where N is the second argument to the sqlite3_progress_handler() call that registered the callback. (TODO: What if N is less than 1?)
F12913 The progress callback itself is identified by the third argument to sqlite3_progress_handler().
F12914 The fourth argument sqlite3_progress_handler() is a void pointer passed to the progress callback function each time it is invoked.
F12915 If a call to sqlite3_step() results in fewer than N opcodes being executed, then the progress callback is never invoked.
F12916 Every call to sqlite3_progress_handler() overwrites any previously registere progress handler.
F12917 If the progress handler callback is NULL then no progress handler is invoked.
F12918 If the progress callback returns a result other than 0, then the behavior is a if sqlite3_interrupt() had been called.

See also lists of Objects, Constants, and Functions.


This page last modified 2008/01/31 20:37:13 UTC