Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have a loop to create a database record from each line read in from a text file. I wanted to make sure the code will continue with the rest of the inserts if there is an error in one of the inserts but I'm not sure if I have done this right. I've just replaced the code of the outer loop with pseudocode.
thanks for your helpmy $dbh = DBI->connect("DBI:mysql:database=$sql_database;host=$sql_hos +t;port=$sql_port", $username, $password,{'RaiseError' => 1}); loop { unless ($dbh->do($insertstr, undef, $slice->seq_region_name(), $vf->st +art $vf->variation_name(), $vf->allele_string() )) { print INSERTLOG "failed to insert", , "\n"; } #end unless }#end loop
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: beginner - looping to insert a set of database records
by kennethk (Abbot) on Nov 12, 2010 at 16:29 UTC | |
by Anonymous Monk on Nov 12, 2010 at 23:12 UTC | |
|
Re: beginner - looping to insert a set of database records
by Anonymous Monk on Nov 12, 2010 at 16:22 UTC |