Index: /trunk/FACT++/src/rootifysql.cc
===================================================================
--- /trunk/FACT++/src/rootifysql.cc	(revision 19141)
+++ /trunk/FACT++/src/rootifysql.cc	(revision 19142)
@@ -22,5 +22,5 @@
 void SetupConfiguration(Configuration &conf)
 {
-    po::options_description control("Rootify SQL");
+    po::options_description control("Database options");
     control.add_options()
         ("uri,u",         var<string>()->required(),   "Database link as in\n\tuser:password@server[:port]/database[?compress=0|1].")
@@ -28,14 +28,6 @@
         ("file",          var<string>("rootify.sql"),  "An ASCII file with the MySQL query (overwrites --query)")
         ("ignore-null,i", po_switch(),                 "Do not skip rows containing any NULL field")
-        ("out,o",         var<string>("rootify.root"), "Output root file name")
-        ("force,f",       po_switch(),                 "Force overwriting an existing root file ('RECREATE')")
-        ("update",        po_switch(),                 "Update an existing root file with the new tree ('UPDATE')")
-        ("compression,c", var<uint16_t>(1),            "zlib compression level for the root file")
-        ("tree,t",        var<string>("Result"),       "Name of the root tree")
-        ("ignore",        vars<string>(),              "Ignore the given columns")
         ("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")
-        ("null,n",        po_switch(),                 "Redirect the output file to /dev/null (mainly for debugging purposes, e.g. performance studies)")
-        ("no-fill",       po_switch(),                 "Do not fill events into the root file (mainly for debugging purposes, e.g. performance studies)")
         ("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")
@@ -48,4 +40,16 @@
         ;
 
+    po::options_description root("Root file options");
+    root.add_options()
+        ("out,o",         var<string>("rootify.root"), "Output root file name")
+        ("force,f",       po_switch(),                 "Force overwriting an existing root file ('RECREATE')")
+        ("update",        po_switch(),                 "Update an existing root file with the new tree ('UPDATE')")
+        ("compression,c", var<uint16_t>(1),            "zlib compression level for the root file")
+        ("tree,t",        var<string>("Result"),       "Name of the root tree")
+        ("ignore",        vars<string>(),              "Ignore the given columns")
+        ("null,n",        po_switch(),                 "Redirect the output file to /dev/null (mainly for debugging purposes, e.g. performance studies)")
+        ("no-fill",       po_switch(),                 "Do not fill events into the root file (mainly for debugging purposes, e.g. performance studies)")
+        ;
+
     po::positional_options_description p;
     p.add("file", 1); // The 1st positional options (n=1)
@@ -53,4 +57,5 @@
 
     conf.AddOptions(control);
+    conf.AddOptions(root);
     conf.SetArgumentPositions(p);
 }
@@ -75,5 +80,5 @@
         "This can be useful to create an ascii file or to show results as 'SHOW DATABASES' "
         "or 'EXPLAIN table'. To redirect the contents into an ascii file, the option -v0 "
-        "is useful. To suppredd writing to an output file --null can be used.\n"
+        "is useful. To suppress writing to an output file --null can be used.\n"
         "\n"
         "The default is to read the query from a file called rootify.sql. Except if a different "
@@ -91,5 +96,5 @@
         "You can use environment definitions for substitutions in your SQL query. "
         "For example --env.TEST=5 would replace $TEST or ${TEST} in your query by 5."
-        "If you specifiy one environmentvariable more than once, a list is created. "
+        "If you specify one environment variable more than once, a list is created. "
         "For example --env.TEST=1 --env.TEST=2 --env.TEST=3 would substitute "
         "$TEST or ${TEST} by '1, 2, 3'. This is useful for the SQL `IN` keyword. "
@@ -101,5 +106,5 @@
         "/*comment*/ or introduced with # (shell script style) or -- (SQL style).\n"
         "\n"
-        "In case of succes, 0 is returned, a value>0 otherwise.\n"
+        "In case of success, 0 is returned, a value>0 otherwise.\n"
         "\n"
         "Usage: rootifysql [rootify.sql [rootify.root]] [-u URI] [-q query|-f file] [-i] [-o out] [-f] [-cN] [-t tree] [-vN]\n"
@@ -380,5 +385,5 @@
             cerr << "\nSHOW WARNINGS\n\n";
             cerr << "SQL query failed:\n" << e.what() << endl;
-            return 6;
+            return 1;
         }
     }
@@ -420,5 +425,5 @@
             cerr << "\nSHOW PROFILE ALL\n\n";
             cerr << "SQL query failed:\n" << e.what() << '\n' <<endl;
-            return 11;
+            return 2;
         }
     }
@@ -438,5 +443,5 @@
             cerr << "\nSHOW STATUS LIKE 'Bytes_%'\n\n";
             cerr << "SQL query failed:\n" << e.what() << endl;
-            return 6;
+            return 3;
         }
     }
@@ -503,5 +508,5 @@
         {
             cerr << "Could not open query in '" << file << "': " << strerror(errno) << endl;
-            return 1;
+            return 4;
         }
         getline(fin, query, (char)fin.eof());
@@ -511,5 +516,5 @@
     {
         cerr << "No query specified." << endl;
-        return 2;
+        return 5;
     }
 
@@ -530,5 +535,5 @@
         {
             cerr << "Could not open environment in '" << fname << "' for ${" << ident << "}: " << strerror(errno) << endl;
-            return 3;
+            return 6;
         }
 
@@ -569,5 +574,5 @@
         {
             cerr << "File '" << path << "' is not writable." << endl;
-            return 3;
+            return 7;
         }
 
@@ -575,5 +580,5 @@
         {
             cerr << "File '" << path << "' already exists." << endl;
-            return 4;
+            return 8;
         }
     }
@@ -603,5 +608,5 @@
         {
             const auto &res1 = connection.query("SHOW STATUS LIKE 'Compression'").store();
-            cout << "Compression of databse connection is " << string(res1[0][1]) << endl;
+            cout << "Compression of database connection is " << string(res1[0][1]) << endl;
 
             const auto &res2 = connection.query("SHOW STATUS LIKE 'Ssl_cipher'").store();
@@ -612,5 +617,5 @@
             cerr << "\nSHOW STATUS LIKE 'Compression'\n\n";
             cerr << "SQL query failed:\n" << e.what() << endl;
-            return 6;
+            return 9;
         }
     }
@@ -625,5 +630,5 @@
         cerr << "\nSET profiling=1\n\n";
         cerr << "SQL query failed:\n" << e.what() << endl;
-        return 6;
+        return 10;
     }
 
@@ -645,5 +650,5 @@
             cerr << '\n' << varset << "\n\n";
             cerr << "SQL query failed:\n" << e.what() << endl;
-            return 7;
+            return 11;
         }
 
@@ -730,5 +735,5 @@
             cerr << '\n' << query << "\n\n";
             cerr << "SQL query failed:\n" << e.what() << endl;
-            return 8;
+            return 12;
         }
 
@@ -757,5 +762,5 @@
     TFile tfile(path, update?"UPDATE":(force?"RECREATE":"CREATE"), "Rootify SQL", compression);
     if (tfile.IsZombie())
-        return 9;
+        return 13;
 
     // -------------------------------------------------------------------------
@@ -767,5 +772,5 @@
         cerr << "Empty set returned... nothing to write." << endl;
         finish(connection, verbose, profiling, print_connection);
-        return 10;
+        return 14;
     }
 
