[Bast-commits] r7623 - in DBIx-Class/0.08/trunk: lib/DBIx/Class
lib/DBIx/Class/Storage/DBI t
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Thu Sep 10 17:32:04 GMT 2009
Author: ribasushi
Date: 2009-09-10 17:32:03 +0000 (Thu, 10 Sep 2009)
New Revision: 7623
Modified:
DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSetColumn.pm
DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Cursor.pm
DBIx-Class/0.08/trunk/t/88result_set_column.t
Log:
The real fix
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSetColumn.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSetColumn.pm 2009-09-10 17:03:21 UTC (rev 7622)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSetColumn.pm 2009-09-10 17:32:03 UTC (rev 7623)
@@ -125,7 +125,10 @@
sub next {
my $self = shift;
+
+ # using cursor so we don't inflate anything
my ($row) = $self->_resultset->cursor->next;
+
return $row;
}
@@ -149,6 +152,8 @@
sub all {
my $self = shift;
+
+ # using cursor so we don't inflate anything
return map { $_->[0] } $self->_resultset->cursor->all;
}
@@ -172,7 +177,7 @@
sub reset {
my $self = shift;
$self->_resultset->cursor->reset;
- return undef;
+ return $self;
}
=head2 first
@@ -194,8 +199,11 @@
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;
}
@@ -396,7 +404,7 @@
#
# Returns the underlying resultset. Creates it from the parent resultset if
# necessary.
-#
+#
sub _resultset {
my $self = shift;
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Cursor.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Cursor.pm 2009-09-10 17:03:21 UTC (rev 7622)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Cursor.pm 2009-09-10 17:32:03 UTC (rev 7623)
@@ -148,6 +148,7 @@
# No need to care about failures here
eval { $self->{sth}->finish if $self->{sth} && $self->{sth}->{Active} };
$self->_soft_reset;
+ return undef;
}
sub _soft_reset {
@@ -156,7 +157,6 @@
delete $self->{sth};
delete $self->{done};
$self->{pos} = 0;
- return $self;
}
sub _check_dbh_gen {
Modified: DBIx-Class/0.08/trunk/t/88result_set_column.t
===================================================================
--- DBIx-Class/0.08/trunk/t/88result_set_column.t 2009-09-10 17:03:21 UTC (rev 7622)
+++ DBIx-Class/0.08/trunk/t/88result_set_column.t 2009-09-10 17:32:03 UTC (rev 7623)
@@ -8,8 +8,6 @@
my $schema = DBICTest->init_schema();
-plan tests => 21;
-
my $rs = $schema->resultset("CD")->search({}, { order_by => 'cdid' });
my $rs_title = $rs->get_column('title');
@@ -28,9 +26,8 @@
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");
@@ -95,3 +92,5 @@
[ $rs->get_column ('cdid')->all ],
'prefetch properly collapses amount of rows from get_column',
);
+
+done_testing;
More information about the Bast-commits
mailing list