Index: trunk/ippTools/src/pstamptool.c
===================================================================
--- trunk/ippTools/src/pstamptool.c	(revision 16596)
+++ trunk/ippTools/src/pstamptool.c	(revision 16931)
@@ -290,6 +290,6 @@
 
     char *query ="INSERT INTO pstampRequest"
-                 " (state, uri, ds_id, outFileset)"
-                 " VALUES( 'new', '%s', %s, '%s')";
+                 " (state, uri, ds_id, outFileset, resultsFile)"
+                 " VALUES( 'new', '%s', %s, '%s', 1)";
 
     if (!p_psDBRunQuery(config->dbh, query, uri, ds_id, outFileset)) {
@@ -433,6 +433,26 @@
 {
     bool    status;
-
-    PS_ASSERT_PTR_NON_NULL(config, false);
+    bool    stampJob = false;
+
+    PS_ASSERT_PTR_NON_NULL(config, false);
+
+    psString job_type = psMetadataLookupStr(&status, config->args, "-job_type");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -job_type");
+        return false;
+    }
+    if (job_type) {
+        if (!strcmp(job_type, "get_image")) {
+            stampJob = false;
+        } else if (!strcmp(job_type, "stamp")) {
+            stampJob = true;
+        } else {
+            psError(PS_ERR_UNKNOWN, false, "unknown value for -job_type: %s", job_type);
+            return false;
+        }
+    } else {
+        job_type = "stamp";
+        stampJob = true;
+    }
 
     psString uri = psMetadataLookupStr(&status, config->args, "-uri");
@@ -472,15 +492,24 @@
     }
     if (!argString) {
-        psError(PS_ERR_UNKNOWN, true, "-args is required");
-        return false;
-    }
-
-    char *query ="INSERT INTO pstampJob"
-                 " (req_id, state, uri, outputBase, args)"
+        if (stampJob) {
+            psError(PS_ERR_UNKNOWN, true, "-args is required");
+            return false;
+        }
+    }
+
+    char *query;
+    
+    if (stampJob) {
+        query ="INSERT INTO pstampJob"
+                 " (req_id, state, jobType, uri, outputBase, args)"
+                 " VALUES( %s, 'run', '%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, uri, outputBase, argString)) {
-        psError(PS_ERR_UNKNOWN, false, "database error");
-        psFree(query);
+    }
+
+    if (!p_psDBRunQuery(config->dbh, query, req_id, job_type, uri, outputBase, argString)) {
+        psError(PS_ERR_UNKNOWN, false, "database error");
         return false;
     }
