From: Matt S Trout Date: Fri, 15 Feb 2019 21:53:13 +0000 (+0000) Subject: _order_by_chunks fuckery to help DBIC not confuse itself X-Git-Tag: v2.000000~3^2~427 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1b6f53d4b6d41fec85ce17e574c49df28022c760;p=dbsrgits%2FSQL-Abstract.git _order_by_chunks fuckery to help DBIC not confuse itself --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index 6b71a2c..54b241d 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -1105,15 +1105,22 @@ sub _order_by { return wantarray ? ($final_sql, @bind) : $final_sql; } +# _order_by no longer needs to call this so doesn't but DBIC uses it. + sub _order_by_chunks { my ($self, $arg) = @_; return () unless defined(my $expanded = $self->_expand_order_by($arg)); + return $self->_chunkify_order_by($expanded); +} + +sub _chunkify_order_by { + my ($self, $expanded) = @_; for ($expanded) { if (ref() eq 'HASH' and my $op = $_->{-op}) { if ($op->[0] eq ',') { - return map [ $self->_render_expr($_) ], @{$op}[1..$#$op]; + return map $self->_chunkify_order_by($_), @{$op}[1..$#$op]; } } return [ $self->_render_expr($_) ];