in reply to Re: Queuing DBI transactions
in thread Queuing DBI transactions
You need to save the args too
my @query_queue; sub do_query { my ($sth, @args) = @_; push @query_queue, [ $sth, @args ]; flush_queries(); } sub flush_queries { while (@query_queue) { my ($sth, @args) = @{ $query_queue[0] }; ...[ attempt query ]... if (...[ successful ]...) { shift @query_queue; } else { return; } } return 1; } do_query(...); do_query(...); do_query(...); flush_queries() or die;
Depending on the reconnect code, it might be more advantageous to pass the dbh and the stmt instead of the sth, but you get the idea.
|
|---|