|We don't bite newbies here... much|
Pretty printing the exact query (with bind variables) executed by DBI?by Withigo (Friar)
|on Dec 18, 2007 at 01:50 UTC||Need Help??|
Withigo has asked for the
wisdom of the Perl Monks concerning the following question:
I often find myself troubleshooting why a complex DBI select query return zero rows. Often, these queries are over a dozen tables in a complex join, and also contain dynamically created SQL 'where' conditions based on combinations of certain arguments being present.
Being the lazy monk that I am, I just want to see a pretty version of the query that DBI executes, with the bind variables interpolated in the query, so that I can manually pick apart the query and determined what data is missing from which tables that made the query return zero rows.
I know about DBI->trace, but the output is not very readable. There's a lot of debugging info that I don't need. Can anyone recommend an existing module or share a snippet of code you may have which parses the trace output, and pretty prints the query like I described?