xref: /netbsd-src/external/public-domain/sqlite/man/sqlite3_trace_v2.3 (revision b9988867a8ad969c45a52aa7628bc932ec98d46b)
1.Dd January 24, 2024
2.Dt SQLITE3_TRACE_V2 3
3.Os
4.Sh NAME
5.Nm sqlite3_trace_v2
6.Nd SQL trace hook
7.Sh SYNOPSIS
8.In sqlite3.h
9.Ft int
10.Fo sqlite3_trace_v2
11.Fa "sqlite3*"
12.Fa "unsigned uMask"
13.Fa "int(*xCallback)(unsigned,void*,void*,void*)"
14.Fa "void *pCtx"
15.Fc
16.Sh DESCRIPTION
17The sqlite3_trace_v2(D,M,X,P) interface registers a trace callback
18function X against database connection D, using
19property mask M and context pointer P.
20If the X callback is NULL or if the M mask is zero, then tracing is
21disabled.
22The M argument should be the bitwise OR-ed combination of zero or more
23SQLITE_TRACE constants.
24.Pp
25Each call to either sqlite3_trace(D,X,P) or sqlite3_trace_v2(D,M,X,P)
26overrides (cancels) all prior calls to sqlite3_trace(D,X,P) or sqlite3_trace_v2(D,M,X,P)
27for the database connection D.
28Each database connection may have at most one trace callback.
29.Pp
30The X callback is invoked whenever any of the events identified by
31mask M occur.
32The integer return value from the callback is currently ignored, though
33this may change in future releases.
34Callback implementations should return zero to ensure future compatibility.
35.Pp
36A trace callback is invoked with four arguments: callback(T,C,P,X).
37The T argument is one of the SQLITE_TRACE constants to
38indicate why the callback was invoked.
39The C argument is a copy of the context pointer.
40The P and X arguments are pointers whose meanings depend on T.
41.Pp
42The sqlite3_trace_v2() interface is intended to replace the legacy
43interfaces
44.Fn sqlite3_trace
45and
46.Fn sqlite3_profile ,
47both of which are deprecated.
48.Sh IMPLEMENTATION NOTES
49These declarations were extracted from the
50interface documentation at line 3383.
51.Bd -literal
52SQLITE_API int sqlite3_trace_v2(
53  sqlite3*,
54  unsigned uMask,
55  int(*xCallback)(unsigned,void*,void*,void*),
56  void *pCtx
57);
58.Ed
59.Sh SEE ALSO
60.Xr sqlite3 3 ,
61.Xr sqlite3_trace 3 ,
62.Xr SQLITE_TRACE_STMT 3
63