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 35350)
+++ /branches/eam_branches/ipp-20130307/Ohana/src/dvopsps/src/insert_detections_dvopsps.c	(revision 35351)
@@ -57,4 +57,5 @@
   }
 
+  int status = TRUE;
   // select measurements for each populated catalog
   for (i = 0; i < skylist[0].Nregions; i++) {
@@ -86,7 +87,13 @@
     // NOTE: this is where the real action happens
     if (SAVE_REMOTE && HOST_ID) {
-      append_detections_dvopsps_catalog (&catalog);
+      if (!append_detections_dvopsps_catalog (&catalog)) {
+	fprintf (stderr, "ERROR: failure to append detections to output catalog\n");
+	status = FALSE;
+      }
     } else {
-      insert_detections_dvopsps_catalog (&catalog, mysqlReal);
+      if (!insert_detections_dvopsps_catalog (&catalog, mysqlReal)) {
+	fprintf (stderr, "ERROR: failure to insert detections into mysql database\n");
+	status = FALSE;
+      }
     }
 
@@ -97,8 +104,11 @@
 
   if (SAVE_REMOTE && HOST_ID) {
-    save_detections_dvopsps ();
-  }
-
-  return (TRUE);
+    if (!save_detections_dvopsps ()) {
+      fprintf (stderr, "ERROR: failure to save output file with detections\n");
+      status = FALSE;
+    }
+  }
+
+  return (status);
 }      
 
Index: /branches/eam_branches/ipp-20130307/Ohana/src/dvopsps/src/insert_detections_dvopsps_catalog.c
===================================================================
--- /branches/eam_branches/ipp-20130307/Ohana/src/dvopsps/src/insert_detections_dvopsps_catalog.c	(revision 35350)
+++ /branches/eam_branches/ipp-20130307/Ohana/src/dvopsps/src/insert_detections_dvopsps_catalog.c	(revision 35351)
@@ -74,11 +74,14 @@
 int save_detections_dvopsps () {
 
+  int status = TRUE;
+
   if (!DetectionsSave (RESULT_FILE, detections, Ndetections)) {
     fprintf (stderr, "failed to save detection file %s\n", RESULT_FILE);
+    status = FALSE;
   }
 
   free (detections);
   Ndetections = 0;
-  return (TRUE);
+  return (status);
 }
 
@@ -101,4 +104,6 @@
   int Ninsert = 0;
 
+  int status = TRUE;
+
   // NOTE for testing, just do a few objects
   if (!mysql) {
@@ -115,8 +120,14 @@
 
       // XXX check return status
-      insert_detections_mysql_value (&buffer, &average[i], &measure[m+j]);
+      if (!insert_detections_mysql_value (&buffer, &average[i], &measure[m+j])) {
+	fprintf (stderr, "failure to insert detections in mysql\n");
+	status = FALSE;
+      }
 
       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;
+	}
 	if (DEBUG) fprintf (stderr, "inserted %d rows\n", Ninsert);
 	Ninsert = 0;
@@ -134,7 +145,16 @@
     }
   }
-  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;
+  }
+  
   if (VERBOSE) fprintf (stderr, "inserted %d rows\n", Ninsert);
   FreeIOBuffer (&buffer);
+
+  if (!status) {
+    MARKTIME("-- failed to insert "OFF_T_FMT" rows in %f sec\n", found, dtime);
+    return (FALSE);
+  }
 
   MARKTIME("-- inserted "OFF_T_FMT" rows in %f sec, skipped %d without IDs\n", found, dtime, missingID);
@@ -188,4 +208,5 @@
   PrintIOBuffer (buffer, "%lu, ", average->extID);	  // objID
   PrintIOBuffer (buffer, "%u, ", measure->dbFlags);	  // flags
+
   float zp = code->C * 0.001 + code->K * (measure->airmass - 1) - measure->Mcal;
   float exptime = pow(10.0, 0.4 * measure->dt);
@@ -211,4 +232,6 @@
   MYSQL_RES *result;
 
