Index: trunk/ippTools/src/pstamptool.c
===================================================================
--- trunk/ippTools/src/pstamptool.c	(revision 25098)
+++ trunk/ippTools/src/pstamptool.c	(revision 25109)
@@ -315,16 +315,22 @@
     PS_ASSERT_PTR_NON_NULL(config, false);
 
-    PXOPT_LOOKUP_S64(req_id,  config->args, "-req_id", false, false);
-    PXOPT_LOOKUP_STR(name,  config->args, "-name", false, false);
+    psMetadata *where = psMetadataAlloc();
+    PXOPT_COPY_S64(config->args, where, "-req_id", "req_id", "==");
+    PXOPT_COPY_STR(config->args, where, "-name", "name", "==");
+
     PXOPT_LOOKUP_U64(limit,   config->args, "-limit",  false, false);
     PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
 
-    if (!req_id && !name) {
+    if (!psListLength(where->list)) {
         psError(PS_ERR_UNKNOWN, true, "-req_id or -name must be supplied");
         return false;
     }
 
-    psString query = NULL;
-    psStringAppend(&query, "SELECT * from pstampRequest WHERE req_id = %" PRId64, req_id);
+    psString query = psStringCopy("SELECT * from pstampRequest");
+
+    psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
+    psStringAppend(&query, " WHERE %s", whereClause);
+    psFree(whereClause);
+    psFree(where);
     
     // treat limit == 0 as "no limit"
@@ -523,5 +529,5 @@
 
     // default value for job_type is defined in pstamptoolConfig.c
-    if (!strcmp(job_type, "get_image") || !strcmp(job_type, "detect_query")) {
+    if (!strcmp(job_type, "get_image") || !strcmp(job_type, "detect_query") || !strcmp(job_type, "none")) {
 	stampJob = false;
     } else if (!strcmp(job_type, "stamp")) {
