xref: /netbsd-src/external/public-domain/sqlite/man/SQLITE_TRACE_STMT.3 (revision 7330f729ccf0bd976a06f95fad452fe774fc7fd1)
1.Dd December 19, 2018
2.Dt SQLITE_TRACE_STMT 3
3.Os
4.Sh NAME
5.Nm SQLITE_TRACE_STMT ,
6.Nm SQLITE_TRACE_PROFILE ,
7.Nm SQLITE_TRACE_ROW ,
8.Nm SQLITE_TRACE_CLOSE
9.Nd SQL Trace Event Codes
10.Sh SYNOPSIS
11.Fd #define SQLITE_TRACE_STMT
12.Fd #define SQLITE_TRACE_PROFILE
13.Fd #define SQLITE_TRACE_ROW
14.Fd #define SQLITE_TRACE_CLOSE
15.Sh DESCRIPTION
16These constants identify classes of events that can be monitored using
17the sqlite3_trace_v2() tracing logic.
18The M argument to sqlite3_trace_v2(D,M,X,P)
19is an OR-ed combination of one or more of the following constants.
20The first argument to the trace callback is one of the following constants.
21.Pp
22New tracing constants may be added in future releases.
23.Pp
24A trace callback has four arguments: xCallback(T,C,P,X).
25The T argument is one of the integer type codes above.
26The C argument is a copy of the context pointer passed in as the fourth
27argument to sqlite3_trace_v2().
28The P and X arguments are pointers whose meanings depend on T.
29.Bl -tag -width Ds
30.It SQLITE_TRACE_STMT
31An SQLITE_TRACE_STMT callback is invoked when a prepared statement
32first begins running and possibly at other times during the execution
33of the prepared statement, such as at the start of each trigger subprogram.
34The P argument is a pointer to the prepared statement.
35The X argument is a pointer to a string which is the unexpanded SQL
36text of the prepared statement or an SQL comment that indicates the
37invocation of a trigger.
38The callback can compute the same text that would have been returned
39by the legacy sqlite3_trace() interface by using the
40X argument when X begins with "--" and invoking sqlite3_expanded_sql(P)
41otherwise.
42.It SQLITE_TRACE_PROFILE
43An SQLITE_TRACE_PROFILE callback provides approximately the same information
44as is provided by the sqlite3_profile() callback.
45The P argument is a pointer to the prepared statement
46and the X argument points to a 64-bit integer which is the estimated
47of the number of nanosecond that the prepared statement took to run.
48The SQLITE_TRACE_PROFILE callback is invoked when the statement finishes.
49.It SQLITE_TRACE_ROW
50An SQLITE_TRACE_ROW callback is invoked whenever a prepared statement
51generates a single row of result.
52The P argument is a pointer to the prepared statement
53and the X argument is unused.
54.It SQLITE_TRACE_CLOSE
55An SQLITE_TRACE_CLOSE callback is invoked when a database connection
56closes.
57The P argument is a pointer to the database connection
58object and the X argument is unused.
59.El
60.Pp
61.Sh SEE ALSO
62.Xr sqlite3 3 ,
63.Xr sqlite3_stmt 3 ,
64.Xr sqlite3_trace 3 ,
65.Xr sqlite3_trace_v2 3
66