[svn:p5ee] r13443 - p5ee/trunk/App-Repository/bin

[email protected] Wed, 28 Oct 2009 07:48:12 -0700 (PDT)
Newsgroups perl.cvs.p5ee
Message-ID <[email protected]>
Author: spadkins
Date: Wed Oct 28 07:48:08 2009
New Revision: 13443

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

Log:
begin csv support

Modified: p5ee/trunk/App-Repository/bin/dbsql
==============================================================================
--- p5ee/trunk/App-Repository/bin/dbsql	(original)
+++ p5ee/trunk/App-Repository/bin/dbsql	Wed Oct 28 07:48:08 2009
@@ -12,6 +12,9 @@
         table => {
             description => "Specify the table for formatting purposes (if not discernible from the query)",
         },
+        csv => {
+            description => "Produce output as CSV",
+        },
         compact => {
             description => "Trim titles to make compact table",
         },
@@ -53,7 +56,12 @@
     die "Could not determine what table this query is for and it wasn't given on the command line\n" if (!$table);
 
     my $formats  = [];
-    &print_table($rows, $columns, $formats, { compact => $App::options{compact}, });
+    if ($App::options{csv}) {
+        &print_table_as_csv($rows, $columns, $formats, { compact => $App::options{compact}, });
+    }
+    else {
+        &print_table($rows, $columns, $formats, { compact => $App::options{compact}, });
+    }
 }
 
 sub print_table {