Commit | Line | Data |
65b76960 |
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 | |
3347c67e |
8 | has '_column_order' => (is => 'ro', required => 1, init_arg => 'column_order'); |
9 | |
65b76960 |
10 | method 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 | |
26 | 1; |