From: Peter Rabbitson Date: Tue, 22 Sep 2015 01:48:42 +0000 (+0200) Subject: Scanning strings piecemeal makes no sense - join them up X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=753fd57acd6f2a68a3e2a748a0ee44c1f94be401;p=dbsrgits%2FDBIx-Class-Historic.git Scanning strings piecemeal makes no sense - join them up Read under -w --- diff --git a/lib/DBIx/Class/Storage/DBIHacks.pm b/lib/DBIx/Class/Storage/DBIHacks.pm index 15fc553..937f771 100644 --- a/lib/DBIx/Class/Storage/DBIHacks.pm +++ b/lib/DBIx/Class/Storage/DBIHacks.pm @@ -480,6 +480,10 @@ sub _resolve_aliastypes_from_select_args { } } + # we will be bulk-scanning anyway - pieces will not matter in that case + # (unlike in the direct-equivalence above) + my $scan_string = join ' ', @{$to_scan->{$type}}; + # now loop through all fully qualified columns and get the corresponding # alias (should work even if they are in scalarrefs) for my $alias (keys %$alias_list) { @@ -489,12 +493,10 @@ sub _resolve_aliastypes_from_select_args { \b $alias \. ([^\s\)\($rquote]+)? /x; - for my $piece (@{$to_scan->{$type}}) { - if (my @matches = $piece =~ /$al_re/g) { - $aliases_by_type->{$type}{$alias} ||= { -parents => $alias_list->{$alias}{-join_path}||[] }; - $aliases_by_type->{$type}{$alias}{-seen_columns}{"$alias.$_"} = "$alias.$_" - for grep { defined $_ } @matches; - } + if (my @matches = $scan_string =~ /$al_re/g) { + $aliases_by_type->{$type}{$alias} ||= { -parents => $alias_list->{$alias}{-join_path}||[] }; + $aliases_by_type->{$type}{$alias}{-seen_columns}{"$alias.$_"} = "$alias.$_" + for grep { defined $_ } @matches; } } @@ -505,13 +507,11 @@ sub _resolve_aliastypes_from_select_args { my $col_re = qr/ $lquote ($col) $rquote /x; - for my $piece (@{$to_scan->{$type}}) { - if ( my @matches = $piece =~ /$col_re/g) { - my $alias = $colinfo->{$col}{-source_alias}; - $aliases_by_type->{$type}{$alias} ||= { -parents => $alias_list->{$alias}{-join_path}||[] }; - $aliases_by_type->{$type}{$alias}{-seen_columns}{"$alias.$_"} = $_ - for grep { defined $_ } @matches; - } + if ( my @matches = $scan_string =~ /$col_re/g) { + my $alias = $colinfo->{$col}{-source_alias}; + $aliases_by_type->{$type}{$alias} ||= { -parents => $alias_list->{$alias}{-join_path}||[] }; + $aliases_by_type->{$type}{$alias}{-seen_columns}{"$alias.$_"} = $_ + for grep { defined $_ } @matches; } } }