in reply to Re^2: Perl/SQL syntax error
in thread Perl/SQL syntax error
The idea is to prepare the query once and possibly execute it many times over, just supplying new values for the bind-variables.my $sth = $dbh->prepare(<<sqlend insert into url_connect (sourceIP, dt, tm, remoteIP) values (?, ?, ?, ?) sqlend # and then: $sth->execute($sourceIP, $date, $time, $targetIP); # and again: $sth->execute($sourceIP2, $date2, $time2, $targetIP2);
The overhead of preparing the query on the database-server(parsing the sql, checking persmission, generating data-access paths etc) then just occurs once (and this is essential for scalability on systems like Oracle or DB2).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Perl/SQL syntax error
by patt (Scribe) on Jul 04, 2009 at 13:54 UTC | |
by graff (Chancellor) on Jul 04, 2009 at 14:45 UTC | |
by patt (Scribe) on Jul 05, 2009 at 19:24 UTC | |
|
Re^4: Perl/SQL syntax error
by patt (Scribe) on Jul 04, 2009 at 14:07 UTC | |
by kulls (Hermit) on Jul 07, 2009 at 14:39 UTC |