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