Index: trunk/ippTools/src/addtool.c
===================================================================
--- trunk/ippTools/src/addtool.c	(revision 33030)
+++ trunk/ippTools/src/addtool.c	(revision 33525)
@@ -141,11 +141,4 @@
     pxAddLabelSearchArgs (config, where, "-data_group","staticskyRun.data_group", "=="); // define using camRun label
     PXOPT_COPY_STR(config->args, where,  "-reduction", "staticskyyRun.reduction", "==");
-    pxAddLabelSearchArgs (config, where, "-filter",     "stackRun.filter", "=="); // define using camRun label
-    }
-        if (strcmp(stage, "staticsky_multi")== 0) {
-
-    pxAddLabelSearchArgs (config, where, "-label",     "staticskyRun.label", "=="); // define using camRun label
-    pxAddLabelSearchArgs (config, where, "-data_group","staticskyRun.data_group", "=="); // define using camRun label
-    PXOPT_COPY_STR(config->args, where,  "-reduction", "staticskyyRun.reduction", "==");
     //no filter here
     }
@@ -227,21 +220,6 @@
     }
     }
+  
     if (strcmp(stage,"staticsky") == 0) {
-    if (dvodb ) {
-      psTrace("addtool.c", PS_LOG_INFO, "dvodb argument found (%s) using addtool_find_sky_id_dvo.sql\n%s\n", dvodb,stage);
-        // find the cam_id of all the exposures that we want to queue up.
-        bare_query = pxDataGet("addtool_find_sky_id_dvo.sql");
-	// user supplied dvodb
-	psStringAppend(&dvodb_string, "addRun.dvodb = '%s'", dvodb);
-    } else {
-      psTrace("addtool.c", PS_LOG_INFO, "dvodb argument not found using addtool_find_sky_id.sql\n%s\n",stage);
-        // find the cam_id of all the exposures that we want to queue up.
-        bare_query = pxDataGet("addtool_find_sky_id.sql");
-        // inherit dvodb from camRun, avoid matching NULL
-        psStringAppend(&dvodb_string, "(staticskyRun.dvodb IS NOT NULL AND previous_dvodb = staticskyRun.dvodb)");
-    }
-    }
-
-    if (strcmp(stage,"staticsky_multi") == 0) {
       if (dvodb ) {
 	psTrace("addtool.c", PS_LOG_INFO, "dvodb argument found (%s) using addtool_find_sky_id_multi_dvo.sql\n%s\n", dvodb,stage);
@@ -310,8 +288,8 @@
 	psStringAppend(&query, " GROUP BY stack_id");
       }
+      //   if (strcmp(stage,"staticsky") == 0) {
+      //   psStringAppend(&query, " GROUP BY stack_id");
+      // }
     if (strcmp(stage,"staticsky") == 0) {
-	psStringAppend(&query, " GROUP BY stack_id");
-      }
-    if (strcmp(stage,"staticsky_multi") == 0) {
       psStringAppend(&query, " GROUP BY sky_id");  //some reason it needs this
       }
@@ -402,31 +380,6 @@
     }
     }
+   
     if (strcmp(stage,"staticsky") == 0) {
-    for (long i = 0; i < psArrayLength(output); i++) {
-        psMetadata *md = output->data[i];
-
-	staticskyRunRow *row = staticskyRunObjectFromMetadata(md);
-	
-        if (!row) {
-            psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into camRun");
-            psFree(output);
-            return false;
-        }
-
-        if (!dvodb) {  //there's no staticsky.dvodb
-            psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined dvodb: label: %s, sky_id %" PRId64, row->label, row->sky_id);
-            psFree(output);
-            return false;
-        }
-        if (!workdir && !row->workdir) {
-            psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined workdir: label: %s, sky_id %" PRId64, row->label, row->sky_id);
-            psFree(output);
-            return false;
-        }
-
-        psFree(row);
-    }
-    }
-    if (strcmp(stage,"staticsky_multi") == 0) {
     for (long i = 0; i < psArrayLength(output); i++) {
         psMetadata *md = output->data[i];
@@ -566,48 +519,6 @@
     }
       }
