use strict; use warnings; use RDBO::QUEUE; my $db = RDBO::RDBO->init_db; my $going = 1; while($going) { my $queued_ids = Rose::DB::Object::Manager->get_objects_from_s +ql( object_class => 'RDBO::QUEUE', sql => 'SELECT id FROM queue WHERE flag=\'F\ ORDER BY +id ASC where ROWNUM< 50', db => $db ); my @ids2process; foreach my $num (@{$queued_ids}) { push(@ids2process, $num->{'id'}); } if(!scalar(@ids2process)) { sleep(5); } if(scalar(@ids2process) > 0 ) { $db->begin_work; my $count=0; foreach my $ids (@ids2process){ $count++; my $ret = HandleIds($id); next if($ret == -1); eval{ my $q_rec = RDBO::QUEUE->new(id => $id, db => $db); $q_rec->load; $q_rec->flag('T'); $q_rec->save; }; if($@) { print "Unable to update record for $id";} else { print "Updated record for $id";} if(($count % 25 == 0) || ($count == scalar(@ids2process))) { $db->commit; print "COMMIT at $count IDs"; } } }else { sleep(5); } }
In reply to Re: db commit is not happening properly with Rose::DB
by shree
in thread db commit is not happening properly with Rose::DB
by shree
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |