Permalink
Browse files

最後にマッチするのはこっちの方がイケてた!

  • Loading branch information...
1 parent 056a0b0 commit d09901ef49de057de3411ad4fb58cfda4bee934c @ken39arg committed Nov 27, 2012
Showing with 4 additions and 5 deletions.
  1. +4 −5 lib/MySQL/Sharding/Client.pm
@@ -221,10 +221,9 @@ sub _parse_columns {
sub _parse_group {
my ($self, $sql) = @_;
- my $f = 0;
- $f = 1 while ($sql =~ m/GROUP +BY +([^\)]+?) *(HAVING|UNION|ORDER|LIMIT|$)[\)]*/gi);
-
- return undef unless $f;
+ unless ($sql =~ m/.*GROUP +BY +([^\)]+?) *(HAVING|UNION|ORDER|LIMIT|$)[\)]*/i) {
+ return undef;
+ }
my @group;
foreach my $column (split / *, */, $1) {
@@ -235,7 +234,7 @@ sub _parse_group {
sub _parse_order {
my ($self, $sql) = @_;
- unless ($sql =~ m/ORDER +BY +(.+?) *(LIMIT|$)/i) {
+ unless ($sql =~ m/.*ORDER +BY +(.+?) *(LIMIT|$)/i) {
return undef;
}

0 comments on commit d09901e

Please sign in to comment.