Commit | Line | Data |
54bed31b |
1 | package DBIx::Data::Stream::STH; |
2 | |
3 | use strictures 1; |
4 | |
5 | sub new { |
6 | my $proto = shift; |
7 | bless({ %{$_[0]} }, ref($proto)||$proto); |
8 | } |
9 | |
10 | sub _sth { shift->{sth} } |
11 | |
12 | sub _clear_sth { delete shift->{sth} } |
13 | |
14 | sub next { |
15 | my $sth = (my $self = shift)->_sth; |
16 | return unless $sth; |
17 | # {Active} only means that there *may* be more results to fetch |
967a2b04 |
18 | if ($sth->{Active} and my @next = $sth->fetchrow_array) { |
19 | return [ @next ]; |
54bed31b |
20 | } |
21 | $sth->finish; |
22 | # prepare_cached might recycle it now we're finished so get rid of it |
23 | $self->_clear_sth; |
24 | return; |
25 | } |
26 | |
27 | 1; |