Index: trunk/ippTools/src/chiptool.c
===================================================================
--- trunk/ippTools/src/chiptool.c	(revision 9239)
+++ trunk/ippTools/src/chiptool.c	(revision 9249)
@@ -147,25 +147,51 @@
     PS_ASSERT_PTR_NON_NULL(config, NULL);
 
-    psArray *pendingFrames = p2PendingFrameSearch(config);
-    if (!pendingFrames) {
-        psErr *err = psErrorLast();
-        if (strstr(err->msg, "no p2PendingExp rows found")) {
-            psFree(err);
-            return true;
-        } else {
-            psError(PS_ERR_UNKNOWN, false, "no p2PendingFrames found");
-            psFree(err);
-            return false;
-        }
-        psFree(err);
-    }
-    bool status = p2PendingFramePrint(stdout, config, pendingFrames);
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false,"p2PendingFramePrint() failed");
-        psFree(pendingFrames);
-        return false;
-    }
-
-    psFree(pendingFrames);
+    // XXX does this need to be constrained so that it won't return any results
+    // if a match p2PendingExp hasn't been registered?
+    psString query = psStringCopy("SELECT * FROM p2PendingImfile");
+
+    if (config->where) {
+        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "rawImfile");
+        psStringAppend(&query, " AND %s", whereClause);
+        psFree(whereClause);
+    }
+
+    if (!p_psDBRunQuery(config->dbh, query)) {
+        psError(PS_ERR_UNKNOWN, false, "database error");
+        psFree(query);
+        return false;
+    }
+    psFree(query);
+
+    psArray *output = p_psDBFetchResult(config->dbh);
+    if (!output) {
+        psError(PS_ERR_UNKNOWN, false, "database error");
+        return false;
+    }
+    if (!psArrayLength(output)) {
+        // XXX check psError here
+        psError(PS_ERR_UNKNOWN, false, "no p2PendingImfile rows found");
+        psFree(output);
+        return true;
+    }
+
+    bool simple = false;
+    {
+        bool status = false;
+        simple = psMetadataLookupBool(&status, config->args, "-simple");
+        if (!status) {
+            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");
+            return false;
+        }
+    }
+
+    // negative simple so the default is true
+    if (!ippdbPrintMetadatas(stdout, output, "p2PendingImfile", !simple)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to print array");
+        psFree(output);
+        return false;
+    }
+
+    psFree(output);
 
     return true;
