Merge 'trunk' into 'DBIx-Class-current'
Matt S Trout [Wed, 19 Apr 2006 22:06:59 +0000 (23:06 +0100)]
r9710@obrien (orig r1490):  matthewt | 2006-04-19 17:06:59 +0100
fixup for search w/no args and cache

Changes
lib/DBIx/Class/ResultSet.pm

diff --git a/Changes b/Changes
index 7d02195..a35712f 100644 (file)
--- a/Changes
+++ b/Changes
@@ -16,6 +16,7 @@ Revision history for DBIx::Class
           ColumnCase is loaded
 
 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
index 56a55d4..2b347ed 100644 (file)
@@ -227,9 +227,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);