+  int status = TRUE;
+
   // check that the last two chars are ,\n and replace with ;\n
   if (!strcmp(&buffer->buffer[buffer->Nbuffer-2], ",\n")) {
@@ -222,9 +245,10 @@
   if (mysql) {
     if (DEBUG) fprintf (stderr, "%s\n", buffer->buffer);
-    int status = mysql_query(mysql, buffer->buffer); 
-    if (status) {
+    int mysqlStatus = mysql_query(mysql, buffer->buffer); 
+    if (mysqlStatus) {
       fprintf (stderr, "error with insert:\n");
       fprintf (stderr, "%s\n", mysql_error(mysql));
       fprintf (stderr, "Nbuffer: %d\n", buffer->Nbuffer);
+      status = FALSE;
     }
     result = mysql_store_result (mysql);
@@ -234,4 +258,4 @@
   }
 
-  return TRUE;
-}
+  return status;
+}
Index: /branches/eam_branches/ipp-20130307/Ohana/src/dvopsps/src/insert_objects_dvopsps_catalog.c
===================================================================
--- /branches/eam_branches/ipp-20130307/Ohana/src/dvopsps/src/insert_objects_dvopsps_catalog.c	(revision 35350)
+++ /branches/eam_branches/ipp-20130307/Ohana/src/dvopsps/src/insert_objects_dvopsps_catalog.c	(revision 35351)
@@ -96,22 +96,22 @@
 
   PrintIOBuffer (&buffer, "CREATE TABLE %s_cpt ("
-		 "RA FLOAT,  "          
-		 "DEC_ FLOAT,  "         
-		 "RA_ERR REAL,  "      
-		 "DEC_ERR REAL,  "     
-		 "U_RA REAL,  "        
-		 "U_DEC REAL,  "       
-		 "V_RA_ERR REAL,  "    
-		 "V_DEC_ERR REAL,  "   
-		 "PAR REAL,  "         
-		 "PAR_ERR REAL,  "     
-		 "CHISQ_POS REAL,  "   
-		 "CHISQ_PM REAL,  "    
-		 "CHISQ_PAP REAL,  "   
+		 "RA DOUBLE,  "          
+		 "DEC_ DOUBLE,  "         
+		 "RA_ERR FLOAT,  "      
+		 "DEC_ERR FLOAT,  "     
+		 "U_RA FLOAT,  "        
+		 "U_DEC FLOAT,  "       
+		 "V_RA_ERR FLOAT,  "    
+		 "V_DEC_ERR FLOAT,  "   
+		 "PAR FLOAT,  "         
+		 "PAR_ERR FLOAT,  "     
+		 "CHISQ_POS FLOAT,  "   
+		 "CHISQ_PM FLOAT,  "    
+		 "CHISQ_PAP FLOAT,  "   
 		 "MEAN_EPOCH INT,  "  
 		 "TIME_RANGE INT,  "  
-		 "PSF_QF REAL, "      
-		 "PSF_QF_PERF REAL,  " 
-		 "STARGAL_SEP REAL,  " 
+		 "PSF_QF FLOAT, "      
+		 "PSF_QF_PERF FLOAT,  " 
+		 "STARGAL_SEP FLOAT,  " 
 		 "NUMBER_POS SMALLINT,  "  
 		 "NMEASURE SMALLINT,  "    
@@ -152,14 +152,14 @@
 
   PrintIOBuffer (&buffer, "CREATE TABLE %s_cps ("
-		 "MAG REAL,  "             
-		 "MAG_AP REAL,  "             
-		 "MAG_KRON REAL,  "        
-		 "MAG_KRON_ERR REAL,  "    
-		 "MAG_ERR REAL,  "         
-		 "MAG_CHI REAL,  "         
-		 "FLUX_PSF REAL,  "        
-		 "FLUX_PSF_ERR REAL,  "    
-		 "FLUX_KRON REAL,  "       
-		 "FLUX_KRON_ERR REAL,  "   
+		 "MAG FLOAT,  "             
+		 "MAG_AP FLOAT,  "             
+		 "MAG_KRON FLOAT,  "        
+		 "MAG_KRON_ERR FLOAT,  "    
+		 "MAG_ERR FLOAT,  "         
+		 "MAG_CHI FLOAT,  "         
+		 "FLUX_PSF FLOAT,  "        
+		 "FLUX_PSF_ERR FLOAT,  "    
+		 "FLUX_KRON FLOAT,  "       
+		 "FLUX_KRON_ERR FLOAT,  "   
 		 "FLAGS INT,  "           
 		 "NCODE SMALLINT,  "           
Index: /branches/eam_branches/ipp-20130307/Ohana/src/dvopsps/src/mysql_dvopsps.c
===================================================================
--- /branches/eam_branches/ipp-20130307/Ohana/src/dvopsps/src/mysql_dvopsps.c	(revision 35350)
+++ /branches/eam_branches/ipp-20130307/Ohana/src/dvopsps/src/mysql_dvopsps.c	(revision 35351)
@@ -58,11 +58,11 @@
   // dump_result (connection);
     
-  sprintf (query, "show variables like 'max_allowed_packet';");
-  if (mysql_query (connection, query)) {
-    fprintf (stderr, "failed to set max_allowed_packet\n");
-    fprintf (stderr, "%s\n", mysql_error (connection));
-    return NULL;
-  }
-  dump_result (connection);
+  // sprintf (query, "show variables like 'max_allowed_packet';");
+  // if (mysql_query (connection, query)) {
+  //   fprintf (stderr, "failed to set max_allowed_packet\n");
+  //   fprintf (stderr, "%s\n", mysql_error (connection));
+  //   return NULL;
+  // }
+  // dump_result (connection);
     
   if (0) {
