From: Rob Kinyon Date: Thu, 19 Mar 2009 20:52:54 +0000 (+0000) Subject: Commit another fix for arcanez to test X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7210819b8f016895c33b397c01ff13e5a746c172;p=dbsrgits%2FDBIx-Class-Historic.git Commit another fix for arcanez to test --- diff --git a/lib/DBIx/Class/CDBICompat/Retrieve.pm b/lib/DBIx/Class/CDBICompat/Retrieve.pm index b2e891d..564583a 100644 --- a/lib/DBIx/Class/CDBICompat/Retrieve.pm +++ b/lib/DBIx/Class/CDBICompat/Retrieve.pm @@ -50,15 +50,24 @@ sub retrieve_from_sql { $cond =~ s/^\s*WHERE//i; - if( $cond =~ s/\bLIMIT (\d+)\s*$//i ) { - push @rest, { rows => $1 }; + # Need to parse the SQL clauses after WHERE in reverse + # order of appearance. + + my %attrs; + + if( $cond =~ s/\bLIMIT\s+(\d+)\s*$//i ) { + $attrs{rows} = $1; + } + + if ( $cond =~ s/\bORDER\s+BY\s+(.*)\s*$//i ) { + $attrs{order_by} = $1; } - if ( $cond =~ s/\bORDER\s+BY\s+(.*)$//i ) { - push @rest, { order_by => $1 }; + if( $cond =~ s/\bGROUP\s+BY\s+(.*)\s*$//i ) { + $attrs{group_by} = $1; } - return $class->search_literal($cond, @rest); + return $class->search_literal($cond, ( %attrs || () ) ); } sub construct {