+   
     if (strcmp(stage,"staticsky") == 0) {
-    for (long i = 0; i < psArrayLength(output); i++) {
-        psMetadata *md = output->data[i];
-	psS64 stage_id =0; 
-	
-	staticskyRunRow *row = staticskyRunObjectFromMetadata(md);
-	stage_id = row->sky_id;
-	
-        if (!row) {
-            psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into camRun");
-            psFree(output);
-            return false;
-        }
-
-        // queue the exp
-        if (!pxaddQueueByCamID(config,
-			       stage,
-                               stage_id,
-			       0,
-                               workdir     ? workdir   : row->workdir,
-                               reduction   ? reduction : row->reduction,
-                               label       ? label     : row->label,
-                               data_group  ? data_group : (row->data_group ? row->data_group :  (label ? label : row->label)),
-                               dvodb       ? dvodb     : NULL,
-                               note        ? note      : NULL,
-                               image_only,
-                               minidvodb,
-                               minidvodb_group,
-                               minidvodb_name
-        )) {
-            if (!psDBRollback(config->dbh)) {
-                psError(PS_ERR_UNKNOWN, false, "database error sfg");
-            }
-            psError(PS_ERR_UNKNOWN, false,
-                    "failed to trying to queue stage %s %" PRId64,stage, stage_id);
-            psFree(row);
-            psFree(output);
-            return false;
-        }
-        psFree(row);
-    }
-      }
-
-    if (strcmp(stage,"staticsky_multi") == 0) {
     for (long i = 0; i < psArrayLength(output); i++) {
         psMetadata *md = output->data[i];
@@ -705,7 +616,5 @@
     query = psStringCopy("UPDATE addRun JOIN staticskyRun on sky_id = stage_id");
     }
-    if (strcmp(stage, "staticsky_multi")==0) {
-    query = psStringCopy("UPDATE addRun JOIN staticskyRun on sky_id = stage_id");
-    }
+    
 
     // pxUpdateRun gets parameters from config->args and runs the update query
@@ -745,7 +654,4 @@
     }
     if (strcmp(stage, "staticsky")==0) { 
-    query = pxDataGet("addtool_find_pendingexp_staticsky.sql");
-    }
-    if (strcmp(stage, "staticsky_multi")==0) { 
     query = pxDataGet("addtool_find_pendingexp_staticsky_multi.sql");
     }
@@ -768,9 +674,9 @@
       psStringAppend(&query, " GROUP BY %s", "stack_id");
     }
+    //if (strcmp(stage, "staticsky") == 0) {
+    //  //this group by is needed to join against all the warps (to get camera)
+    //  psStringAppend(&query, " GROUP BY %s", "sky_id");
+    //}
     if (strcmp(stage, "staticsky") == 0) {
-      //this group by is needed to join against all the warps (to get camera)
-      psStringAppend(&query, " GROUP BY %s", "sky_id");
-    }
-    if (strcmp(stage, "staticsky_multi") == 0) {
       //this group by is needed to join against all the warps (to get camera)
       psStringAppend(&query, " GROUP BY %s", "sky_id, stage_extra1");
@@ -977,7 +883,4 @@
     }
     if (strcmp (stage,"staticsky") == 0) {
-    query = pxDataGet("addtool_find_processedexp_staticsky.sql");
-    }
-    if (strcmp (stage,"staticsky_multi") == 0) {
     query = pxDataGet("addtool_find_processedexp_staticsky_multi.sql");
     }
@@ -1090,8 +993,5 @@
 	 query = pxDataGet("addtool_revertprocessedexp_stack.sql");
       }
-     if (strcmp(stage, "staticsky") == 0) {
-	 query = pxDataGet("addtool_revertprocessedexp_staticsky.sql");
-      }
-   if (strcmp(stage, "staticsky_multi") == 0) {
+    if (strcmp(stage, "staticsky") == 0) {
 	 query = pxDataGet("addtool_revertprocessedexp_staticsky_multi.sql");
       }
