xref: /netbsd-src/external/public-domain/sqlite/man/sqlite3_trace.3 (revision e89934bbf778a6d6d6894877c4da59d0c7835b0f)
1.Dd December 18, 2016
2.Dt SQLITE3_TRACE 3
3.Os
4.Sh NAME
5.Nm sqlite3_trace ,
6.Nm sqlite3_profile
7.Nd Tracing And Profiling Functions
8.Sh SYNOPSIS
9.Ft void *SQLITE_STDCALL
10.Fo sqlite3_trace
11.Fa "sqlite3*"
12.Fa "void(*xTrace)(void*,const char*)"
13.Fa "void*"
14.Fc
15.Ft void *SQLITE_STDCALL
16.Fo sqlite3_profile
17.Fa "sqlite3*"
18.Fa "void(*xProfile)(void*,const char*,sqlite3_uint64)"
19.Fa "void*"
20.Fc
21.Sh DESCRIPTION
22These routines register callback functions that can be used for tracing
23and profiling the execution of SQL statements.
24.Pp
25The callback function registered by sqlite3_trace() is invoked at various
26times when an SQL statement is being run by sqlite3_step().
27The sqlite3_trace() callback is invoked with a UTF-8 rendering of the
28SQL statement text as the statement first begins executing.
29Additional sqlite3_trace() callbacks might occur as each triggered
30subprogram is entered.
31The callbacks for triggers contain a UTF-8 SQL comment that identifies
32the trigger.
33.Pp
34The SQLITE_TRACE_SIZE_LIMIT compile-time option
35can be used to limit the length of bound parameter expansion
36in the output of sqlite3_trace().
37.Pp
38The callback function registered by sqlite3_profile() is invoked as
39each SQL statement finishes.
40The profile callback contains the original statement text and an estimate
41of wall-clock time of how long that statement took to run.
42The profile callback time is in units of nanoseconds, however the current
43implementation is only capable of millisecond resolution so the six
44least significant digits in the time are meaningless.
45Future versions of SQLite might provide greater resolution on the profiler
46callback.
47The sqlite3_profile() function is considered experimental and is subject
48to change in future versions of SQLite.
49.Sh SEE ALSO
50.Xr sqlite3_step 3
51