See all SQL

From ClassDBI

Revision as of 19:08, 19 December 2008 by EdwardSabol (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

If you want to see all the SQL that's being issued you need to set a DBI Trace.

You can either set the DBI_TRACE environment variable

 DBI_TRACE=2 ./myscript.pl

...or log to a file using DBI::ProfileDumper and dbiprof for analysis...

 DBI_PROFILE=DBI::ProfileDumper ./myscript.pl
 dbiprof

...or log to a file using the DBI_TRACE environment variable...

 DBI_TRACE=2=/tmp/logfile ./myscript.pl

...or by adding the following...

 DBI->trace(2 => "/tmp/logfile");

in your code. See the documentation for DBI::Profile, DBI::ProfileDumper and DBI::Trace for more info.

Another method is to enable logging capabilities of your DBMS. For example in MySQL add '--log' option to command line when starting server.

Personal tools