Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: DBI.pm: composing and debugging MySql placeholders

by mje (Curate)
on Oct 13, 2015 at 16:40 UTC ( #1144723=note: print w/replies, xml ) Need Help??


in reply to DBI.pm: composing and debugging MySql placeholders

Look at DBIx-Log4perl or DBIx-LogAny for a way to get placeholders from the statement handle e.g., ParamValues and ParamTypes. Both of those modules can log SQL and placeholders. Look at DBI callbacks and you can intercept the execute and do methods.

If you actually want to recreate the SQL with the placeholders in place that is slightly more difficult but not impossible

  • Comment on Re: DBI.pm: composing and debugging MySql placeholders

Replies are listed 'Best First'.
Re^2: DBI.pm: composing and debugging MySql placeholders
by LanX (Archbishop) on Oct 13, 2015 at 17:45 UTC
    > If you actually want to recreate the SQL with the placeholders in place that is slightly more difficult but not impossible

    Well automatically constructing the following should be straight forward, (though I'm not sure about namespaces in SQL, but for cut and paste this should be irrelevant)

    PREPARE stmt1 FROM 'SELECT * FROM t_user_portal WHERE f_client = ?'; SET @client = 'lanx'; EXECUTE stmt1 USING @client;

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1144723]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2019-04-19 20:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I am most likely to install a new module from CPAN if:
















    Results (107 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!