Small. Fast. Reliable.
Choose any three.

SQLite C Interface

Tracing And Profiling Functions

void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*);
void *sqlite3_profile(sqlite3*,
   void(*xProfile)(void*,const char*,sqlite3_uint64), void*);

Important: This interface is experimental and is subject to change without notice.

These routines register callback functions that can be used for tracing and profiling the execution of SQL statements.

The callback function registered by sqlite3_trace() is invoked at various times when an SQL statement is being run by sqlite3_step(). The callback returns a UTF-8 rendering of the SQL statement text as the statement first begins executing. Additional callbacks occur as each triggered subprogram is entered. The callbacks for triggers contain a UTF-8 SQL comment that identifies the trigger.

The callback function registered by sqlite3_profile() is invoked as each SQL statement finishes. The profile callback contains the original statement text and an estimate of wall-clock time of how long that statement took to run.

Invariants:

H12281 The callback function registered by sqlite3_trace() shall be invoked whenever an SQL statement first begins to execute and whenever a trigger subprogram first begins to run.
H12282 Each call to sqlite3_trace() shall override the previously registered trace callback.
H12283 A NULL trace callback shall disable tracing.
H12284 The first argument to the trace callback shall be a copy of the pointer which was the 3rd argument to sqlite3_trace().
H12285 The second argument to the trace callback is a zero-terminated UTF-8 string containing the original text of the SQL statement as it was passed into sqlite3_prepare_v2() or the equivalent, or an SQL comment indicating the beginning of a trigger subprogram.
H12287 The callback function registered by sqlite3_profile() is invoked as each SQL statement finishes.
H12288 The first parameter to the profile callback is a copy of the 3rd parameter to sqlite3_profile().
H12289 The second parameter to the profile callback is a zero-terminated UTF-8 string that contains the complete text of the SQL statement as it was processed by sqlite3_prepare_v2() or the equivalent.
H12290 The third parameter to the profile callback is an estimate of the number of nanoseconds of wall-clock time required to run the SQL statement from start to finish.

See also lists of Objects, Constants, and Functions.


This page last modified 2008/12/09 18:44:04 UTC