|No such thing as a small change|
DBI.pm: composing and debugging MySql placeholdersby LanX (Sage)
|on Oct 13, 2015 at 15:48 UTC||Need Help??|
LanX has asked for the wisdom of the Perl Monks concerning the following question:
For security reasons I'm trying to convince colleagues to start using placeholders in SQL prepared statements instead of using variable interpolation ( I don't want to discuss this further)
Now I'm getting the requirement to be able to show and log the resulting SQL statement of an ->execute() .
The motivation is to facilitate a cut&paste into an SQL GUI in case of problems.
There are multiple workarounds I could think of to mimic the process of ->bind_param() , but is there a proper way to use DBI.pm to get the analogous query after ->execute() ?
for instance this
in case of problems?
I'm aware that MySql doesn't compose the query with placeholders by concatenating strings, it's rather something like:
which is still a acceptable for debugging (and easily constructable as a workaround).
So my question is:
Does DBI.pm show any resulting SQL-code from ->bind_param() or do I need to reconstruct the last code by myself after an error occurred?