[Bast-commits] r7362 - DBIx-Class/0.08/branches/prefetch/lib/DBIx/Class

mo at dev.catalyst.perl.org mo at dev.catalyst.perl.org
Fri Aug 21 13:47:24 GMT 2009


Author: mo
Date: 2009-08-21 13:47:23 +0000 (Fri, 21 Aug 2009)
New Revision: 7362

Modified:
   DBIx-Class/0.08/branches/prefetch/lib/DBIx/Class/ResultSet.pm
Log:
fixed _collapse_result for M -> 1 -> M + M

Modified: DBIx-Class/0.08/branches/prefetch/lib/DBIx/Class/ResultSet.pm
===================================================================
--- DBIx-Class/0.08/branches/prefetch/lib/DBIx/Class/ResultSet.pm	2009-08-21 12:19:41 UTC (rev 7361)
+++ DBIx-Class/0.08/branches/prefetch/lib/DBIx/Class/ResultSet.pm	2009-08-21 13:47:23 UTC (rev 7362)
@@ -1034,7 +1034,7 @@
     foreach my $seen (@$rows) {
         my $match = 1;
         foreach my $column ( keys %$columns ) {
-            if ( defined $columns->{$column}
+            if ( defined $columns->{$column} # TODO: XOR!
                 && $seen->[0]->{$column} ne $columns->{$column} )
             {
                 $match = 0;
@@ -1049,14 +1049,15 @@
     if ($found) {
         foreach my $rel ( keys %$rels ) {
             my $old_rows = $found->[1]->{$rel};
-            if ( ref $rels->{$rel}->[0] eq 'HASH' ) {
-                $self->_merge_result( [ $found->[1]->{$rel} ],
-                    [ $rels->{$rel}->[0] ] );
-            }
-            else {
-                $self->_merge_result( $found->[1]->{$rel}, $rels->{$rel}->[0] );
-            }
+            $self->_merge_result(
+                ref $found->[1]->{$rel}->[0] eq 'HASH' ? [ $found->[1]->{$rel} ]
+                : $found->[1]->{$rel},
+                ref $rels->{$rel}->[0] eq 'HASH' ? [ $rels->{$rel}->[0], $rels->{$rel}->[1] ]
+                : $rels->{$rel}->[0]
+            );
+
         }
+
     }
     else {
         push( @$rows, $row );




More information about the Bast-commits mailing list