Index: /branches/eam_branches/ipp-20130307/Ohana/src/dvopsps/src/insert_detections_dvopsps.c
===================================================================
--- /branches/eam_branches/ipp-20130307/Ohana/src/dvopsps/src/insert_detections_dvopsps.c	(revision 35369)
+++ /branches/eam_branches/ipp-20130307/Ohana/src/dvopsps/src/insert_detections_dvopsps.c	(revision 35370)
@@ -199,13 +199,17 @@
 
     for (i = 0; i < table->Nhosts; i++) {
-      while ((detections = DetectionsLoad (table->hosts[i].results, &Ndetections)) == NULL) {
+      if ((detections = DetectionsLoad (table->hosts[i].results, &Ndetections)) == NULL) {
 	// failed to get the data from this host.  This can happen for various reasons.  Give the user a chance to try again...
+	// fprintf (stderr, "you may run the command manually\n");
 	fprintf (stderr, "failed to read data from %s\n", table->hosts[i].hostname);
-	fprintf (stderr, "you may run the command manually\n");
+	return FALSE;
       }
       free (table->hosts[i].results);
       table->hosts[i].results = NULL;
     
-      insert_detections_mysql_array (mysql, detections, Ndetections);
+      if (!insert_detections_mysql_array (mysql, detections, Ndetections)) {
+	fprintf (stderr, "failed to insert data for %s\n", table->hosts[i].hostname);
+	return FALSE;
+      }
 
       free (detections);
@@ -228,4 +232,6 @@
   insert_detections_mysql_init (&buffer);
 
+  int status = TRUE;
+
   gettimeofday (&start, (void *) NULL);
   for (i = 0; i < Ndetections; i++) {
@@ -234,5 +240,8 @@
     insert_detections_mysql_detvalue (&buffer, &detections[i]);
     if (buffer.Nbuffer > MAX_BUFFER) {
-      insert_detections_mysql_commit (&buffer, mysql);
+      if (!insert_detections_mysql_commit (&buffer, mysql)) {
+	fprintf (stderr, "failure to insert detections in mysql (commit)\n");
+	status = FALSE;
+      }
       buffer.Nbuffer = 0;
       bzero (buffer.buffer, buffer.Nalloc);
@@ -240,9 +249,17 @@
     }
   }
-  insert_detections_mysql_commit (&buffer, mysql);
+  if (!insert_detections_mysql_commit (&buffer, mysql)) {
+    fprintf (stderr, "failure to insert detections in mysql (commit 2)\n");
+    status = FALSE;
+  }
   FreeIOBuffer (&buffer);
 
+  if (!status) {
+    MARKTIME("-- failed to insert %d rows in %f sec\n", Ndetections, dtime);
+    return FALSE;
+  }
+
   MARKTIME("-- inserted %d rows in %f sec\n", Ndetections, dtime);
-  return (TRUE);
+  return TRUE;
 }
 
