Re: [DBI] new attribute for executed statement



On Mon, Dec 19, 2005 at 11:47:59PM +0100, module@xxxxxxxxxxxxxxxx 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.

> Kind Regards,
> Renee
>
> P.S.: DBI is a great module! You did a great work!

Thanks.

Tim.

p.s. Please send emails to dbi-users@xxxxxxxx
.



Relevant Pages

  • Re: problem with DBD::ODBC and placeholders [SEC=UNCLASSIFIED]
    ... I cannot see in the DBI pod anything which says this should work. ... Drivers that support named placeholders like ":N" where N is an integer, ... Driver docs should clarify this issue. ...
    (perl.dbi.users)
  • RE: MSSQL 2000, ODBC, and placeholders
    ... but...I suspect your SQL*Server driver is ancient. ... If that doesn't work, I would turn on DBI tracing to a low level. ... When I attempt to use placeholders in my script, ... > sub parseLine($) ...
    (perl.dbi.users)
  • Re: Problem with bind_param using DBD::mysql
    ... I would be glad to give you a version of it to try out, and I think it may deal with your problem better than the current driver the new driver uses the database to handle placeholders. ... emulated placeholders either optionally or when talking to old servers. ... With a server> 4.1.3, one sets 'mysql_server_prepare=1' in the DSN to enable it, and without it, it defaults to old behaviour. ...
    (perl.dbi.users)
  • Re: Problem with bind_param using DBD::mysql
    ... There is a version of DBD::mysql that does support placeholders in the server, via CVS (or I can package it and send it to you). ... I would be glad to give you a version of it to try out, and I think it may deal with your problem better than the current driver the new driver uses the database to handle placeholders. ...
    (perl.dbi.users)
  • Re: Problem with bind_param using DBD::mysql
    ... > placeholders in the server, via CVS (or I can package it and send it ... still could be easily improved with a one-line code change. ... emulated placeholders either optionally or when talking to old ...
    (perl.dbi.users)