From: Matt S Trout Date: Sun, 24 Feb 2019 20:46:29 +0000 (+0000) Subject: catch another weird edge case in _order_by X-Git-Tag: v1.90_01~398 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=13cd9220eb990b43cdc2b0919734f6f834129da0;p=dbsrgits%2FSQL-Abstract.git catch another weird edge case in _order_by --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index 08fcd3e..8745cc4 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -1130,6 +1130,8 @@ sub _order_by { my ($sql, @bind) = $self->_render_expr($expanded); + return '' unless length($sql); + my $final_sql = $self->_sqlcase(' order by ').$sql; return wantarray ? ($final_sql, @bind) : $final_sql; diff --git a/t/06order_by.t b/t/06order_by.t index e3b94f7..0d340ae 100644 --- a/t/06order_by.t +++ b/t/06order_by.t @@ -58,6 +58,11 @@ my @cases = expects => '', expects_quoted => '', }, + { + given => [ {} ], + expects => '', + expects_quoted => '', + }, { given => [{-desc => [ qw/colA colB/ ] }],