Index: trunk/FACT++/src/rootifysql.cc
===================================================================
--- trunk/FACT++/src/rootifysql.cc	(revision 19194)
+++ trunk/FACT++/src/rootifysql.cc	(revision 19204)
@@ -29,5 +29,5 @@
         ("display,d",     po_switch(),                 "Displays contents on the screen (most usefull in combination with mysql statements as SHOW or EXPLAIN)")
         ("write,w",       var<string>(""),             "Write output to an ascii file")
-        ("delimiter",     var<string>(""),             "The delimiter used if contents are displayed with --display (default=\\t)")
+        ("delimiter",     var<string>(),               "The delimiter used if contents are displayed with --display (default=\\t)")
         ("explain",       po_switch(),                 "Requests an EXPLAIN from the server (shows the server optimized query)\nsee also https://dev.mysql.com/doc/refman/explain-output.html")
         ("profiling",     po_switch(),                 "Turn on profiling and print profile")
@@ -480,5 +480,5 @@
     const uint16_t verbose     = conf.Get<uint16_t>("verbose");
     const uint16_t compression = conf.Get<uint16_t>("compression");
-    const string   delimiter   = conf.Get<string>("delimiter");
+    const string   delimiter   = conf.Has("delimiter") ? conf.Get<string>("delimiter") : "\t";
     const vector<string> _ignore = conf.Vec<string>("ignore");
     const bool  print_connection = conf.Get<bool>("print-connection");
@@ -868,17 +868,9 @@
     {
         cout << endl;
-        cout << "#";
-        for (size_t i=0; i<l.size(); i++)
-            cout << ' ' << l[i].c_str();
-        cout << endl;
+        cout << "# " << row.field_list(delimiter.c_str()) << endl;
     }
 
     if (!write.empty())
-    {
-        fout << "#";
-        for (size_t i=0; i<l.size(); i++)
-            fout << ' ' << l[i].c_str();
-        fout << endl;
-    }
+        fout << "# " << row.field_list(delimiter.c_str()) << endl;
 
     // ---------------------- Fill TTree with DB data --------------------------
@@ -889,16 +881,12 @@
         count++;
 
-        ostringstream sout;
+        if (display)
+            cout << row.value_list(delimiter.c_str(), mysqlpp::do_nothing) << '\n';
+        if (!write.empty())
+            fout << row.value_list(delimiter.c_str(), mysqlpp::do_nothing) << '\n';
 
         size_t idx=0;
         for (auto col=row.begin(); col!=row.end(); col++, idx++)
         {
-            if (display || !write.empty())
-            {
-                if (idx>0)
-                    sout << (delimiter.empty()?"\t":delimiter);
-                sout << col->c_str();
-            }
-
             if (!ignorenull && col->is_null())
             {
@@ -932,14 +920,6 @@
         }
 
-        if (idx==row.size())
-        {
-            if (!nofill)
-                ttree->Fill();
-
-            if (display)
-                cout << sout.str() << endl;
-            if (!write.empty())
-                fout << sout.str() << '\n';
-        }
+        if (idx==row.size() && !nofill)
+            ttree->Fill();
 
         row = res.fetch_row();
