Index: trunk/ippTools/src/faketool.c
===================================================================
--- trunk/ippTools/src/faketool.c	(revision 18093)
+++ trunk/ippTools/src/faketool.c	(revision 18336)
@@ -103,16 +103,6 @@
     PS_ASSERT_PTR_NON_NULL(config, NULL);
 
-    PXOPT_LOOKUP_STR(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", "==");
@@ -259,24 +249,6 @@
 
     psMetadata *where = psMetadataAlloc();
-    PXOPT_LOOKUP_STR(fake_id, config->args, "-fake_id", false, false);
-    // convert fake_id into a psS64
-    if (fake_id) {
-        if (!psMetadataAddS64(where, PS_LIST_TAIL, "fake_id", 0, "==", (psS64)atoll(fake_id))) {
-            psError(PS_ERR_UNKNOWN, false, "failed to add item fake_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, "-fake_id", "fake_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", "==");
@@ -406,10 +378,4 @@
     }
 
-    if (!convertIdToStr(output)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
-        psFree(output);
-        return false;
-    }
-
     // negate simple so the default is true
     if (!ippdbPrintMetadatas(stdout, output, "fakePendingExp", !simple)) {
@@ -433,24 +399,6 @@
 
     psMetadata *where = psMetadataAlloc();
-    PXOPT_LOOKUP_STR(fake_id, config->args, "-fake_id", false, false);
-    // convert fake_id into a psS64
-    if (fake_id) {
-        if (!psMetadataAddS64(where, PS_LIST_TAIL, "fakeRun.fake_id", 0, "==", (psS64)atoll(fake_id))) {
-            psError(PS_ERR_UNKNOWN, false, "failed to add item fake_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, "-fake_id", "fake_id", "==");
+    PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "==");
     PXOPT_COPY_STR(config->args, where, "-class_id", "rawImfile.class_id", "==");
     PXOPT_COPY_STR(config->args, where, "-inst", "rawExp.telescope", "==");
@@ -495,10 +443,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, "fakePendingImfile", !simple)) {
@@ -519,6 +461,6 @@
 
     // fake_id, ext_tag, class_id are required
-    PXOPT_LOOKUP_STR(fake_id, config->args,     "-fake_id", true, false);
-    PXOPT_LOOKUP_STR(exp_id, config->args,      "-exp_id", true, false);
+    PXOPT_LOOKUP_S64(fake_id, config->args,     "-fake_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);
 
@@ -539,6 +481,6 @@
 
     if (!fakeProcessedImfileInsert(config->dbh,
-                                   (psS64)atoll(fake_id),
-                                   (psS64)atoll(exp_id),
+                                   fake_id,
+                                   exp_id,
                                    class_id,
                                    uri,
@@ -589,24 +531,6 @@
 
     psMetadata *where = psMetadataAlloc();
-    PXOPT_LOOKUP_STR(fake_id, config->args, "-fake_id", false, false);
-    // convert fake_id into a psS64
-    if (fake_id) {
-        if (!psMetadataAddS64(where, PS_LIST_TAIL, "fakeRun.fake_id", 0, "==", (psS64)atoll(fake_id))) {
-            psError(PS_ERR_UNKNOWN, false, "failed to add item fake_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, "-fake_id", "fakeRun.fake_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", "==");
@@ -659,10 +583,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, "fakeProcessedImfile", !simple)) {
@@ -682,24 +600,6 @@
 
     psMetadata *where = psMetadataAlloc();
-    PXOPT_LOOKUP_STR(fake_id, config->args, "-fake_id", false, false);
-    // convert fake_id into a psS64
-    if (fake_id) {
-        if (!psMetadataAddS64(where, PS_LIST_TAIL, "fake_id", 0, "==", (psS64)atoll(fake_id))) {
-            psError(PS_ERR_UNKNOWN, false, "failed to add item fake_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, "-fake_id", "fake_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", "==");
@@ -778,13 +678,5 @@
 
     psMetadata *where = psMetadataAlloc();
-    PXOPT_LOOKUP_STR(fake_id, config->args, "-fake_id", false, false);
-    // convert fake_id into a psS64
-    if (fake_id) {
-        if (!psMetadataAddS64(where, PS_LIST_TAIL, "fake_id", 0, "==", (psS64)atoll(fake_id))) {
-            psError(PS_ERR_UNKNOWN, false, "failed to add item fake_id");
-            psFree(where);
-            return false;
-        }
-    }
+    PXOPT_COPY_S64(config->args, where, "-fake_id", "fake_id", "==");
     PXOPT_COPY_STR(config->args, where, "-class_id", "class_id", "==");
 
@@ -866,10 +758,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, "fakeMask", !simple)) {
@@ -937,10 +823,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;
     }
 
