Index: /branches/jhoblitt/ippdb/src/ippdb.c
===================================================================
--- /branches/jhoblitt/ippdb/src/ippdb.c	(revision 7499)
+++ /branches/jhoblitt/ippdb/src/ippdb.c	(revision 7500)
@@ -10529,5 +10529,5 @@
 static void detRunRowFree(detRunRow *object);
 
-detRunRow *detRunRowAlloc(const char *det_type)
+detRunRow *detRunRowAlloc(const char *det_type, psS32 iteration)
 {
     detRunRow       *object;
@@ -10537,4 +10537,5 @@
 
     object->det_type = psStringCopy(det_type);
+    object->iteration = iteration;
 
     return object;
@@ -10562,4 +10563,9 @@
         return false;
     }
+    if (!psMetadataAddS32(md, PS_LIST_TAIL, "iteration", 0, NULL, 0)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item iteration");
+        psFree(md);
+        return false;
+    }
 
     status = psDBCreateTable(dbh, DETRUN_TABLE_NAME, md);
@@ -10575,5 +10581,5 @@
 }
 
-bool detRunInsert(psDB * dbh, const char *det_type)
+bool detRunInsert(psDB * dbh, const char *det_type, psS32 iteration)
 {
     psMetadata      *md;
@@ -10586,4 +10592,9 @@
         return false;
     }
+    if (!psMetadataAddS32(md, PS_LIST_TAIL, "iteration", 0, NULL, iteration)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item iteration");
+        psFree(md);
+        return false;
+    }
 
     status = psDBInsertOneRow(dbh, DETRUN_TABLE_NAME, md);
@@ -10593,5 +10604,5 @@
 }
 
-bool detRunPop(psDB *dbh, char **det_type)
+bool detRunPop(psDB *dbh, char **det_type, psS32 *iteration)
 {
     psArray         *rowSet;
@@ -10643,4 +10654,10 @@
         return false;
     }
+    *iteration = psMetadataLookupS32(&status, row, "iteration");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item iteration");
+        psFree(row);
+        return false;
+    }
 
     psFree(row);
@@ -10651,5 +10668,5 @@
 bool detRunInsertObject(psDB *dbh, detRunRow *object)
 {
-    return detRunInsert(dbh, object->det_type);
+    return detRunInsert(dbh, object->det_type, object->iteration);
 }
 
@@ -10657,11 +10674,12 @@
 {
     char            det_type[256];
-
-    if (!detRunPop(dbh, (char **)&det_type)) {
+    psS32           iteration;
+
+    if (!detRunPop(dbh, (char **)&det_type, &iteration)) {
         psError(PS_ERR_UNKNOWN, false, "failed to pop a database row");
         return NULL;
     }
 
-    return detRunRowAlloc(det_type);
+    return detRunRowAlloc(det_type, iteration);
 }
 
@@ -10767,4 +10785,9 @@
         return NULL;
     }
+    if (!psMetadataAddS32(md, PS_LIST_TAIL, "iteration", 0, NULL, object->iteration)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item iteration");
+        psFree(md);
+        return NULL;
+    }
 
     return md;
@@ -10775,4 +10798,5 @@
     bool            status;
     char            *det_type;
+    psS32           iteration;
 
     det_type = psMetadataLookupPtr(&status, md, "det_type");
@@ -10781,6 +10805,11 @@
         return false;
     }
-
-    return detRunRowAlloc(det_type);
+    iteration = psMetadataLookupS32(&status, md, "iteration");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item iteration");
+        return false;
+    }
+
+    return detRunRowAlloc(det_type, iteration);
 }
 psArray *detRunSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
Index: /branches/jhoblitt/ippdb/src/ippdb.h
===================================================================
--- /branches/jhoblitt/ippdb/src/ippdb.h	(revision 7499)
+++ /branches/jhoblitt/ippdb/src/ippdb.h	(revision 7500)
@@ -4208,4 +4208,5 @@
 typedef struct {
     char            *det_type;
+    psS32           iteration;
 } detRunRow;
 
@@ -4216,5 +4217,6 @@
 
 detRunRow *detRunRowAlloc(
-    const char      *det_type
+    const char      *det_type,
+    psS32           iteration
 );
 
