From: Peter Rabbitson Date: Tue, 12 Feb 2013 11:27:10 +0000 (+0100) Subject: Switch the cursor iterator to pull data via bind_columns X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=544671d4f9d1c3d22188866ec5d9c6a6862b5659;p=dbsrgits%2FDBIx-Class-Historic.git Switch the cursor iterator to pull data via bind_columns While this does not help us irectly in any way (we still copy by value like there is no tomorrow) - it will help with the software_limit fast-forwards --- diff --git a/lib/DBIx/Class/Storage/DBI/Cursor.pm b/lib/DBIx/Class/Storage/DBI/Cursor.pm index 6483ca7..a8f087d 100644 --- a/lib/DBIx/Class/Storage/DBI/Cursor.pm +++ b/lib/DBIx/Class/Storage/DBI/Cursor.pm @@ -113,9 +113,11 @@ sub next { return; } - unless ($sth = $self->sth) { - (undef, $sth) = $self->storage->_select( @{$self->{args}} ); + (undef, $sth, undef) = $self->storage->_select( @{$self->{args}} ); + + $self->{_results} = [ (undef) x $sth->FETCH('NUM_OF_FIELDS') ]; + $sth->bind_columns( \( @{$self->{_results}} ) ); if ( $self->{attrs}{software_limit} and $self->{attrs}{offset} ) { $sth->fetch for 1 .. $self->{attrs}{offset}; @@ -124,14 +126,13 @@ sub next { $self->sth($sth); } - my $row = $sth->fetchrow_arrayref; - if ($row) { + if ($sth->fetch) { $self->{_pos}++; + return @{$self->{_results}}; } else { $self->{_done} = 1; + return (); } - - return @{$row||[]}; }