davies has asked for the wisdom of the Perl Monks concerning the following question:
I have the following code in a subroutine:
my $insert_query = "INSERT INTO $table VALUES ( $layout )"; my $sth = $dbh->prepare($insert_query) or die $DBI::errstr; $sth->execute(@values) or die $DBI::errstr;
The name of the table, the layout and the values are passed in, with the layout containing some constants and some placeholders. One such layout parameter looks like this:"DEFAULT, ?, ?, DEFAULT, DEFAULT". This means that there are lots of places where things can go wrong. And wrong something is certainly going. What I would really like to know is what SQL statement actually gets invoked, for example INSERT INTO data VALUES ( DEFAULT, 1, 2, DEFAULT, DEFAULT ). I've tried googling and going through the DBI documentation, but haven't found any means of getting this printed. Can this be done, and if so, how?
Regards,
John Davies
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Debugging DBI placeholders
by marto (Cardinal) on Feb 04, 2011 at 13:27 UTC | |
by davies (Monsignor) on Feb 04, 2011 at 13:38 UTC | |
|
Re: Debugging DBI placeholders
by Tux (Canon) on Feb 04, 2011 at 13:51 UTC | |
by davies (Monsignor) on Feb 04, 2011 at 14:06 UTC | |
|
Re: Debugging DBI placeholders
by mje (Curate) on Feb 04, 2011 at 15:29 UTC | |
by davies (Monsignor) on Feb 04, 2011 at 16:05 UTC | |
by mje (Curate) on Feb 04, 2011 at 16:16 UTC | |
by VinsWorldcom (Prior) on Feb 04, 2011 at 20:18 UTC | |
by mje (Curate) on Feb 05, 2011 at 12:00 UTC | |
by davies (Monsignor) on Feb 05, 2011 at 13:53 UTC | |
|
Re: Debugging DBI placeholders
by dont_you (Hermit) on Feb 05, 2011 at 21:42 UTC | |
by davies (Monsignor) on Feb 06, 2011 at 10:38 UTC |