-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 04/17/2010 11:08 AM, andrew fabbro wrote: > I realize that's at the DBI layer and part of the DBI spec, but...is anyone > aware of something similar in the C environment for SQLite? There does not > appear to be any sort of debug logging, etc. that one can turn on.
sqlite3_trace: http://www.sqlite.org/c3ref/profile.html > If not, does anyone have any ideas for coding up some sort of logging > engine? I don't really want to get deep into SQLite internals, though I > suspect that's what would be needed... For my Python wrapper you can add a callback on each connection (sqlite3 *) which is called with each statement executed. (It tells you the python level objects used as bindings.) Same thing to get timings (uses sqlite3_profile). I also have what is called a connection hook which is a list of callbacks that are called when a connection is created. The intention is that they can be used to register functions, virtual tables etc. I used that as a base to build a tracing tool. The tool registers a connection hook and then runs the original code. The connection hook adds in callbacks for tracing and profiling which are printed if configured to do so. After the original code is finished the collected data is sorted and reports generated. - From a usability point of view, the best thing is that it requires no modification of the original program. You just use the tool to supervise running the program when you want tracing. You could achieve something similar for C based code by using a shared library with the same symbol names as SQLite and then use LD_PRELOAD to intercept the calls for tracing and reporting. (Under Windows you can use DLL injection which is a bit harder.) Here is my documentation and example output: http://apsw.googlecode.com/svn/publish/execution.html#apsw-trace Roger -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkvKDVIACgkQmOOfHg372QSP8gCfTJemY94n5ZCnCjMmLU5yYlma OSwAn1/p0uu9Kqw8vY4PbstoCNH1Kkbl =nLmK -----END PGP SIGNATURE----- _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users