On Sat, Dec 04, 2010 at 01:17:00PM +1100, BareFeetWare scratched on the wall: > Hi all, > > If I prepare a statement using sqlite3_prepare_v2() and then bind > parameters to it using the sqlite3_bind_* functions, is there then a > way to get the human readable form of the statement?
Kind of. You can register a trace callback with sqlite3_trace(). The second parameter of the callback will have the SQL statement, complete with expanded parameters. You can't get this information at an arbitrary time, however, only when sqlite3_step() decides to make the callback. The trace function is designed for building debuggers and system analyzers, not general application use. You might be able to expose sqlite3VdbeExpandSql() for your own use. This is the main internal function that provides the SQL statement rendering for the trace callback. You may need to be careful, however... a quick reading makes it look like it will throw an assert if you don't have every parameter already bound. You can also, of course, use sqlite3_sql() to get a copy of the original SQL statement, although that will not replace and expand the statement parameters. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them feel uncomfortable." -- Angela Johnson _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

