Index: /trunk/ippTools/src/p2searchPendingFrames.c
===================================================================
--- /trunk/ippTools/src/p2searchPendingFrames.c	(revision 6156)
+++ /trunk/ippTools/src/p2searchPendingFrames.c	(revision 6157)
@@ -5,8 +5,6 @@
     PS_ASSERT_PTR_NON_NULL(config, NULL);
 
-    // build 'where' structure
     psMetadata *where = psMetadataAlloc();
 
-    // in order to include these restrictions, we need to define these table columns
     if (config->camera_name != NULL) {
         psMetadataAddStr(where, PS_LIST_TAIL, "camera", 0, "==",
@@ -37,4 +35,12 @@
     }
     */
+
+    // 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);
Index: /trunk/ippTools/src/p2searchRawFrames.c
===================================================================
--- /trunk/ippTools/src/p2searchRawFrames.c	(revision 6156)
+++ /trunk/ippTools/src/p2searchRawFrames.c	(revision 6157)
@@ -5,9 +5,6 @@
     PS_ASSERT_PTR_NON_NULL(config, NULL);
 
-    // build 'where' structure
-    psMetadata *where = NULL;
+    psMetadata *where = psMetadataAlloc();
    
-//    psMetadataAddS32  (where, PS_LIST_TAIL, "TYPE",  0, "==", P2_TYPE_OBJECT);
-
     if (config->camera_name != NULL) {
         psMetadataAddStr(where, PS_LIST_TAIL, "camera", 0, "==",
@@ -26,7 +23,15 @@
     */
 
+    // 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 = rawScienceExpSelectRowObjects(config->database, where, 
         MAX_ROWS);
-    psFree (where);
+    psFree(where);
     if (!exposures) {
         psError(PS_ERR_UNKNOWN, false, "no rawScienceExp rows found");
