From: Matt S Trout Date: Wed, 19 Apr 2006 16:06:59 +0000 (+0000) Subject: fixup for search w/no args and cache X-Git-Tag: v0.06002~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=765f5b7bf5a2a81b8503968a6f85e21eaa78282e;p=dbsrgits%2FDBIx-Class.git fixup for search w/no args and cache --- diff --git a/Changes b/Changes index 73f8dd6..f7e9380 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,7 @@ Revision history for DBIx::Class 0.06002 + - fix to ->search without args to clone rs but maintain cache - grab $self->dbh once per function in Storage::DBI - nuke ResultSource caching of ->resultset for consistency reasons - fix for -and conditions when updating or deleting on a ResultSet diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index 6eca5fe..feb8232 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -226,9 +226,11 @@ sub search { my $rs = (ref $self)->new($self->result_source, $attrs); - my $rows = $self->get_cache; - if( @{$rows} ) { - $rs->set_cache($rows); + unless (@_) { # no search, effectively just a clone + my $rows = $self->get_cache; + if( @{$rows} ) { + $rs->set_cache($rows); + } } return (wantarray ? $rs->all : $rs);