Index: trunk/ippTools/src/p2searchPendingFrames.c
===================================================================
--- trunk/ippTools/src/p2searchPendingFrames.c	(revision 6210)
+++ trunk/ippTools/src/p2searchPendingFrames.c	(revision 6214)
@@ -5,45 +5,6 @@
     PS_ASSERT_PTR_NON_NULL(config, NULL);
 
-    psMetadata *where = psMetadataAlloc();
-
-    if (config->camera_name != NULL) {
-        psMetadataAddStr(where, PS_LIST_TAIL, "camera", 0, "==",
-            config->camera_name);
-    }
-    if (config->filter != NULL) {
-        psMetadataAddStr(where, PS_LIST_TAIL, "filter", 0, "==",
-            config->filter);
-    }
-    /*
-    if (config->exp_id != NULL) {
-        psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==",
-            config->exp_id);
-    }
-    if (config->class != NULL) {
-        psMetadataAddStr(where, PS_LIST_TAIL, "class", 0, "==",
-            config->class);
-    }
-    if (config->class_id != NULL) {
-        psMetadataAddStr(where, PS_LIST_TAIL, "class_id", 0, "==",
-            config->class_id);
-    }
-    */
-    /*
-    if (!psTimeIsZero(config->start) && !psTimeIsZero(config->stop)) {
-        psMetadataAddTime(where, PS_LIST_TAIL, "TIME_START", 0, "<", config->stop);
-        psMetadataAddTime(where, PS_LIST_TAIL, "TIME_STOP", 0, ">", config->start);
-    }
-    */
-
-    // if no search criteria were added then set where to NULL to search for
-    // everything
-    // XXX fix handling of where
-    if (where->list->n < 1) {
-        psFree(where);
-        where = NULL;
-    }
-
-    psArray *exposures = p2PendingExpSelectRowObjects(config->database, where, MAX_ROWS);
-    psFree(where);
+    psArray *exposures = p2PendingExpSelectRowObjects(config->database,
+        config->where, MAX_ROWS);
     if (!exposures) {
         psError(PS_ERR_UNKNOWN, false, "no p2PendingExp rows found");
@@ -57,5 +18,5 @@
 
     // 'where' to select each exposure
-    where = psMetadataAlloc();
+    psMetadata *where = psMetadataAlloc();
     for (int i = 0; i < exposures->n; i++) {
         p2PendingExpRow *exposure = exposures->data[i];
@@ -82,38 +43,6 @@
     PS_ASSERT_PTR_NON_NULL(config, NULL);
 
-    psMetadata *where = psMetadataAlloc();
-    if (config->camera_name != NULL) {
-        if (!psMetadataAddStr(where, PS_LIST_TAIL, "camera", 0, "==",
-            config->camera_name)) {
-            psError(PS_ERR_UNKNOWN, false, "failed to add item camera");
-            psFree(where);
-            return NULL;
-        }
-    }
-    if (config->filter != NULL) {
-        psMetadataAddStr(where, PS_LIST_TAIL, "filter", 0, "==",
-            config->filter);
-    }
-    if (config->exp_id != NULL) {
-        psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==",
-            config->exp_id);
-    }
-    if (config->class != NULL) {
-        psMetadataAddStr(where, PS_LIST_TAIL, "class", 0, "==",
-            config->class);
-    }
-    if (config->class_id != NULL) {
-        psMetadataAddStr(where, PS_LIST_TAIL, "class_id", 0, "==",
-            config->class_id);
-    }
-
-    if (where->list->n < 1) {
-        psFree(where);
-        where = NULL;
-    }
-
-    psArray *imfiles = p2PendingImfileSelectRowObjects(config->database, where,
-        MAX_ROWS);
-    psFree(where);
+    psArray *imfiles = p2PendingImfileSelectRowObjects(config->database,
+        config->where, MAX_ROWS);
     if (!imfiles) {
         psError(PS_ERR_UNKNOWN, false, "no rawScienceExp rows found");
@@ -129,38 +58,7 @@
     PS_ASSERT_PTR_NON_NULL(config, NULL);
 
-    psMetadata *where = psMetadataAlloc();
-    if (config->camera_name != NULL) {
-        if (!psMetadataAddStr(where, PS_LIST_TAIL, "camera", 0, "==",
-            config->camera_name)) {
-            psError(PS_ERR_UNKNOWN, false, "failed to add item camera");
-            psFree(where);
-            return NULL;
-        }
-    }
-    if (config->filter != NULL) {
-        psMetadataAddStr(where, PS_LIST_TAIL, "filter", 0, "==",
-            config->filter);
-    }
-    if (config->exp_id != NULL) {
-        psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==",
-            config->exp_id);
-    }
-    if (config->class != NULL) {
-        psMetadataAddStr(where, PS_LIST_TAIL, "class", 0, "==",
-            config->class);
-    }
-    if (config->class_id != NULL) {
-        psMetadataAddStr(where, PS_LIST_TAIL, "class_id", 0, "==",
-            config->class_id);
-    }
-
-    if (where->list->n < 1) {
-        psFree(where);
-        where = NULL;
-    }
-
-    psArray *exps = p2PendingExpSelectRowObjects(config->database, where,
+    psArray *exps = p2PendingExpSelectRowObjects(config->database,
+        config->where,
         MAX_ROWS);
-    psFree(where);
     if (!exps) {
         psError(PS_ERR_UNKNOWN, false, "no p2PendingExp rows found");
