Index: trunk/ippTools/src/difftool.c
===================================================================
--- trunk/ippTools/src/difftool.c	(revision 18093)
+++ trunk/ippTools/src/difftool.c	(revision 18336)
@@ -42,5 +42,5 @@
 static bool definebyqueryMode(pxConfig *config);
 
-static bool setdiffRunState(pxConfig *config, const char *diff_id, const char *state);
+static bool setdiffRunState(pxConfig *config, psS64 diff_id, const char *state);
 
 # define MODECASE(caseName, func) \
@@ -146,5 +146,5 @@
 
     // required options
-    PXOPT_LOOKUP_STR(diff_id, config->args, "-diff_id", true, false);
+    PXOPT_LOOKUP_S64(diff_id, config->args, "-diff_id", true, false);
     PXOPT_LOOKUP_STR(state, config->args, "-state", true, false);
 
@@ -163,9 +163,9 @@
 
     // required options
-    PXOPT_LOOKUP_STR(diff_id, config->args, "-diff_id", true, false);
+    PXOPT_LOOKUP_S64(diff_id, config->args, "-diff_id", true, false);
 
     // optional
-    PXOPT_LOOKUP_STR(stack_id, config->args, "-stack_id", false, false);
-    PXOPT_LOOKUP_STR(warp_id, config->args, "-warp_id", false, false);
+    PXOPT_LOOKUP_S64(stack_id, config->args, "-stack_id", false, false);
+    PXOPT_LOOKUP_S64(warp_id, config->args, "-warp_id", false, false);
     PXOPT_LOOKUP_STR(kind, config->args, "-kind", false, false);
 
