Re: Help With Placeholders
- From: Bart Lateur <bart.lateur@xxxxxxxxxx>
- Date: Tue, 05 Jun 2007 21:38:57 GMT
PerlGoon wrote:
The
problem I have is that I need to be able to print the actual queries
my code runs into a log.... with the placeholders replaced.
For example, consider the following:
my $id = "example";
my $sql = "UPDATE Customers SET ID=?";
my $query = $db->prepare($sql);
$query->execute($id);
How do I print the ACTUAL query that was run into a log file.... with
the placeholders replaced???
You can replace each placeholder in the SQL statement with a value
calculated as $dbh->quote($_) for the next bind value.
You might be able to do that by overriding execute and putting the
logging in that method, though I bet it will not be easy: DBI is a very
hard module to subclass.
--
Bart.
.
- Follow-Ups:
- Re: Help With Placeholders
- From: PerlGoon
- Re: Help With Placeholders
- References:
- Help With Placeholders
- From: PerlGoon
- Help With Placeholders
- Prev by Date: Re: Help with Perl operators Please!
- Next by Date: Is it possible to correct word(s) via Perl?Does this kind of modules exist?
- Previous by thread: Re: Help With Placeholders
- Next by thread: Re: Help With Placeholders
- Index(es):
Relevant Pages
|