@@ -4246,5 +4248,6 @@
 bool detRunInsert(
     psDB            *dbh,               ///< Database handle
-    const char      *det_type
+    const char      *det_type,
+    psS32           iteration
 );
 
@@ -4256,5 +4259,6 @@
 bool detRunPop(
     psDB            *dbh,               ///< Database handle
-    char            **det_type
+    char            **det_type,
+    psS32           *iteration
 );
 
Index: /branches/jhoblitt/ippdb/tests/alloc.c
===================================================================
--- /branches/jhoblitt/ippdb/tests/alloc.c	(revision 7499)
+++ /branches/jhoblitt/ippdb/tests/alloc.c	(revision 7500)
@@ -880,5 +880,5 @@
         detRunRow       *object;
 
-        object = detRunRowAlloc("a string"    );
+        object = detRunRowAlloc("a string", -32    );
 
         if (!object) {
@@ -887,4 +887,8 @@
 
         if (strncmp(object->det_type, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (!object->iteration == -32) {
             psFree(object);
             exit(EXIT_FAILURE);
Index: /branches/jhoblitt/ippdb/tests/insert.c
===================================================================
--- /branches/jhoblitt/ippdb/tests/insert.c	(revision 7499)
+++ /branches/jhoblitt/ippdb/tests/insert.c	(revision 7500)
@@ -343,5 +343,5 @@
         }
 
-        if (!detRunInsert(dbh, "a string")) {
+        if (!detRunInsert(dbh, "a string", -32)) {
             exit(EXIT_FAILURE);
         }
Index: /branches/jhoblitt/ippdb/tests/insertobject.c
===================================================================
--- /branches/jhoblitt/ippdb/tests/insertobject.c	(revision 7499)
+++ /branches/jhoblitt/ippdb/tests/insertobject.c	(revision 7500)
@@ -498,5 +498,5 @@
         }
 
-        object = detRunRowAlloc("a string");
+        object = detRunRowAlloc("a string", -32);
         if (!object) {
             exit(EXIT_FAILURE);
Index: /branches/jhoblitt/ippdb/tests/metadatafromobject.c
===================================================================
--- /branches/jhoblitt/ippdb/tests/metadatafromobject.c	(revision 7499)
+++ /branches/jhoblitt/ippdb/tests/metadatafromobject.c	(revision 7500)
@@ -1059,5 +1059,5 @@
         bool            status;
 
-        object = detRunRowAlloc("a string");
+        object = detRunRowAlloc("a string", -32);
         if (!object) {
             exit(EXIT_FAILURE);
@@ -1072,4 +1072,8 @@
 
         if (strncmp(psMetadataLookupPtr(&status, md, "det_type"), "a string", MAX_STRING_LENGTH)) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (!psMetadataLookupS32(&status, md, "iteration") == -32) {
             psFree(md);
             exit(EXIT_FAILURE);
Index: /branches/jhoblitt/ippdb/tests/objectfrommetadata.c
===================================================================
--- /branches/jhoblitt/ippdb/tests/objectfrommetadata.c	(revision 7499)
+++ /branches/jhoblitt/ippdb/tests/objectfrommetadata.c	(revision 7500)
@@ -1581,4 +1581,8 @@
             exit(EXIT_FAILURE);
         }
+        if (!psMetadataAddS32(md, PS_LIST_TAIL, "iteration", 0, NULL, -32)) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
 
         object = detRunObjectFromMetadata(md);
@@ -1591,4 +1595,8 @@
 
         if (strncmp(object->det_type, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (!object->iteration == -32) {
             psFree(object);
             exit(EXIT_FAILURE);
Index: /branches/jhoblitt/ippdb/tests/pop.c
===================================================================
--- /branches/jhoblitt/ippdb/tests/pop.c	(revision 7499)
+++ /branches/jhoblitt/ippdb/tests/pop.c	(revision 7500)
@@ -484,11 +484,12 @@
         psDB            *dbh;
         char            det_type[256];
-
-        dbh = psDBInit("localhost", "test", NULL, "test");
-        if (!dbh) {
-            exit(EXIT_FAILURE);
-        }
-
-        if (!detRunPop(dbh, (char **)&det_type)) { 
+        psS32           iteration;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!detRunPop(dbh, (char **)&det_type, &iteration)) { 
             exit(EXIT_FAILURE);
         }
