Withigo has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks,
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?
Thanks!
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?
Thanks!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Pretty printing the exact query (with bind variables) executed by DBI?
by jZed (Prior) on Dec 18, 2007 at 02:07 UTC | |
Re: Pretty printing the exact query (with bind variables) executed by DBI?
by erix (Prior) on Dec 18, 2007 at 02:45 UTC | |
Re: Pretty printing the exact query (with bind variables) executed by DBI?
by pfaut (Priest) on Dec 18, 2007 at 02:11 UTC | |
Re: Pretty printing the exact query (with bind variables) executed by DBI?
by andye (Curate) on Dec 18, 2007 at 20:48 UTC |
Back to
Seekers of Perl Wisdom