in reply to Re: How to Do multiples SQL Insert at one time?
in thread How to Do multiples SQL Insert at one time?
as roboticus points out, it might be better to group the inserts and do a commit let's say every 500 records. you might also check for errors when executing the statement and rollback the transaction when one occursopen(FILE,"logfile.txt")||die; while($line=<FILE>){ ($field1,$field2,$field3)=split(/:/,$line); $sth = $dbh->prepare ('INSERT INTO tablename (fieldname1,fieldname2,fi +eldname3) VALUES(?,?,?)'); $sth->execute ($field1,$field2,$field3); } $sth->finish ();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How to Do multiples SQL Insert at one time?
by Tux (Canon) on Jan 08, 2008 at 07:27 UTC | |
by Juerd (Abbot) on Jan 08, 2008 at 19:54 UTC |