[odb-users] Tracing sql statements using ODB 2.2 with Sqlite 3.7

Boris Kolpackov boris at codesynthesis.com
Wed Nov 20 04:59:49 EST 2013


Hi Devesh,

Devesh Agrawal <dagrawal at infinio.com> writes:

> I am trying to trace the sql statements being executed using the
> db::tracer(odb::tracer&) api. I want to know the actual values inserted or
> updated after the statement is fully bound.
> 
> That is I don't want to trace 'Insert into X values (?, ?, ?)'. I would
> rather want to trace 'insert into X values ('foo', 'bar', 'baz')

This is not possible with the ODB tracer API since that would be very
heavy-weight both in terms of the implementation and runtime overhead.

However, SQLite provides its own tracing support with the sqlite_trace()
API. And I believe in recent versions of SQLite this will include actual
values (what it will print if you persist, say, a 1Mb BLOB I don't know).

The following earlier post explains how you can enable SQLite-level
tracing with ODB:

http://www.codesynthesis.com/pipermail/odb-users/2011-October/000322.html

Boris



More information about the odb-users mailing list