Small. Fast. Reliable.
Choose any three.

About Sitemap Documentation Download License News Developers Support

## 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*);

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

The sqlite3_profile() API is currently considered experimental and is subject to change or removal in a future release.

The trigger reporting feature of the trace callback is considered experimental and is subject to change or removal in future releases. Future versions of SQLite might also add new trace callback invocations.

### Invariants:

F12281 | The callback function registered by sqlite3_trace() is whenever an SQL statement first begins to execute and whenever a trigger subprogram first begins to run.
F12282 | Each call to sqlite3_trace() overrides the previously registered trace callback.
F12283 | A NULL trace callback disables tracing.
F12284 | The first argument to the trace callback is a copy of the pointer which was the 3rd argument to sqlite3_trace().
F12285 | The second argument to the trace callback is a zero-terminated UTF8 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.
F12287 | The callback function registered by sqlite3_profile() is invoked as each SQL statement finishes.
F12288 | The first parameter to the profile callback is a copy of the 3rd parameter to sqlite3_profile().
F12289 | 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.
F12290 | 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/05/12 13:08:44 UTC