Help Center

CSQLiteStmt.ProgressHandlermethod

The **ProgressHandler** method causes a callback function to be invoked periodically during long running calls to **Step_** and **GetRow** for a database connection.

DatabasesmethodCSQLite.incdoc-orphan
No implementation located. This member is documented, but the source scan found no matching declaration. It is likely declared in a header this scan does not resolve, or provided by a macro.

Syntax

SUB ProgressHandler (BYVAL nOps AS LONG, BYVAL pCallback AS ANY PTR, BYVAL pArg AS ANY PTR)

Parameters

NameDescription
nOpsNumber of virtual machine instructions that are evaluated between successive invocations of the callback.
pCallbackPointer to the callback function.
pArgData that is passed through as the only parameter to the callback function.
opAn integer constant, taken from the set of SQLITE_DBSTATUS options, that determines the parameter to interrogate.
pCurrentThe current value of the requested parameter.
pHighwaterThe highest instantaneous value.
resetFlagTRUE or FALSE. If true, then the highest instantaneous value is reset back down to the current value.

Return value

The number of bytes freed.

SQLITE_OK (0) on success and a non-zero error code on failure.

Description

The ProgressHandler method causes a callback function to be invoked periodically during long running calls to Step_ and GetRow for a database connection. An example use for this interface is to keep a GUI updated during a large query.

Callback function prototype:

Remarks

Only a single progress handler may be defined at one time per database connection; setting a new progress handler cancels the old one. Setting parameter pCallBack to NULL disables the progress handler. The progress handler is also disabled by setting pCallBack to a value less than 1.

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

The progress handler callback must not do anything that will modify the database connection that invoked the progress handler. Note that Prepare and Step_ both modify their database connections for the meaning of "modify" in this paragraph.

Example

SQLITE_DBSTATUS_LOOKASIDE_USED = 0 SQLITE_DBSTATUS_CACHE_USED = 1 SQLITE_DBSTATUS_SCHEMA_USED = 2 SQLITE_DBSTATUS_STMT_USED = 3 SQLITE_DBSTATUS_LOOKASIDE_HIT = 4 SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE = 5 SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL = 6 SQLITE_DBSTATUS_CACHE_HIT = 7 SQLITE_DBSTATUS_CACHE_MISS = 8 SQLITE_DBSTATUS_CACHE_WRITE = 9

Reference

  • Include file CSQLite.inc
  • Documented in Databases/CSQLite Class.md
  • Topic: CSQLite Class