Permalink
Browse files

ordering join ops, longest ops first

  • Loading branch information...
1 parent 801655c commit cc9c9606e4395427f5d79bc6c96e303da6e7251e Laurent Dami committed Nov 30, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/SQL/Abstract/More.pm
View
@@ -157,10 +157,12 @@ sub new {
ref $self->{limit_offset} or $self->_choose_LIMIT_OFFSET_dialect;
# regex for parsing join specifications
- my $join_ops = join '|', map quotemeta, keys %{$self->{join_syntax}};
+ my @join_ops = sort {length($b) <=> length($a) || $a cmp $b}
+ keys %{$self->{join_syntax}};
+ my $joined_ops = join '|', map quotemeta, @join_ops;
$self->{join_regex} = qr[
^ # initial anchor
- ($join_ops)? # $1: join operator (i.e. '<=>', '=>', etc.))
+ ($joined_ops)? # $1: join operator (i.e. '<=>', '=>', etc.))
([[{])? # $2: opening '[' or '{'
(.*?) # $3: content of brackets
[]}]? # closing ']' or '}'

0 comments on commit cc9c960

Please sign in to comment.