Small. Fast. Reliable.
Choose any three.
#define SQLITE_TRACE_STMT 0x01
#define SQLITE_TRACE_PROFILE 0x02
#define SQLITE_TRACE_ROW 0x04
#define SQLITE_TRACE_CLOSE 0x08
These constants identify classes of events that can be monitored
using the sqlite3_trace_v2() tracing logic. The M argument
to sqlite3_trace_v2(D,M,X,P) is an OR-ed combination of one or more of
the following constants.
R-01386-30047:[The first argument to the trace callback
is one of the following constants.
]
New tracing constants may be added in future releases.
R-49248-49502:[A trace callback has four arguments: xCallback(T,C,P,X).
]
R-00303-53643:[The T argument is one of the integer type codes above.
]
R-42043-38025:[The C argument is a copy of the context pointer passed in as the
fourth argument to sqlite3_trace_v2().
]
The P and X arguments are pointers whose meanings depend on T.
- SQLITE_TRACE_STMT
-
R-15462-52806:[An SQLITE_TRACE_STMT callback is invoked when a prepared statement
first begins running and possibly at other times during the
execution of the prepared statement, such as at the start of each
trigger subprogram.
]
R-35903-55864:[The P argument is a pointer to the
prepared statement.
]
R-20053-18593:[The X argument is a pointer to a string which
is the unexpanded SQL text of the prepared statement or an SQL comment
that indicates the invocation of a trigger.
]
R-50676-09860:[The callback can compute
the same text that would have been returned by the legacy sqlite3_trace()
interface by using the X argument when X begins with "--" and invoking
sqlite3_expanded_sql(P) otherwise.
]
- SQLITE_TRACE_PROFILE
-
R-47563-44180:[An SQLITE_TRACE_PROFILE callback provides approximately the same
information as is provided by the sqlite3_profile() callback.
]
R-65526-17003:[The P argument is a pointer to the prepared statement and the
X argument points to a 64-bit integer which is approximately
the number of nanoseconds that the prepared statement took to run.
]
R-43754-40546:[The SQLITE_TRACE_PROFILE callback is invoked when the statement finishes.
]
- SQLITE_TRACE_ROW
-
R-24189-42234:[An SQLITE_TRACE_ROW callback is invoked whenever a prepared
statement generates a single row of result.
]
R-63404-48526:[The P argument is a pointer to the prepared statement and the
X argument is unused.
]
- SQLITE_TRACE_CLOSE
-
R-24550-28707:[An SQLITE_TRACE_CLOSE callback is invoked when a database
connection closes.
]
R-11278-45262:[The P argument is a pointer to the database connection object
and the X argument is unused.
]
See also lists of
Objects,
Constants, and
Functions.