[odb-users] SQL Statement Tracer

Boris Kolpackov boris at codesynthesis.com
Thu Aug 16 08:33:40 EDT 2012


Hi Eric,

Sum, Eric B <eric.b.sum at lmco.com> writes:

> It prints something along the lines of
> 
> INSERT INTO table VALUES (?,?,?)
> 
> It looks like the parameters for the sqlite_statement are being print
> out unbound. I was wondering if it is possible to get it to print 
> something like:
> 
> INSERT INTO table VALUES(1,2,3) where the bound values appear rather
> than "?"

No, this is not possible. ODB uses prepared statements and passes all
the parameters in binary form (i.e., ODB actually never constructs a
string like "INSERT INTO table VALUES(1,2,3)"). Adding this functionality
would involve quite a bit of effort/code bloat. It is also a fairly
"hairy" problem if you start to think about it. For example, how do
we print BLOBs. What if the data is very long (say multiple megabytes)?
What about national characters?

If you want to see actual values, then I suggest that you look for
this support in your database logs. In case of SQLite, there is
the sqlite3_trace() function. However, I don't think it will print
values for parameters in prepared statements either.

Boris



More information about the odb-users mailing list