Index: trunk/ippTools/src/p2searchPendingFrames.c
===================================================================
--- trunk/ippTools/src/p2searchPendingFrames.c	(revision 6162)
+++ trunk/ippTools/src/p2searchPendingFrames.c	(revision 6165)
@@ -124,2 +124,49 @@
     return imfiles;
 }
+
+psArray *p2searchPendingExp(p2Config *config)
+{
+    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,
+        MAX_ROWS);
+    psFree(where);
+    if (!exps) {
+        psError(PS_ERR_UNKNOWN, false, "no p2PendingExp rows found");
+
+        return NULL;
+    }
+
+    return exps;
+}
