Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Pretty printing the exact query (with bind variables) executed by DBI?

by erix (Prior)
on Dec 18, 2007 at 02:45 UTC ( [id://657590] : note . print w/replies, xml ) Need Help??


in reply to Pretty printing the exact query (with bind variables) executed by DBI?

I find it handy (as a debug facility) to add the actual values out-commented behind the placeholders. This doesn't give you the exact statement but it makes it easy to reproduce them, or just to check the actual values that the statement was executed with:

select name, address, phone where name = ? -- 'Doe'

Another approach would be to let DBI trace produce its mess, and make your statements easy to parse out of the 'wealth of information' by a markup scheme, again SQL-outcommented, of course:

-----8<--------------- select name, address, phone where name = ? -----8<---------------