From: Matt S Trout Date: Wed, 9 Oct 2013 18:36:13 +0000 (+0000) Subject: correctly carry DESC on simple orderings for complex prefetch X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c458ff29e72a4e85c2ef8491e95c4f2b449259cf;p=dbsrgits%2FDBIx-Class.git correctly carry DESC on simple orderings for complex prefetch --- diff --git a/lib/DBIx/Class/Storage/DBIHacks.pm b/lib/DBIx/Class/Storage/DBIHacks.pm index 922f92c..0c4b507 100644 --- a/lib/DBIx/Class/Storage/DBIHacks.pm +++ b/lib/DBIx/Class/Storage/DBIHacks.pm @@ -262,10 +262,10 @@ sub _adjust_select_args_for_complex_prefetch { while (is_Order($order_dq)) { my ($chunk, @args) = $sql_maker->_render_dq($order_dq->{by}); - push @new_order, \[ $chunk, @args ]; - my $is_desc = $order_dq->{reverse}; + push @new_order, \[ $chunk.($is_desc ? ' DESC' : ''), @args ]; + $order_dq = $order_dq->{from}; # skip ourselves