Index: /trunk/FACT++/src/fits2sql.cc
===================================================================
--- /trunk/FACT++/src/fits2sql.cc	(revision 19102)
+++ /trunk/FACT++/src/fits2sql.cc	(revision 19103)
@@ -66,4 +66,5 @@
         ("engine",         var<string>("InnoDB"),     "Database engine to be used when a new table is created")
         ("duplicate",      var<string>(""),           "Specifies an assignment_list for an 'ON DUPLICATE KEY UPDATE' expression")
+        ("ignore-errors",  po_switch(),               "Adds the IGNORE keyword to the INSERT query (turns errors into warnings, ignores rows with errors)")
         ;
 
@@ -153,4 +154,8 @@
         "with the identical primary key, e.g. --duplicate='MyPrimary=VALUES(MyPrimary)'. "
         "For more details, see the MySQL manual.\n"
+        "\n"
+        "Another possibility is to add the IGNORE keyword to the INSERT query by "
+        "--ignore-errors, which essentially ignores all errors and turns them into "
+        "warnings which are printed after the query succeeded.\n"
         "\n"
         "For debugging purpose, or to just create or drop a table, the final insert "
@@ -278,4 +283,6 @@
     const string duplicate       = conf.Get<string>("duplicate");
 
+    const bool ignore_errors     = conf.Get<bool>("ignore-errors");
+
     const bool print_extensions  = conf.Get<bool>("print-extensions");
     const bool print_columns     = conf.Get<bool>("print-columns");
@@ -312,5 +319,5 @@
     {
         cout << "\nTables:\n - " << boost::join(f.GetTables(), "\n - ") << '\n' << endl;
-        return 2;
+        return 3;
     }
 
@@ -429,13 +436,15 @@
     // Checking for database connection
 
+    Database connection(uri);
+
     try
     {
         if (!force)
-            Database(uri).connected();
+            connection.connected();
     }
     catch (const exception &e)
     {
         cerr << "SQL connection failed: " << e.what() << endl;
-        return 3;
+        return 4;
     }
 
@@ -463,5 +472,5 @@
             // => Simple result
             if (!dry_run)
-                Database(uri).query("DROP TABLE `"+table+"`").execute();
+                connection.query("DROP TABLE `"+table+"`").execute();
             if (verbose>0)
                 cout << "Table `" << table << "` dropped." << endl;
@@ -472,5 +481,5 @@
         cerr << "DROP TABLE `" << table << "`\n\n";
         cerr << "SQL query failed:\n" << e.what() << endl;
-        return 4;
+        return 5;
     }
 
@@ -478,5 +487,5 @@
     {
         if (create && !dry_run)
-            Database(uri).query(query).execute();
+            connection.query(query).execute();
     }
     catch (const exception &e)
@@ -484,5 +493,5 @@
         cerr << query << "\n\n";
         cerr << "SQL query failed:\n" << e.what() << endl;
-        return 5;
+        return 6;
     }
 
@@ -499,5 +508,8 @@
 
     //query = update ? "UPDATE" : "INSERT";
-    query = "INSERT `"+table+"`\n"
+    query = "INSERT ";
+    if (ignore_errors)
+        query += "IGNORE ";
+    query += "`"+table+"`\n"
         "(\n";
 
@@ -580,5 +592,5 @@
         if (!noinsert && !dry_run)
             // => Simple result
-            Database(uri).query(query).execute();
+            connection.query(query).execute();
         else
             cout << "Insert query skipped!" << endl;
@@ -592,5 +604,5 @@
             cerr << query << "\n\n";
         cerr << "SQL query failed (" << query.length() << " bytes):\n" << e.what() << endl;
-        return 6;
+        return 7;
     }
 
@@ -599,5 +611,5 @@
         cout << count << " row(s) inserted.\n\n";
         cout << "Total execution time: " << Time().UnixTime()-start.UnixTime() << "s\n" << endl;
