in reply to Re^2: How to Do multiples SQL Insert at one time?
in thread How to Do multiples SQL Insert at one time?

I hope you don't really use code like this. In case to have DBI do bulkloading faster, you should also write faster code. That prepare should be outside the loop

open my $log, "<", $logfile or die "$logfile: $!"; my $sth = $dbh->prepare ("insert into foo values (?,?,?)"; while (<$log>) { chomp; $sth->execute (split m/:/, $_); } $sth->finish; $dbh->commit;

Enjoy, Have FUN! H.Merijn

Replies are listed 'Best First'.
Re^4: How to Do multiples SQL Insert at one time?
by Juerd (Abbot) on Jan 08, 2008 at 19:54 UTC

    Alternatively, let someone else separate preparation and execution!

    use DBIx::Simple; my $db = ...; while (<$log>) { $db->query('INSERT INTO foo VALUES (??)', split /:/); }
    This prepares the query only once.

    Juerd # { site => 'juerd.nl', do_not_use => 'spamtrap', perl6_server => 'feather' }