attrs => $attrs,
}, ref $class || $class;
- weaken( $cursor_registry{ refaddr($self) } = $self )
- if DBIx::Class::_ENV_::HAS_ITHREADS;
+ if (DBIx::Class::_ENV_::HAS_ITHREADS) {
+
+ # quick "garbage collection" pass - prevents the registry
+ # from slowly growing with a bunch of undef-valued keys
+ defined $cursor_registry{$_} or delete $cursor_registry{$_}
+ for keys %cursor_registry;
+
+ weaken( $cursor_registry{ refaddr($self) } = $self )
+ }
return $self;
}
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};
$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||[]};
}