-/*
+
         try
         {
@@ -613,6 +625,7 @@
 
                 cout << roww["Level"] << '[' << roww["Code"] << "]: ";
-                cout << roww["Message"] << '\n' << endl;
+                cout << roww["Message"] << '\n';
             }
+            cout << endl;
 
         }
@@ -621,6 +634,6 @@
             cerr << "\nSHOW WARNINGS\n\n";
             cerr << "SQL query failed:\n" << e.what() << endl;
-            return 6;
-        }*/
+            return 8;
+        }
     }
 
Index: /trunk/FACT++/src/root2sql.cc
===================================================================
--- /trunk/FACT++/src/root2sql.cc	(revision 19102)
+++ /trunk/FACT++/src/root2sql.cc	(revision 19103)
@@ -62,4 +62,5 @@
         ("engine",         var<string>("InnoDB"),     "Database engine to be used when a new table is created")
         ("duplicate",      var<string>(""),           "Specifies an assignment_list for an 'ON DUPLICATE KEY UPDATE' expression")
+        ("ignore-errors",  po_switch(),               "Adds the IGNORE keyword to the INSERT query (turns errors into warnings, ignores rows with errors)")
         ;
 
@@ -159,4 +160,8 @@
         "end.\n"
         "\n"
+        "Another possibility is to add the IGNORE keyword to the INSERT query by "
+        "--ignore-errors, which essentially ignores all errors and turns them into "
+        "warnings which are printed after the query succeeded.\n"
+        "\n"
         "Using a higher verbosity level (-v), an overview of the written columns or all "
         "processed leaves is printed depending on the verbosity level. The output looks "
@@ -301,4 +306,6 @@
     const string duplicate       = conf.Get<string>("duplicate");
 
+    const bool ignore_errors     = conf.Get<bool>("ignore-errors");
+
     const bool print_branches    = conf.Get<bool>("print-branches");
     const bool print_leaves      = conf.Get<bool>("print-leaves");
@@ -452,8 +459,10 @@
     // Checking for database connection
 
+    Database connection(uri);
+
     try
     {
         if (!force)
-            Database(uri).connected();
+            connection.connected();
     }
     catch (const exception &e)
@@ -485,5 +494,5 @@
             // => Simple result
             if (!dry_run)
-                Database(uri).query("DROP TABLE `"+table+"`").execute();
+                connection.query("DROP TABLE `"+table+"`").execute();
             if (verbose>0)
                 cout << "Table `" << table << "` dropped." << endl;
@@ -500,5 +509,5 @@
     {
         if (create && !dry_run)
-            Database(uri).query(query).execute();
+            connection.query(query).execute();
     }
     catch (const exception &e)
@@ -521,5 +530,8 @@
 
     //query = update ? "UPDATE" : "INSERT";
-    query = "INSERT `"+table+"`\n"
+    query = "INSERT ";
+    if (ignore_errors)
+        query += "IGNORE ";
+    query += "`"+table+"`\n"
         "(\n";
 
@@ -589,5 +601,5 @@
         if (!noinsert && !dry_run)
             // => Simple result
-            Database(uri).query(query).execute();
+            connection.query(query).execute();
         else
             cout << "Insert query skipped!" << endl;
@@ -608,5 +620,5 @@
         cout << count << " row(s) inserted.\n\n";
         cout << "Total execution time: " << Time().UnixTime()-start.UnixTime() << "s\n" << endl;
-/*
+
         try
         {
@@ -622,6 +634,7 @@
 
                 cout << roww["Level"] << '[' << roww["Code"] << "]: ";
-                cout << roww["Message"] << '\n' << endl;
+                cout << roww["Message"] << '\n';
             }
+            cout << endl;
 
         }
@@ -630,8 +643,7 @@
             cerr << "\nSHOW WARNINGS\n\n";
             cerr << "SQL query failed:\n" << e.what() << endl;
-            return 6;
-        }*/
-    }
-
+            return 7;
+        }
+    }
 
     return 0;
