Index: /trunk/ippTools/src/pstamptool.c
===================================================================
--- /trunk/ippTools/src/pstamptool.c	(revision 18243)
+++ /trunk/ippTools/src/pstamptool.c	(revision 18244)
@@ -336,5 +336,5 @@
     char *query ="INSERT INTO pstampRequest"
                  " (state, uri, ds_id, outFileset, resultsFile)"
-                 " VALUES( 'new', '%s', %s, '%s', 1)";
+                 " VALUES( 'new', '%s', %s, '%s', 0)";
 
     if (!p_psDBRunQuery(config->dbh, query, uri, ds_id, outFileset)) {
@@ -567,5 +567,5 @@
     }
     if (job_type) {
-        if (!strcmp(job_type, "get_image")) {
+        if (!strcmp(job_type, "get_image") || !strcmp(job_type, "detect_query")) {
             stampJob = false;
         } else if (!strcmp(job_type, "stamp")) {
@@ -622,17 +622,34 @@
     }
 
+    psString stateString = psMetadataLookupStr(&status, config->args, "-state");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -state");
+        return false;
+    }
+    if (!stateString) {
+        stateString = "run";
+    }
+    psString result = psMetadataLookupStr(&status, config->args, "-result");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -result");
+        return false;
+    }
+    if (!result) {
+        result = "0";
+    }
+
     char *query;
     
     if (stampJob) {
         query ="INSERT INTO pstampJob"
-                 " (req_id, state, jobType, uri, outputBase, args)"
-                 " VALUES( %s, 'run', '%s', '%s', '%s', '%s')";
+                 " (req_id, state, jobType, uri, outputBase, result, args)"
+                 " VALUES( %s, '%s', '%s', '%s', '%s', %s, '%s')";
     } else {
         query ="INSERT INTO pstampJob"
-                 " (req_id, state, jobType, uri, outputBase)"
-                 " VALUES( %s, 'run', '%s', '%s', '%s')";
-    }
-
-    if (!p_psDBRunQuery(config->dbh, query, req_id, job_type, uri, outputBase, argString)) {
+                 " (req_id, state, jobType, uri, outputBase, result)"
+                 " VALUES( %s, '%s', '%s', '%s', '%s', %s)";
+    }
+
+    if (!p_psDBRunQuery(config->dbh, query, req_id, stateString, job_type, uri, outputBase, result, argString)) {
         psError(PS_ERR_UNKNOWN, false, "database error");
         return false;
Index: /trunk/ippTools/src/pstamptoolConfig.c
===================================================================
--- /trunk/ippTools/src/pstamptoolConfig.c	(revision 18243)
+++ /trunk/ippTools/src/pstamptoolConfig.c	(revision 18244)
@@ -119,4 +119,8 @@
     psMetadataAddStr(addjobArgs, PS_LIST_TAIL, "-args", 0,
             "define job args", NULL); 
+    psMetadataAddStr(addjobArgs, PS_LIST_TAIL, "-state", 0,
+            "new state", NULL); 
+    psMetadataAddStr(addjobArgs, PS_LIST_TAIL, "-result", 0,
+            "new result", NULL); 
 
     // -listjob
