xref: /netbsd-src/external/public-domain/sqlite/man/sqlite3_trace.3 (revision b9988867a8ad969c45a52aa7628bc932ec98d46b)
1.Dd January 24, 2024
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.In sqlite3.h
10.Ft void *
11.Fo sqlite3_trace
12.Fa "sqlite3*"
13.Fa "void(*xTrace)(void*,const char*)"
14.Fa "void*"
15.Fc
16.Ft void *
17.Fo sqlite3_profile
18.Fa "sqlite3*"
19.Fa "void(*xProfile)(void*,const char*,sqlite3_uint64)"
20.Fa "void*"
21.Fc
22.Sh DESCRIPTION
23These routines are deprecated.
24Use the
25.Fn sqlite3_trace_v2
26interface instead of the routines described here.
27.Pp
28These routines register callback functions that can be used for tracing
29and profiling the execution of SQL statements.
30.Pp
31The callback function registered by sqlite3_trace() is invoked at various
32times when an SQL statement is being run by
33.Fn sqlite3_step .
34The sqlite3_trace() callback is invoked with a UTF-8 rendering of the
35SQL statement text as the statement first begins executing.
36Additional sqlite3_trace() callbacks might occur as each triggered
37subprogram is entered.
38The callbacks for triggers contain a UTF-8 SQL comment that identifies
39the trigger.
40.Pp
41The SQLITE_TRACE_SIZE_LIMIT compile-time option
42can be used to limit the length of bound parameter expansion
43in the output of sqlite3_trace().
44.Pp
45The callback function registered by sqlite3_profile() is invoked as
46each SQL statement finishes.
47The profile callback contains the original statement text and an estimate
48of wall-clock time of how long that statement took to run.
49The profile callback time is in units of nanoseconds, however the current
50implementation is only capable of millisecond resolution so the six
51least significant digits in the time are meaningless.
52Future versions of SQLite might provide greater resolution on the profiler
53callback.
54Invoking either
55.Fn sqlite3_trace
56or
57.Fn sqlite3_trace_v2
58will cancel the profile callback.
59.Sh IMPLEMENTATION NOTES
60These declarations were extracted from the
61interface documentation at line 3289.
62.Bd -literal
63SQLITE_API SQLITE_DEPRECATED void *sqlite3_trace(sqlite3*,
64   void(*xTrace)(void*,const char*), void*);
65SQLITE_API SQLITE_DEPRECATED void *sqlite3_profile(sqlite3*,
66   void(*xProfile)(void*,const char*,sqlite3_uint64), void*);
67.Ed
68.Sh SEE ALSO
69.Xr sqlite3_step 3 ,
70.Xr sqlite3_trace_v2 3
71