use Carp qw(carp);
use Method::Signatures::Simple;
+has 'column_order' => (is => 'ro', required => 1);
+
method execute {
- my $sth = $self->_new_active_sth;
- my @row = $sth->fetchrow_array;
- my @nextrow = $sth->fetchrow_array if @row;
- if(@row && @nextrow) {
+ my $result = (my $stream = DBIx::Data::Stream::STH->new(
+ sth => $self->_new_active_sth, column_order => $self->column_order,
+ ))->next;
+ if ($stream->next) {
carp "Query returned more than one row - did you want a stream command?";
}
- # Need to call finish() to work round broken DBDs
- $sth->finish();
- return \@row;
+ return $result;
}
with 'DBIx::Data::Store::Command';