From: Daniel Westermann-Clark Date: Fri, 7 Jul 2006 04:07:24 +0000 (+0000) Subject: _is_unique_query: Don't warn on multiple occurrences of the same value for a constrai... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=98ba74b42c19f817bd58641a018b4bd1320d66cf;p=dbsrgits%2FDBIx-Class-Historic.git _is_unique_query: Don't warn on multiple occurrences of the same value for a constrained column --- diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index 4132d5f..4f5f722 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -520,7 +520,7 @@ sub _is_unique_query { foreach my $key (keys %$collapsed) { my $aliased = $key =~ /\./ ? $key : "$alias.$key"; next unless exists $seen{$aliased}; # Additional constraints are okay - $seen{$aliased} = scalar @{ $collapsed->{$key} }; + $seen{$aliased} = scalar keys %{ $collapsed->{$key} }; } # If we get 0 or more than 1 value for a column, it's not necessarily unique @@ -556,7 +556,8 @@ sub _collapse_query { else { # warn "LEAF: " . Dumper $query; foreach my $key (keys %$query) { - push @{$collapsed->{$key}}, $query->{$key}; + my $value = $query->{$key}; + $collapsed->{$key}{$value}++; } } }