Tim Bunce wrote:
On Tue, Sep 26, 2006 at 11:02:00AM -0700, Dean Arnold wrote:

My driver specific version is a stmt handle attribute that
supplies an arrayref of [ $tupleincr, $callback ], where
$tupleincr is the minimum number of tuples between invoking $callback,
and $callback is just s CODE ref that gets called with the
current number of tuples sent.

E.g.,

$sth->execute_array({
        ArrayTupleStatus => [EMAIL PROTECTED],
        ArrayTupleFetch => $sth,
        ArrayProgress => [ 100, \&report_progress ]
});

sub report_progress {
        my $tuples = shift;
        print "\r Sent $tuples...";
}

Would this be a useful addition to the API, or just more code clutter ?

Umm. Doesn't really seem worth it when it's easy to do via
ArrayTupleFetch. Something like:

  $sth->execute_array({
        ArrayTupleStatus => [EMAIL PROTECTED],
        ArrayTupleFetch => sub {
            report_progress($fetch_count) if ++$fetch_count % 100 == 0;
            return $sth->fetchrow_arrayref;
        },
  });

(If you pass ArrayTupleFetch as an sth then execute_array just turns it
into a closure anyway, so there's no extra cost there.)

Tim.


OK. I was on the fence about it myself, but thought it worth mentioning.

- Dean

Reply via email to