Index: trunk/FACT++/src/root2sql.cc
===================================================================
--- trunk/FACT++/src/root2sql.cc	(revision 20055)
+++ trunk/FACT++/src/root2sql.cc	(revision 20056)
@@ -532,5 +532,5 @@
     }
 
-    Database connection(uri);
+    Database connection(uri, print_connection);
 
     if (verbose>0)
Index: trunk/FACT++/src/rootifysql.cc
===================================================================
--- trunk/FACT++/src/rootifysql.cc	(revision 20055)
+++ trunk/FACT++/src/rootifysql.cc	(revision 20056)
@@ -25,5 +25,5 @@
     control.add_options()
         ("uri,u",         var<string>()->required(),   "Database link as in\n\tuser:password@server[:port]/database[?compress=0|1].")
-        ("query,q",       var<string>(""),             "MySQL query (overwrites --file)")
+        ("query,q",       var<string>(""),             "MySQL query (overwrites --file, used as table name if without spaces)")
         ("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")
@@ -95,5 +95,8 @@
         "\n"
         "The default is to read the query from a file called rootify.sql. Except if a different "
-        "filename is specified by the --file option or a query is given with --query.\n"
+        "filename is specified by the --file option or a query is given with --query. "
+        "A special case is if the 'query' does not contain any whitespace. Then the "
+        "query is considered as a table name and the query 'SELECT * FROM table' is "
+        "executed.\n"
         "\n"
         "As a trick, the rootify.sql file can be made excutable (chmod u+x rootify.sql). "
@@ -469,5 +472,5 @@
 void Convert(FileEntry::Container &container, const mysqlpp::String &col)
 {
-    *reinterpret_cast<T*>(container.ptr) = static_cast<T>(col);
+    *reinterpret_cast<T*>(container.ptr) = col.is_null() ? T(0) : static_cast<T>(col);
 }
 
@@ -534,4 +537,7 @@
 
     string query  = conf.Get<string>("query");
+    if (!query.empty() && query.find_first_of(' ')==string::npos)
+        query.insert(0, "SELECT * FROM ");
+
     if (query.empty())
     {
@@ -635,5 +641,5 @@
     }
 
-    Database connection(uri); // Keep alive while fetching rows
+    Database connection(uri, print_connection); // Keep alive while fetching rows
 
     if (verbose>0)
