DBIx-BatchChunker

 view release on metacpan or  search on metacpan

t/dbic.t  view on Meta::CPAN

            $max_end   = max($max_end, $ls->end);
            $max_range = max($max_range, $range);

            note explain $ls if $BATCHCHUNK_TEST_DEBUG;
        },

        min_chunk_percent => 0.01,
        verbose           => 0,
    );

    # DBI callbacks here are the only good way to interfere with COUNT statements
    my $dbh = $batch_chunker->dbic_storage->dbh;
    $dbh->{Callbacks} = {
        ChildCallbacks => {
            execute => sub {
                my ($sth, $start, $end) = @_;
                if ($sth->{Statement} =~ /COUNT/) {
                    my $ls    = $batch_chunker->loop_state || return;
                    my $range = $ls->end - $ls->start + 1;

                    # maximum of $CHUNK_SIZE-1 IDs here



( run in 0.425 second using v1.01-cache-2.11-cpan-9b1e4054eb1 )