X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FCursor.pm;h=3d59e84a04bd6b522de93e4d46cf86007f52d069;hb=f2b70f86c9c44eb3367bd2d4d629f7e201032652;hp=e46c1b6ca601262e2908070c22355569d70cb91c;hpb=4aeeed8aba0096f1272b29d9dc794714201f232c;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Storage/DBI/Cursor.pm b/lib/DBIx/Class/Storage/DBI/Cursor.pm index e46c1b6..3d59e84 100644 --- a/lib/DBIx/Class/Storage/DBI/Cursor.pm +++ b/lib/DBIx/Class/Storage/DBI/Cursor.pm @@ -1,10 +1,10 @@ package DBIx::Class::Storage::DBI::Cursor; -use base qw/DBIx::Class::Cursor/; - use strict; use warnings; +use base qw/DBIx::Class::Cursor/; + =head1 NAME DBIx::Class::Storage::DBI::Cursor - Object representing a query cursor on a @@ -36,8 +36,8 @@ Returns a new L object. sub new { my ($class, $storage, $args, $attrs) = @_; - #use Data::Dumper; warn Dumper(@_); $class = ref $class if ref $class; + my $new = { storage => $storage, args => $args, @@ -68,7 +68,11 @@ sub _dbh_next { my ($storage, $dbh, $self) = @_; $self->_check_dbh_gen; - if ($self->{attrs}{rows} && $self->{pos} >= $self->{attrs}{rows}) { + if ( + $self->{attrs}{software_limit} + && $self->{attrs}{rows} + && $self->{pos} >= $self->{attrs}{rows} + ) { $self->{sth}->finish if $self->{sth}->{Active}; delete $self->{sth}; $self->{done} = 1; @@ -124,7 +128,11 @@ sub _dbh_all { sub all { my ($self) = @_; - return $self->SUPER::all if $self->{attrs}{rows}; + if ($self->{attrs}{software_limit} + && ($self->{attrs}{offset} || $self->{attrs}{rows})) { + return $self->next::method; + } + $self->{storage}->dbh_do($self->can('_dbh_all'), $self); } @@ -164,6 +172,7 @@ sub DESTROY { my ($self) = @_; # None of the reasons this would die matter if we're in DESTROY anyways + local $@; eval { $self->{sth}->finish if $self->{sth} && $self->{sth}->{Active} }; }