switch to hashref based for command args and results
[dbsrgits/DBIx-Data-Store-old.git] / lib / DBIx / Data / Store / Command / Row.pm
index 8ae3749..402b616 100644 (file)
@@ -4,16 +4,16 @@ use Moose;
 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';