correctly carry DESC on simple orderings for complex prefetch
Matt S Trout [Wed, 9 Oct 2013 18:36:13 +0000 (18:36 +0000)]
lib/DBIx/Class/Storage/DBIHacks.pm

index 922f92c..0c4b507 100644 (file)
@@ -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