Index: /trunk/ippTools/src/dettool.c
===================================================================
--- /trunk/ippTools/src/dettool.c	(revision 14045)
+++ /trunk/ippTools/src/dettool.c	(revision 14046)
@@ -80,5 +80,5 @@
 //static psArray *validDetInputClassIds(pxConfig *config, const char *det_id);
 //static psArray *searchInputImfiles(pxConfig *config, const char *det_id);
-static detInputExpRow *rawDetrenTodetInputExpRow(rawExpRow *rawExp, psS32 det_id, psS32 iteration);
+static detInputExpRow *rawDetrenTodetInputExpRow(rawExpRow *rawExp, psS64 det_id, psS32 iteration);
 static psArray *searchRawImfiles(pxConfig *config, psMetadata *where);
 static psS32 incrementIteration(pxConfig *config, const char *det_id);
@@ -569,5 +569,5 @@
     psFree(use_begin);
     psFree(use_end);
-    long det_id = psDBLastInsertID(config->dbh);
+    psS64 det_id = psDBLastInsertID(config->dbh);
 
     // create new detInputExp row(s) from the rawExp row(s)
@@ -617,5 +617,5 @@
     {
         psMetadata *where = psMetadataAlloc();
-        psMetadataAddS32(where, PS_LIST_TAIL, "det_id", 0, "==", det_id);
+        psMetadataAddS64(where, PS_LIST_TAIL, "det_id", 0, "==", det_id);
         detRuns = psDBSelectRows(config->dbh, "detRun", where, 0);
         psFree(where);
@@ -627,5 +627,5 @@
     // sanity check results
     if (psArrayLength(detRuns) != 1) {
-        psAbort("found more then one detRun matching det_id %ld(this should not happen)", det_id);
+        psAbort("found more then one detRun matching det_id %" PRId64 " (this should not happen)", det_id);
         return false;
     }
@@ -1300,5 +1300,5 @@
     psFree(use_begin);
     psFree(use_end);
-    long det_id = psDBLastInsertID(config->dbh);
+    psS64 det_id = psDBLastInsertID(config->dbh);
 
     // create new detInputExp row(s) from the rawExp row(s)
@@ -1339,5 +1339,5 @@
     {
         psMetadata *where = psMetadataAlloc();
-        psMetadataAddS32(where, PS_LIST_TAIL, "det_id", 0, "==", det_id);
+        psMetadataAddS64(where, PS_LIST_TAIL, "det_id", 0, "==", det_id);
         detRuns = psDBSelectRows(config->dbh, "detRun", where, 0);
         psFree(where);
@@ -1349,5 +1349,5 @@
     // sanity check results
     if (psArrayLength(detRuns) != 1) {
-        psAbort("found more then one detRun matching det_id %ld(this should not happen)", det_id);
+        psAbort("found more then one detRun matching det_id %" PRId64 " (this should not happen)", det_id);
         return false;
     }
@@ -1761,5 +1761,5 @@
 
     // get the det_id
-    long newDet_id = psDBLastInsertID(config->dbh);
+    psS64 newDet_id = psDBLastInsertID(config->dbh);
 
     psString query = psStringCopy(
@@ -1810,5 +1810,5 @@
     {
         psMetadata *where = psMetadataAlloc();
-        psMetadataAddS32(where, PS_LIST_TAIL, "det_id", 0, "==", newDet_id);
+        psMetadataAddS64(where, PS_LIST_TAIL, "det_id", 0, "==", newDet_id);
         newDetRuns = psDBSelectRows(config->dbh, "detRun", where, 0);
         psFree(where);
@@ -1820,5 +1820,5 @@
     // sanity check the result... we should have only found one det_id
     if (psArrayLength(newDetRuns) != 1) {
-        psAbort("found more then one detRun matching det_id %ld(this should not happen)", newDet_id);
+        psAbort("found more then one detRun matching det_id %" PRId64 " (this should not happen)", newDet_id);
         return false;                   // unreachable
     }
@@ -1972,5 +1972,5 @@
 }
 
-static detInputExpRow *rawDetrenTodetInputExpRow(rawExpRow *rawExp, psS32 det_id, psS32 iteration)
+static detInputExpRow *rawDetrenTodetInputExpRow(rawExpRow *rawExp, psS64 det_id, psS32 iteration)
 {
     PS_ASSERT_PTR_NON_NULL(rawExp, NULL);
@@ -2372,5 +2372,5 @@
     // create a new detProcessedImfile object
     detProcessedImfileRow *detRow = detProcessedImfileRowAlloc(
-        (psS32)atol(det_id),
+        (psS64)atoll(det_id),
         (psS64)atoll(exp_id),
         class_id,
@@ -2649,5 +2649,5 @@
     // create a new detProcessedImfile object
     detProcessedExpRow *detRow = detProcessedExpRowAlloc(
-        (psS32)atol(det_id),
+        (psS64)atoll(det_id),
         (psS64)atoll(exp_id),
         recipe,
@@ -3066,5 +3066,5 @@
     // det_id
     psMetadata *where = psMetadataAlloc();
-    if (!psMetadataAddS32(where, PS_LIST_TAIL, "det_id", 0, "==",
+    if (!psMetadataAddS64(where, PS_LIST_TAIL, "det_id", 0, "==",
             (psS64)atoll(det_id))) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
@@ -3095,5 +3095,5 @@
     // create a new detStackedImfile object
     detStackedImfileRow *stackedImfile = detStackedImfileRowAlloc(
-            (psS32)atol(det_id),
+            (psS64)atoll(det_id),
             iteration,
             class_id,
@@ -4053,5 +4053,5 @@
     // create a new detProcessedImfile object
     detNormalizedExpRow *detRow = detNormalizedExpRowAlloc(
-        (psS32)atol(det_id),
+        (psS32)atoll(det_id),
         iteration,
         recipe,
@@ -5160,5 +5160,5 @@
     bool status = false;
     // values from row
-    psS32 det_id = psMetadataLookupS32(&status, row, "det_id");
+    psS64 det_id = psMetadataLookupS64(&status, row, "det_id");
     if (!status) {
         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for det_id");
@@ -5802,5 +5802,5 @@
     bool status = false;
     // from row
-    psS32 det_id = psMetadataLookupS32(&status, row, "det_id");
+    psS64 det_id = psMetadataLookupS64(&status, row, "det_id");
     if (!status) {
         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for det_id");
@@ -6108,5 +6108,5 @@
         if (!detInputExpInsert(
                     config->dbh,
-                    (psS32)atol(det_id),
+                    (psS64)atoll(det_id),
                     newIteration,
                     (psS64)atoll(exp_id),
@@ -6187,5 +6187,5 @@
         psFree(iter);
     } else {
-        psAbort(                "-exp_id was not parsed correctly (this should not happen");
+        psAbort("-exp_id was not parsed correctly (this should not happen");
     }
 
@@ -6194,6 +6194,6 @@
 
     // add the det_id & iteration == 0 to the where clause
-    if (!psMetadataAddS32(where, PS_LIST_TAIL, "det_id", 0, "==",
-                (psS32)atol(det_id))) {
+    if (!psMetadataAddS64(where, PS_LIST_TAIL, "det_id", 0, "==",
+                (psS64)atoll(det_id))) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item det_id");
         psFree(where);
@@ -6267,5 +6267,5 @@
         }
         detInputExpRow *newInputExp = detInputExpRowAlloc(
-            (psS32)atol(det_id),
+            (psS64)atoll(det_id),
             newIteration,
             inputExp->exp_id,
@@ -6610,5 +6610,5 @@
     {
         psMetadata *where = psMetadataAlloc();
-        psMetadataAddS32(where, PS_LIST_TAIL, "det_id", 0, "==", det_id);
+        psMetadataAddS64(where, PS_LIST_TAIL, "det_id", 0, "==", det_id);
         detRuns = psDBSelectRows(config->dbh, "detRun", where, 0);
         psFree(where);
@@ -6780,5 +6780,5 @@
     psMetadata *where = psMetadataAlloc();
     if (!psMetadataAddS32(where, PS_LIST_TAIL, "det_id", 0, "==",
-                (psS32)atol(det_id))) {
+                (psS32)atoll(det_id))) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item det_id");
         psFree(where);
