From: Peter Rabbitson Date: Fri, 24 Apr 2009 19:53:07 +0000 (+0000) Subject: Make POD more readable, add a (failing) multikey order_by test X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b8b747f7b528f5ca9425d3468acbd7ca62765537;p=scpubgit%2FQ-Branch.git Make POD more readable, add a (failing) multikey order_by test --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index 32481f4..ad8f3a6 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -2086,21 +2086,32 @@ Some functions take an order by clause. This can either be a scalar (just a column name,) a hash of C<< { -desc => 'col' } >> or C<< { -asc => 'col' } >>, or an array of either of the two previous forms. Examples: - Given | Will Generate - ---------------------------------------------------------- + Given | Will Generate + --------------------------------------------------------- + | \'colA DESC' | ORDER BY colA DESC + | 'colA' | ORDER BY colA + | [qw/colA colB/] | ORDER BY colA, colB + | {-asc => 'colA'} | ORDER BY colA ASC + | {-desc => 'colB'} | ORDER BY colB DESC - [ | - {-asc => 'colA'}, | ORDER BY colA ASC, colB DESC + | + [ | ORDER BY colA ASC, colB DESC + {-asc => 'colA'}, | {-desc => 'colB'} | ] | - [colA => {-asc => 'colB'}] | ORDER BY colA, colB ASC + | + ['colA', {-asc => 'colB'}] | ORDER BY colA, colB ASC + | { -asc => [qw/colA colB] } | ORDER BY colA ASC, colB ASC - { -asc => [qw/colA colB] },| - -desc => [qw/colC colD] } | ORDER BY colA ASC, colB ASC, colC DESC, colD DESC + | + { | + -asc => [qw/colA colB/], | ORDER BY colA ASC, colB ASC, + -desc => [qw/colC colD/],| colC DESC, colD DESC + } | ========================================================== diff --git a/t/06order_by.t b/t/06order_by.t index d404aa3..2a3f7b6 100644 --- a/t/06order_by.t +++ b/t/06order_by.t @@ -80,6 +80,11 @@ my @cases = expects => ' ORDER BY colA DESC, colB DESC, colC DESC', expects_quoted => ' ORDER BY `colA` DESC, `colB` DESC, `colC` DESC', }, + { + given => [{-desc => [ qw/colA colB/ ], -asc => [ qw/colC colD/ ] }], + expects => ' ORDER BY colA DESC, colB DESC, colC ASC, colD ASC', + expects_quoted => ' ORDER BY `colA` DESC, `colB` DESC, `colC` ASC, `colD` ASC', + }, );