Index: trunk/ippTools/src/chiptool.c
===================================================================
--- trunk/ippTools/src/chiptool.c	(revision 18321)
+++ trunk/ippTools/src/chiptool.c	(revision 18336)
@@ -106,16 +106,8 @@
     PS_ASSERT_PTR_NON_NULL(config, NULL);
 
-    PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false);
+    PXOPT_LOOKUP_S64(exp_id, config->args, "-exp_id", false, false);
 
     psMetadata *where = psMetadataAlloc();
-    // convert exp_id into a psS64
-    if (exp_id) {
-        if (!psMetadataAddS64(where, PS_LIST_TAIL, "exp_id", 0, "==", (psS64)atoll(exp_id))) {
-            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
-            psFree(where);
-            return false;
-        }
-    }
-
+    PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "==");
     PXOPT_COPY_STR(config->args, where, "-exp_name", "exp_name", "==");
     PXOPT_COPY_STR(config->args, where, "-inst", "camera", "==");
@@ -263,26 +255,6 @@
 
     psMetadata *where = psMetadataAlloc();
-    PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", false, false);
-    // convert chip_id into a psS64
-    if (chip_id) {
-        if (!psMetadataAddS64(where, PS_LIST_TAIL, "chip_id", 0, "==", (psS64)atoll(chip_id))) {
-            psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id");
-            psFree(where);
-            return false;
-        }
-    }
-
-    PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false);
-    // convert exp_id into a psS64
-    if (exp_id) {
-        if (!psMetadataAddS64(where, PS_LIST_TAIL, "exp_id", 0, "==", (psS64)atoll(exp_id))) {
-            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
-            psFree(where);
-            return false;
-        }
-    }
-
-    PXOPT_COPY_STR(config->args,  where, "-chip_id", "chip_id", "==");
-    PXOPT_COPY_STR(config->args,  where, "-exp_id", "exp_id", "==");
+    PXOPT_COPY_S64(config->args,  where, "-chip_id", "chip_id", "==");
+    PXOPT_COPY_S64(config->args,  where, "-exp_id", "exp_id", "==");
     PXOPT_COPY_STR(config->args,  where, "-exp_name", "exp_name", "==");
     PXOPT_COPY_STR(config->args,  where, "-inst", "camera", "==");
@@ -371,24 +343,6 @@
 
     psMetadata *where = psMetadataAlloc();
-    PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", false, false);
-    // convert chip_id into a psS64
-    if (chip_id) {
-        if (!psMetadataAddS64(where, PS_LIST_TAIL, "chipRun.chip_id", 0, "==", (psS64)atoll(chip_id))) {
-            psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id");
-            psFree(where);
-            return false;
-        }
-    }
-
-    PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false);
-    // convert exp_id into a psS64
-    if (exp_id) {
-        if (!psMetadataAddS64(where, PS_LIST_TAIL, "rawExp.exp_id", 0, "==", (psS64)atoll(exp_id))) {
-            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
-            psFree(where);
-            return false;
-        }
-    }
-
+    PXOPT_COPY_S64(config->args, where, "-chip_id", "chipRun.chip_id", "==");
+    PXOPT_COPY_S64(config->args, where, "-exp_id", "rawExp.exp_id", "==");
     PXOPT_COPY_STR(config->args, where, "-class_id", "rawImfile.class_id", "==");
     PXOPT_COPY_STR(config->args, where, "-inst", "rawExp.telescope", "==");
@@ -433,10 +387,4 @@
     }
 
-    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, "chipPendingImfile", !simple)) {
@@ -457,6 +405,6 @@
 
     // chip_id, ext_tag, class_id are required
-    PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", true, false);
-    PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", true, false);
+    PXOPT_LOOKUP_S64(chip_id, config->args, "-chip_id", true, false);
+    PXOPT_LOOKUP_S64(exp_id, config->args, "-exp_id", true, false);
     PXOPT_LOOKUP_STR(class_id, config->args, "-class_id", true, false);
 
@@ -498,6 +446,6 @@
 
     if (!chipProcessedImfileInsert(config->dbh,
-                                   (psS64)atoll(chip_id),
-                                   (psS64)atoll(exp_id),
+                                   chip_id,
+                                   exp_id,
                                    class_id,
                                    uri,
@@ -569,24 +517,6 @@
 
     psMetadata *where = psMetadataAlloc();
-    PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", false, false);
-    // convert chip_id into a psS64
-    if (chip_id) {
-        if (!psMetadataAddS64(where, PS_LIST_TAIL, "chipRun.chip_id", 0, "==", (psS64)atoll(chip_id))) {
-            psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id");
-            psFree(where);
-            return false;
-        }
-    }
-
-    PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false);
-    // convert exp_id into a psS64
-    if (exp_id) {
-        if (!psMetadataAddS64(where, PS_LIST_TAIL, "rawExp.exp_id", 0, "==", (psS64)atoll(exp_id))) {
-            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
-            psFree(where);
-            return false;
-        }
-    }
-
+    PXOPT_COPY_S64(config->args, where, "-chip_id", "chipRun.chip_id", "==");
+    PXOPT_COPY_S64(config->args, where, "-exp_id", "rawExp.chip_id", "==");
     PXOPT_COPY_STR(config->args, where, "-class_id", "rawImfile.class_id", "==");
     PXOPT_COPY_STR(config->args, where, "-inst", "rawExp.telescope", "==");
@@ -639,10 +569,4 @@
     }
 
-    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, "chipProcessedImfile", !simple)) {
@@ -662,24 +586,6 @@
 
     psMetadata *where = psMetadataAlloc();
-    PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", false, false);
-    // convert chip_id into a psS64
-    if (chip_id) {
-        if (!psMetadataAddS64(where, PS_LIST_TAIL, "chip_id", 0, "==", (psS64)atoll(chip_id))) {
-            psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id");
-            psFree(where);
-            return false;
-        }
-    }
-
-    PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false);
-    // convert exp_id into a psS64
-    if (exp_id) {
-        if (!psMetadataAddS64(where, PS_LIST_TAIL, "exp_id", 0, "==", (psS64)atoll(exp_id))) {
-            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
-            psFree(where);
-            return false;
-        }
-    }
-
+    PXOPT_COPY_S64(config->args, where, "-chip_id", "chip_id", "==");
+    PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "==");
     PXOPT_COPY_STR(config->args, where, "-exp_name", "exp_name", "==");
     PXOPT_COPY_STR(config->args, where, "-inst", "camera", "==");
@@ -832,10 +738,4 @@
     }
 
-    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, "chipMask", !simple)) {
@@ -905,10 +805,4 @@
     }
 
-    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, "chipUnmask", !simple)) {
@@ -989,10 +883,4 @@
     }
 
-    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, "chipPendingCleanup", !simple)) {
@@ -1054,10 +942,4 @@
         psFree(output);
         return true;
-    }
-
-    if (!convertIdToStr(output)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
-        psFree(output);
-        return false;
     }
 
