I\'m using Perl\'s DBI module. I prepare a statement using placeholders, then execute the query.
Is it possible to print out the final query that was executed without ma
This works for DBD::mysql
with server-side prepare disabled (the default):
$ DBI_TRACE=2 perl your-script-here
It will print each statement twice, once before binding parameters and once after. The latter will be well-formed SQL that you can run yourself.
There is also a module, DBI::Log, which only prints SQL statements (no other debug noise), and optional timing information and caller stacktraces. It's really useful.