Index: /trunk/ippTools/src/warptool.c
===================================================================
--- /trunk/ippTools/src/warptool.c	(revision 10770)
+++ /trunk/ippTools/src/warptool.c	(revision 10771)
@@ -507,4 +507,63 @@
     PS_ASSERT_PTR_NON_NULL(config, NULL);
 
+    psString query = psStringCopy(
+        " SELECT DISTINCT"
+        "   p4InputImfile.p4_id,"
+        "   p2ProcessedImfile.*"
+        " FROM p4Run"
+        " JOIN p4WarpedImfile"
+        "   USING(p4_id)"
+        " LEFT JOIN p4StackedImfile"
+        "   USING(p4_id, class_id)"
+        " WHERE"
+        "   p4Run.state = 'run'"
+        "   AND p4StackedImfile.p4_id IS NULL"
+        "   AND p4Stackedmfile.class_id IS NULL"
+    );
+
+    if (config->where) {
+        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p4WarpedImfile");
+        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 p4WarpedImfile 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, "p4WarpedImfile", !simple)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to print array");
+        psFree(output);
+        return false;
+    }
+
+    psFree(output);
+
     return true;
 }
