From: Matt S Trout Date: Sat, 7 Oct 2006 00:49:06 +0000 (+0000) Subject: fixup to work round an aliasing bug X-Git-Tag: v0.07003~33 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c6a0dde1edec30bc70565689ae3b978db9677f15;p=dbsrgits%2FDBIx-Class.git fixup to work round an aliasing bug --- diff --git a/Changes b/Changes index 665f9b7..a1ce170 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,7 @@ Revision history for DBIx::Class 0.07003 2006-XX-XX XX:XX:XX - Fix UTF8Columns to work under Perl <= 5.8.0 + - Fix up new_result in ResultSet to avoid alias-related bugs 0.07002 2006-09-14 21:17:32 - fix quote tests for recent versions of SQLite diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index 88c3a0e..6ab3ec0 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -1284,9 +1284,15 @@ sub _collapse_cond { sub _remove_alias { my ($self, $query, $alias) = @_; - my %unaliased = %{ $query || {} }; - foreach my $key (keys %unaliased) { - $unaliased{$1} = delete $unaliased{$key} + my %orig = %{ $query || {} }; + my %unaliased; + + foreach my $key (keys %orig) { + if ($key !~ /\./) { + $unaliased{$key} = $orig{$key}; + next; + } + $unaliased{$1} = $orig{$key} if $key =~ m/^(?:\Q$alias\E\.)?([^.]+)$/; }