@@ -188,5 +188,5 @@
     psString tess_id = NULL;
     if (warp_id) {
-        if (!p_psDBRunQuery(config->dbh, "SELECT * from diffRun WHERE diff_id = %" PRId64, (psS64)atoll(diff_id))) {
+        if (!p_psDBRunQuery(config->dbh, "SELECT * from diffRun WHERE diff_id = %" PRId64, diff_id)) {
             psError(PS_ERR_UNKNOWN, false, "database error");
             return false;
@@ -199,5 +199,5 @@
         }
         if (!psArrayLength(output)) {
-            psError(PS_ERR_UNKNOWN, false, "diff_id %" PRId64 " not found", (psS64)atoll(diff_id));
+            psError(PS_ERR_UNKNOWN, false, "diff_id %" PRId64 " not found", diff_id);
             psFree(output);
             return false;
@@ -215,8 +215,8 @@
 
     if (!diffInputSkyfileInsert(config->dbh,
-            (psS64)atoll(diff_id),
+            diff_id,
             template,
-            stack_id ? (psS64)atoll(stack_id) : PS_MAX_S64, // defined or NULL
-            warp_id ? (psS64)atoll(warp_id) : PS_MAX_S64, // defined or NULL
+            stack_id ? stack_id : PS_MAX_S64, // defined or NULL
+            warp_id ? warp_id : PS_MAX_S64, // defined or NULL
             skycell_id,
             tess_id,
@@ -230,5 +230,5 @@
     }
 
-    if (!p_psDBRunQuery(config->dbh, "SELECT count(diff_id) FROM diffRun JOIN diffInputSkyfile USING(diff_id) WHERE diff_id = %" PRId64, (psS64)atoll(diff_id))) {
+    if (!p_psDBRunQuery(config->dbh, "SELECT count(diff_id) FROM diffRun JOIN diffInputSkyfile USING(diff_id) WHERE diff_id = %" PRId64, diff_id)) {
         if (!psDBRollback(config->dbh)) {
             psError(PS_ERR_UNKNOWN, false, "database error");
@@ -250,5 +250,5 @@
             psError(PS_ERR_UNKNOWN, false, "database error");
         }
-        psError(PS_ERR_UNKNOWN, false, "diff_id %" PRId64 " not found", (psS64)atoll(diff_id));
+        psError(PS_ERR_UNKNOWN, false, "diff_id %" PRId64 " not found", diff_id);
         psFree(output);
         return false;
@@ -333,10 +333,4 @@
 
     if (psArrayLength(output)) {
-        if (!convertIdToStr(output)) {
-            psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
-            psFree(output);
-            return false;
-        }
-
         // negative simple so the default is true
         if (!ippdbPrintMetadatas(stdout, output, "diffInputSkyfile", !simple)) {
@@ -407,10 +401,4 @@
 
     if (psArrayLength(output)) {
-        if (!convertIdToStr(output)) {
-            psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
-            psFree(output);
-            return false;
-        }
-
         // negative simple so the default is true
         if (!ippdbPrintMetadatas(stdout, output, "diffSkyfile", !simple)) {
@@ -432,5 +420,5 @@
 
     // required
-    PXOPT_LOOKUP_STR(diff_id, config->args, "-diff_id", true, false);
+    PXOPT_LOOKUP_S64(diff_id, config->args, "-diff_id", true, false);
 
     // default to 0
@@ -465,5 +453,5 @@
 
     if (!diffSkyfileInsert(config->dbh,
-                           (psS64)atoll(diff_id),
+                           diff_id,
                            uri,
                            path_base,
@@ -557,10 +545,4 @@
 
     if (psArrayLength(output)) {
-        if (!convertIdToStr(output)) {
-            psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
-            psFree(output);
-            return false;
-        }
-
         // negative simple so the default is true
         if (!ippdbPrintMetadatas(stdout, output, "diffSkyfile", !simple)) {
@@ -609,7 +591,6 @@
 
 
-static bool setdiffRunState(pxConfig *config, const char *diff_id, const char *state)
-{
-    PS_ASSERT_PTR_NON_NULL(diff_id, false);
+static bool setdiffRunState(pxConfig *config, psS64 diff_id, const char *state)
+{
     PS_ASSERT_PTR_NON_NULL(state, false);
 
@@ -626,8 +607,8 @@
     }
 
-    char *query = "UPDATE diffRun SET state = '%s' WHERE diff_id = '%s'";
+    char *query = "UPDATE diffRun SET state = '%s' WHERE diff_id = %"PRId64;
     if (!p_psDBRunQuery(config->dbh, query, state, diff_id)) {
         psError(PS_ERR_UNKNOWN, false,
-                "failed to change state for diff_id %s", diff_id);
+                "failed to change state for diff_id %"PRId64, diff_id);
         return false;
     }
@@ -766,6 +747,6 @@
 
     // optional
-    PXOPT_LOOKUP_STR(template_stack_id, config->args, "-template_stack_id", false, false);
-    PXOPT_LOOKUP_STR(template_warp_id, config->args, "-template_warp_id", false, false);
+    PXOPT_LOOKUP_S64(template_stack_id, config->args, "-template_stack_id", false, false);
+    PXOPT_LOOKUP_S64(template_warp_id, config->args, "-template_warp_id", false, false);
 
     if (template_stack_id && template_warp_id) {
@@ -779,6 +760,6 @@
     }
 
-    PXOPT_LOOKUP_STR(input_stack_id, config->args, "-input_stack_id", false, false);
-    PXOPT_LOOKUP_STR(input_warp_id, config->args, "-input_warp_id", false, false);
+    PXOPT_LOOKUP_S64(input_stack_id, config->args, "-input_stack_id", false, false);
+    PXOPT_LOOKUP_S64(input_warp_id, config->args, "-input_warp_id", false, false);
     if (input_stack_id && input_warp_id) {
         psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Only one input can be defined.");
@@ -792,8 +773,8 @@
 
     return populatedrun(workdir, skycell_id, tess_id,
-                        input_warp_id ? (psS64)atoll(input_warp_id) : PS_MAX_S64,
-                        input_stack_id ? (psS64)atoll(input_stack_id) : PS_MAX_S64,
-                        template_warp_id ? (psS64)atoll(template_warp_id) : PS_MAX_S64,
-                        template_stack_id ? (psS64)atoll(template_stack_id) : PS_MAX_S64,
+                        input_warp_id ? input_warp_id : PS_MAX_S64,
+                        input_stack_id ? input_stack_id : PS_MAX_S64,
+                        template_warp_id ? template_warp_id : PS_MAX_S64,
+                        template_stack_id ? template_stack_id : PS_MAX_S64,
                         config);
 
