Thread DBI MySQL-Abfrage mit Platzhalter: SQL-Statement ausgeben (18 answers)
Opened by MartinR at 2005-12-19 12:11

renee
 2005-12-20 01:26
#33863 #33863
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Antwort von Tim:
Quote
On Mon, Dec 19, 2005 at 11:47:59PM +0100, module@renee-baecker.de wrote:
> Hi Tim,
>
> is it possible to introduce one new "field" (attribute) for an executed
> statement?
>
> With $sth->{Statement} you just get the "prepared" statement, but if you
> use placeholders and you want to see the executed statement, this is not
> very helpful.

For many databases the placeholders are effectively merged into the
statement on the server, in which case the client may not be able to
produce an SQL statement that matches exactly what the server will do.
(Consider attributes to bind_param() that alter behaviour, for example.)

The ParamValues attribute may be of use to you, if your driver supports
it. See archives for previous discussions on this topic:
http://www.google.com/search?q=ParamValues+bunce

If your driver emulates placeholder itself then it could add a
driver-private attribute that provides the expended statement.

Tim.
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread DBI MySQL-Abfrage mit Platzhalter: SQL-Statement ausgeben