[Bast-commits] r5754 - DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class

arcanez at dev.catalyst.perl.org arcanez at dev.catalyst.perl.org
Fri Mar 13 19:02:58 GMT 2009


Author: arcanez
Date: 2009-03-13 19:02:58 +0000 (Fri, 13 Mar 2009)
New Revision: 5754

Modified:
   DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/ResultSet.pm
Log:
auto-add relations if they are used in the where but not in join

Modified: DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/ResultSet.pm
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/ResultSet.pm	2009-03-13 12:32:35 UTC (rev 5753)
+++ DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/ResultSet.pm	2009-03-13 19:02:58 UTC (rev 5754)
@@ -313,6 +313,11 @@
     : undef
   );
 
+  foreach my $key (keys %$cond) {
+    next unless my ($alias) = ($key =~ /^(\w+)\.\w+$/);
+    push @{$new_attrs->{join}}, $alias unless grep(/${alias}/, @{$new_attrs->{join}}) or $alias eq 'me';
+  }
+
   if (defined $where) {
     $new_attrs->{where} = (
       defined $new_attrs->{where}




More information about the Bast-commits mailing list