[Bast-commits] r4388 - in SQL-Abstract/1.x/trunk: . lib/SQL t

groditi at dev.catalyst.perl.org groditi at dev.catalyst.perl.org
Thu May 15 21:28:33 BST 2008


Author: groditi
Date: 2008-05-15 21:28:33 +0100 (Thu, 15 May 2008)
New Revision: 4388

Modified:
   SQL-Abstract/1.x/trunk/Changes
   SQL-Abstract/1.x/trunk/lib/SQL/Abstract.pm
   SQL-Abstract/1.x/trunk/t/06order_by.t
Log:
one more test and some simple docs

Modified: SQL-Abstract/1.x/trunk/Changes
===================================================================
--- SQL-Abstract/1.x/trunk/Changes	2008-05-15 20:07:12 UTC (rev 4387)
+++ SQL-Abstract/1.x/trunk/Changes	2008-05-15 20:28:33 UTC (rev 4388)
@@ -1,7 +1,8 @@
 Revision history for SQL::Abstract
 
     - Added { -desc => 'column' } order by support (Ash)
-    - Tiny fix for { -desc => 'columns'} order by support + tests (groditi)
+    - Tiny "$_"-related fix for { -desc => 'columns'} order by support 
+      - tests + docs (groditi)
 
 ----------------------------
 revision 1.20

Modified: SQL-Abstract/1.x/trunk/lib/SQL/Abstract.pm
===================================================================
--- SQL-Abstract/1.x/trunk/lib/SQL/Abstract.pm	2008-05-15 20:07:12 UTC (rev 4387)
+++ SQL-Abstract/1.x/trunk/lib/SQL/Abstract.pm	2008-05-15 20:28:33 UTC (rev 4388)
@@ -1271,8 +1271,22 @@
 
 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.
+or an array of either of the two previous forms. Examples:
 
+             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
+      {-desc => 'colB'}        |
+    ]                          |
+    [colA => {-asc => 'colB'}] | ORDER BY colA, colB ASC
+    ==========================================================
+
 =head1 PERFORMANCE
 
 Thanks to some benchmarking by Mark Stosberg, it turns out that

Modified: SQL-Abstract/1.x/trunk/t/06order_by.t
===================================================================
--- SQL-Abstract/1.x/trunk/t/06order_by.t	2008-05-15 20:07:12 UTC (rev 4387)
+++ SQL-Abstract/1.x/trunk/t/06order_by.t	2008-05-15 20:28:33 UTC (rev 4388)
@@ -38,6 +38,11 @@
     expects => ' ORDER BY colA ASC, colB DESC',
     expects_quoted => ' ORDER BY `colA` ASC, `colB` DESC',
    },
+   {
+    given => ['colA', {-desc => 'colB'}],
+    expects => ' ORDER BY colA, colB DESC',
+    expects_quoted => ' ORDER BY `colA`, `colB` DESC',
+   },
   );
 
 my $sql  = SQL::Abstract->new;




More information about the Bast-commits mailing list