Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I am new to perl and trying to get to grips with the dbi. Is this the correct way to prepare an insert statement outside a while loop for speed?
thanks a lotmy $insert_snp_sql = "insert into $tableName (Chr, Pos_start, Pos_end, + id, reference, genotype) values (?,?,?,?,?,?)"; my $sth = $db->prepare ($insert_snp_sql); while(<INFH>){ #process input line and then insert to database if ($sth->execute($data[0],$data[1],$data[2], $data[3], $data[ +4],$data[5])) { #insert ok } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: prepare insert statement outside while loop for speed
by JavaFan (Canon) on Dec 01, 2010 at 20:34 UTC | |
by Anonymous Monk on Dec 01, 2010 at 20:46 UTC | |
|
Re: prepare insert statement outside while loop for speed
by McDarren (Abbot) on Dec 02, 2010 at 05:19 UTC |