The pre-loop code and the first loop iteration need to be in the same transaction. Subsequent loop iterations need to each be their own transaction.lock_db_tables(); # lock tables and/or start a transaction # in a database independent way # some preparation that requires a database lock my $firsttime = 1; foreach my $id (@list_o_object_ids) { lock_db_tables() unless $firsttime; $firsttime = 0; my $obj = new Thingy($id); # gets stuff from db # make changes, save back to db. unlock_tables(); }
"If God had meant for us to think for ourselves he would have given us brains. Oh, wait..."
In reply to Re^2: I need a different continue
by DrWhy
in thread I need a different continue
by DrWhy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |