From: Rob Kinyon Date: Thu, 19 Mar 2009 20:35:37 +0000 (+0000) Subject: Moved some SQL parsing of ORDER BY from _select_args() to retrieve_from_sql() where... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e2bdf48529d8b9d772e50e490657297382f8d093;p=dbsrgits%2FDBIx-Class-Historic.git Moved some SQL parsing of ORDER BY from _select_args() to retrieve_from_sql() where it belongs --- diff --git a/lib/DBIx/Class/CDBICompat/Retrieve.pm b/lib/DBIx/Class/CDBICompat/Retrieve.pm index 4c36887..b2e891d 100644 --- a/lib/DBIx/Class/CDBICompat/Retrieve.pm +++ b/lib/DBIx/Class/CDBICompat/Retrieve.pm @@ -54,6 +54,10 @@ sub retrieve_from_sql { push @rest, { rows => $1 }; } + if ( $cond =~ s/\bORDER\s+BY\s+(.*)$//i ) { + push @rest, { order_by => $1 }; + } + return $class->search_literal($cond, @rest); } diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 4bfa2e8..f51a850 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -1384,14 +1384,6 @@ sub _select_args { my ($self, $ident, $select, $condition, $attrs) = @_; my $order = $attrs->{order_by}; - if (ref $condition eq 'SCALAR') { - my $unwrap = ${$condition}; - if ($unwrap =~ s/ORDER BY (.*)$//i) { - $order = $1; - $condition = \$unwrap; - } - } - my $for = delete $attrs->{for}; my $sql_maker = $self->sql_maker; $sql_maker->{for} = $for;