From: Peter Rabbitson Date: Mon, 21 Sep 2015 23:35:29 +0000 (+0200) Subject: Simplify DBIHacks order_by scan generator X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=66bbb12ce3d768107894cd383fb95e360ec21ae3;p=dbsrgits%2FDBIx-Class.git Simplify DBIHacks order_by scan generator There is no need to call out all the way to _extract_order_criteria - we can do the necessary mangling ourselves --- diff --git a/lib/DBIx/Class/Storage/DBIHacks.pm b/lib/DBIx/Class/Storage/DBIHacks.pm index b0dfe43..33698c4 100644 --- a/lib/DBIx/Class/Storage/DBIHacks.pm +++ b/lib/DBIx/Class/Storage/DBIHacks.pm @@ -439,8 +439,12 @@ sub _resolve_aliastypes_from_select_args { { ($sql_maker->_recurse_fields($_))[0] } @{$attrs->{select}} ], - ordering => [ - map { $_->[0] } $self->_extract_order_criteria ($attrs->{order_by}, $sql_maker), + ordering => [ map + { + ( my $sql = (ref $_ ? $_->[0] : $_) ) =~ s/ \s+ (?: ASC | DESC ) \s* \z //xi; + $sql; + } + $sql_maker->_order_by_chunks( $attrs->{order_by} ), ], };