There is an attribute {Statement} already which does this.  As far as
placeholders, you never know, since they are not bound till later in the
process.  You can use trace() to figure out what is being bound.

Ilya

-----Original Message-----
From: Ido Trivizki
To: [EMAIL PROTECTED]
Sent: 4/3/02 6:52 PM
Subject: as_string

I would like to suggest an as_string function that would work like:
$sth=$dbh->prepare('SELECT foo FROM bar WHERE baz=?');
$sth->as_string('blah');

Will print:

SELECT foo FROM bar WHERE baz='blah'

And maybe even:
$dbh->as_string('DELETE FROM foo WHERE bar=?',undef,"can't");

Which should usually print:

DELETE FROM foo WHERE bar='can''t'

I think such a method can be very helpful for debugging. Right now I
simply copy the ->do line and change it to sprintf with %s's..

Thanks.
Ido.



Reply via email to