From: Aran Deltac Date: Thu, 10 Sep 2009 17:03:21 +0000 (+0000) Subject: Fix RSC->reset() to no longer return $self, which fixes Cursor::Cached + RSC. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=01dc6781d8cbc3466dd7ed15eb26999b0a91759a;p=dbsrgits%2FDBIx-Class-Historic.git Fix RSC->reset() to no longer return $self, which fixes Cursor::Cached + RSC. --- diff --git a/Changes b/Changes index a5d4473..efbb38c 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,9 @@ Revision history for DBIx::Class + - Change ResultSetColumn->reset() to no longer return $self, which + fixes an issue with using Cursor::Cached and ResultSetColumn + together. + 0.08111 2009-09-06 21:58:00 (UTC) - The hashref to connection_info now accepts a 'dbh_maker' coderef, allowing better intergration with Catalyst diff --git a/lib/DBIx/Class/ResultSetColumn.pm b/lib/DBIx/Class/ResultSetColumn.pm index 4f48d33..4d0587a 100644 --- a/lib/DBIx/Class/ResultSetColumn.pm +++ b/lib/DBIx/Class/ResultSetColumn.pm @@ -172,7 +172,7 @@ Much like L. sub reset { my $self = shift; $self->_resultset->cursor->reset; - return $self; + return undef; } =head2 first @@ -194,7 +194,8 @@ Much like L but just returning the one value. sub first { my $self = shift; - my ($row) = $self->_resultset->cursor->reset->next; + $self->_resultset->reset(); + my ($row) = $self->_resultset->cursor->next; return $row; } diff --git a/t/88result_set_column.t b/t/88result_set_column.t index aac98dc..066d4ee 100644 --- a/t/88result_set_column.t +++ b/t/88result_set_column.t @@ -8,7 +8,7 @@ use DBICTest; my $schema = DBICTest->init_schema(); -plan tests => 20; +plan tests => 21; my $rs = $schema->resultset("CD")->search({}, { order_by => 'cdid' }); @@ -28,8 +28,9 @@ is($rs_title->min, 'Caterwaulin\' Blues', "min okay for title"); cmp_ok($rs_year->sum, '==', 9996, "three artists returned"); -$rs_year->reset; +my $reset_ret = $rs_year->reset; is($rs_year->next, 1999, "reset okay"); +is($reset_ret, undef, 'reset returns undef'); is($rs_year->first, 1999, "first okay");