Index: branches/cleanup/ippTools/src/chiptool.c
===================================================================
--- branches/cleanup/ippTools/src/chiptool.c	(revision 18154)
+++ branches/cleanup/ippTools/src/chiptool.c	(revision 18357)
@@ -110,16 +110,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", "==");
@@ -158,4 +150,5 @@
     PXOPT_COPY_F32(config->args, where, "-solang_min", "solang", ">=");
     PXOPT_COPY_F32(config->args, where, "-solang_max", "solang", "<");
+    PXOPT_COPY_STR(config->args, where, "-comment", "comment", "LIKE");
 
     if (!psListLength(where->list)
@@ -266,26 +259,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", "==");
@@ -374,24 +347,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", "==");
@@ -436,10 +391,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)) {
@@ -460,6 +409,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);
 
@@ -501,6 +450,6 @@
 
     if (!chipProcessedImfileInsert(config->dbh,
-                                   (psS64)atoll(chip_id),
-                                   (psS64)atoll(exp_id),
+                                   chip_id,
+                                   exp_id,
                                    class_id,
                                    uri,
@@ -572,24 +521,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", "==");
@@ -642,10 +573,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)) {
@@ -665,24 +590,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", "==");
@@ -835,10 +742,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)) {
@@ -908,10 +809,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)) {
@@ -992,10 +887,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, "chipPendingCleanupRun", !simple)) {
@@ -1063,10 +952,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, "chipPendingCleanupImfile", !simple)) {
@@ -1130,10 +1013,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, "chipDoneCleanup", !simple)) {
@@ -1203,10 +1080,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;
     }
 
