Author: spadkins
Date: Fri Nov 13 12:16:07 2009
New Revision: 13504

Modified:
   p5ee/trunk/App-Repository/bin/dbget

Log:
add order_by option

Modified: p5ee/trunk/App-Repository/bin/dbget
==============================================================================
--- p5ee/trunk/App-Repository/bin/dbget (original)
+++ p5ee/trunk/App-Repository/bin/dbget Fri Nov 13 12:16:07 2009
@@ -3,7 +3,7 @@
 use Date::Format;
 
 use App::Options (
-    options => [ qw(dbhost dbname dbuser dbpass repository table params 
columns headings compact decimals subtotal_columns totals
+    options => [ qw(dbhost dbname dbuser dbpass repository table params 
columns headings order_by compact decimals subtotal_columns totals
                     distinct cache_skip cache_refresh verbose) ],
     option => {
         repository => {
@@ -45,6 +45,9 @@
         distinct => {
             description => "Select only distinct rows",
         },
+        order_by => {
+            description => "List of columns to order by",
+        },
         hashkey => {
             description => "hash key to get params from the cache",
         },
@@ -108,6 +111,7 @@
         $get_options = { extend_columns => 1 };
     }
     $get_options->{distinct} = 1 if ($App::options{distinct});
+    $get_options->{order_by} = [ split(/,/, $App::options{order_by}) ] if 
($App::options{order_by});
     $get_options->{cache_skip} = 1 if ($App::options{cache_skip});
     $get_options->{cache_refresh} = 1 if ($App::options{cache_refresh});
     my $rows     = $db->get_rows($table, $params, $columns, $get_options);

Reply via email to