sub next {
my $self = shift;
+
+ # using cursor so we don't inflate anything
my ($row) = $self->_resultset->cursor->next;
+
return $row;
}
sub all {
my $self = shift;
+
+ # using cursor so we don't inflate anything
return map { $_->[0] } $self->_resultset->cursor->all;
}
sub reset {
my $self = shift;
$self->_resultset->cursor->reset;
- return undef;
+ return $self;
}
=head2 first
sub first {
my $self = shift;
- $self->_resultset->reset();
+
+ # using cursor so we don't inflate anything
+ $self->_resultset->cursor->reset;
my ($row) = $self->_resultset->cursor->next;
+
return $row;
}
#
# Returns the underlying resultset. Creates it from the parent resultset if
# necessary.
-#
+#
sub _resultset {
my $self = shift;
my $schema = DBICTest->init_schema();
-plan tests => 21;
-
my $rs = $schema->resultset("CD")->search({}, { order_by => 'cdid' });
my $rs_title = $rs->get_column('title');
cmp_ok($rs_year->sum, '==', 9996, "three artists returned");
-my $reset_ret = $rs_year->reset;
+$rs_year->reset;
is($rs_year->next, 1999, "reset okay");
-is($reset_ret, undef, 'reset returns undef');
is($rs_year->first, 1999, "first okay");
[ $rs->get_column ('cdid')->all ],
'prefetch properly collapses amount of rows from get_column',
);
+
+done_testing;