initial basic collection test
[dbsrgits/DBIx-Data-Store-old.git] / lib / DBIx / Data / Stream / STH.pm
1 package DBIx::Data::Stream::STH;
2
3 use Moose;
4 use Method::Signatures::Simple;
5
6 has 'sth' => (is => 'ro', required => 1, clearer => '_clear_sth');
7
8 method next {
9   my $sth = $self->sth;
10   return unless $sth;
11   # {Active} only means that there *may* be more results to fetch
12   if ($sth->{Active} and my @next = $self->sth->fetchrow_array) {
13     return \@next;
14   }
15   $sth->finish;
16   # prepare_cached might recycle it now we're finished so get rid of it
17   $self->_clear_sth;
18   return;
19 }
20
21 __PACKAGE__->meta->make_immutable;
22
23 1;