dorward
asked on
Transparent wrapper around DBI for debugging purposes
I have a large code base (which runs under mod_perl) to which I would like to add some debugging code.
I would like to be able to run a bit of code everytime DBI is used to connect, prepare or execute. How can I add this debugging code _without_ editing every call to those methods and _without_ editing the DBI module itself.
I would like to be able to run a bit of code everytime DBI is used to connect, prepare or execute. How can I add this debugging code _without_ editing every call to those methods and _without_ editing the DBI module itself.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
set
DBI->trace(2 => "/tmp/logfile");
somewhere near the top of your script.
Or set the environment variable
DBI_PROFILE=2
See manuals for DBI::Profile and DBI::Trace.
(Found this at http://www.class-dbi.com/cgi-bin/wiki/index.cgi?SeeAllSQL)