in reply to Re^2: DBI - Table names & placeholders
in thread DBI - Table names & placeholders
The bottom loop should be
orfor (@$sales_inserts) { my $table = shift(@$_); my $sth = $dbh->prepare(' INSERT INTO '.$dbh->quote_identifier($table).' ( ItemID, Day, Revenue, Count ) VALUES ( ?, ?, ?, ? ) '); $sth->execute(@$_); }
my %sth_cache; for (@$sales_inserts) { my $table = shift(@$_); my $sth = $sth_cache{$table} ||= $dbh->prepare(' INSERT INTO '.$dbh->quote_identifier($table).' ( ItemID, Day, Revenue, Count ) VALUES ( ?, ?, ?, ? ) '); $sth->execute(@$_); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: DBI - Table names & placeholders
by McDarren (Abbot) on Apr 26, 2010 at 06:24 UTC | |
by ikegami (Patriarch) on Apr 26, 2010 at 07:08 UTC | |
by McDarren (Abbot) on Apr 26, 2010 at 11:13 UTC | |
by ikegami (Patriarch) on Apr 26, 2010 at 16:04 UTC | |
by McDarren (Abbot) on Apr 27, 2010 at 15:41 UTC |