While testing my execute_array() implementation, I've added
something that might be generally useful: a progress-report
callback. I realize that ArrayTupleFetch might be adapted
to provide the concept with a bit more coding in the app, but
if all the app is doing is either dumping a file to the DBMS,
or using a $sth to supply the data, it might be useful to have
a "ArrayProgress" parameter that gets called occasionally.

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 ?

- Dean

Reply via email to