Index: /trunk/dbconfig/config.md
===================================================================
--- /trunk/dbconfig/config.md	(revision 10988)
+++ /trunk/dbconfig/config.md	(revision 10989)
@@ -2,4 +2,4 @@
     pkg_name        STR     ippdb
     pkg_namespace   STR     ippdb
-    pkg_version     STR     0.0.68
+    pkg_version     STR     0.0.69
 END
Index: /trunk/dbconfig/tasks.md
===================================================================
--- /trunk/dbconfig/tasks.md	(revision 10988)
+++ /trunk/dbconfig/tasks.md	(revision 10989)
@@ -1,3 +1,3 @@
-# $Id: tasks.md,v 1.100 2006-12-01 00:45:06 jhoblitt Exp $
+# $Id: tasks.md,v 1.101 2007-01-09 02:08:31 jhoblitt Exp $
 
 # this table records all exposure ID ever seen from the summit
@@ -90,4 +90,5 @@
     exp_type    STR         64
     imfiles     S32         0
+    fault       S16         0       # NOT NULL
 END
 
@@ -99,4 +100,5 @@
     class_id    STR         64      # Primary Key
     uri         STR         255
+    fault       S16         0       # NOT NULL
 END
 
Index: /trunk/ippdb/configure.ac
===================================================================
--- /trunk/ippdb/configure.ac	(revision 10988)
+++ /trunk/ippdb/configure.ac	(revision 10989)
@@ -7,5 +7,5 @@
 AC_PREREQ(2.59)
 
-AC_INIT([ippdb], [0.0.68], [pan-starrs.ifa.hawaii.edu])
+AC_INIT([ippdb], [0.0.69], [pan-starrs.ifa.hawaii.edu])
 AC_CONFIG_SRCDIR([ippdb.pc.in])
 
Index: /trunk/ippdb/src/ippdb.c
===================================================================
--- /trunk/ippdb/src/ippdb.c	(revision 10988)
+++ /trunk/ippdb/src/ippdb.c	(revision 10989)
@@ -2800,5 +2800,5 @@
 static void newExpRowFree(newExpRow *object);
 
-newExpRow *newExpRowAlloc(const char *exp_tag, const char *exp_id, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, psS32 imfiles)
+newExpRow *newExpRowAlloc(const char *exp_tag, const char *exp_id, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, psS32 imfiles, psS16 fault)
 {
     newExpRow       *_object;
@@ -2814,4 +2814,5 @@
     _object->exp_type = psStringCopy(exp_type);
     _object->imfiles = imfiles;
+    _object->fault = fault;
 
     return _object;
@@ -2866,4 +2867,9 @@
         return false;
     }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, "NOT NULL", 0)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
+        psFree(md);
+        return false;
+    }
 
     bool status = psDBCreateTable(dbh, NEWEXP_TABLE_NAME, md);
@@ -2879,5 +2885,5 @@
 }
 
-bool newExpInsert(psDB * dbh, const char *exp_tag, const char *exp_id, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, psS32 imfiles)
+bool newExpInsert(psDB * dbh, const char *exp_tag, const char *exp_id, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, psS32 imfiles, psS16 fault)
 {
     psMetadata *md = psMetadataAlloc();
@@ -2914,4 +2920,9 @@
     if (!psMetadataAdd(md, PS_LIST_TAIL, "imfiles", PS_DATA_S32, NULL, imfiles)) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item imfiles");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, fault)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
         psFree(md);
         return false;
@@ -2940,5 +2951,5 @@
 bool newExpInsertObject(psDB *dbh, newExpRow *object)
 {
-    return newExpInsert(dbh, object->exp_tag, object->exp_id, object->camera, object->telescope, object->dateobs, object->exp_type, object->imfiles);
+    return newExpInsert(dbh, object->exp_tag, object->exp_id, object->camera, object->telescope, object->dateobs, object->exp_type, object->imfiles, object->fault);
 }
 
@@ -3048,4 +3059,9 @@
         return false;
     }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, object->fault)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
+        psFree(md);
+        return false;
+    }
 
 
@@ -3092,6 +3108,11 @@
         return false;
     }
-
-    return newExpRowAlloc(exp_tag, exp_id, camera, telescope, dateobs, exp_type, imfiles);
+    psS16 fault = psMetadataLookupS16(&status, md, "fault");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fault");
+        return false;
+    }
+
+    return newExpRowAlloc(exp_tag, exp_id, camera, telescope, dateobs, exp_type, imfiles, fault);
 }
 psArray *newExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
@@ -3205,5 +3226,5 @@
 static void newImfileRowFree(newImfileRow *object);
 
-newImfileRow *newImfileRowAlloc(const char *exp_tag, const char *class, const char *class_id, const char *uri)
+newImfileRow *newImfileRowAlloc(const char *exp_tag, const char *class, const char *class_id, const char *uri, psS16 fault)
 {
     newImfileRow    *_object;
@@ -3216,4 +3237,5 @@
     _object->class_id = psStringCopy(class_id);
     _object->uri = psStringCopy(uri);
+    _object->fault = fault;
 
     return _object;
@@ -3251,4 +3273,9 @@
         return false;
     }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, "NOT NULL", 0)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
+        psFree(md);
+        return false;
+    }
 
     bool status = psDBCreateTable(dbh, NEWIMFILE_TABLE_NAME, md);
@@ -3264,5 +3291,5 @@
 }
 
-bool newImfileInsert(psDB * dbh, const char *exp_tag, const char *class, const char *class_id, const char *uri)
+bool newImfileInsert(psDB * dbh, const char *exp_tag, const char *class, const char *class_id, const char *uri, psS16 fault)
 {
     psMetadata *md = psMetadataAlloc();
@@ -3284,4 +3311,9 @@
     if (!psMetadataAdd(md, PS_LIST_TAIL, "uri", PS_DATA_STRING, NULL, uri)) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item uri");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, fault)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
         psFree(md);
         return false;
@@ -3310,5 +3342,5 @@
 bool newImfileInsertObject(psDB *dbh, newImfileRow *object)
 {
-    return newImfileInsert(dbh, object->exp_tag, object->class, object->class_id, object->uri);
+    return newImfileInsert(dbh, object->exp_tag, object->class, object->class_id, object->uri, object->fault);
 }
 
@@ -3403,4 +3435,9 @@
         return false;
     }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, object->fault)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
+        psFree(md);
+        return false;
+    }
 
 
@@ -3432,6 +3469,11 @@
         return false;
     }
-
-    return newImfileRowAlloc(exp_tag, class, class_id, uri);
+    psS16 fault = psMetadataLookupS16(&status, md, "fault");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fault");
+        return false;
+    }
+
+    return newImfileRowAlloc(exp_tag, class, class_id, uri, fault);
 }
 psArray *newImfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
Index: /trunk/ippdb/src/ippdb.h
===================================================================
--- /trunk/ippdb/src/ippdb.h	(revision 10988)
+++ /trunk/ippdb/src/ippdb.h	(revision 10989)
@@ -1590,4 +1590,5 @@
     char            *exp_type;
     psS32           imfiles;
+    psS16           fault;
 } newExpRow;
 
@@ -1604,5 +1605,6 @@
     psTime*         dateobs,
     const char      *exp_type,
-    psS32           imfiles
+    psS32           imfiles,
+    psS16           fault
 );
 
@@ -1640,5 +1642,6 @@
     psTime*         dateobs,
     const char      *exp_type,
-    psS32           imfiles
+    psS32           imfiles,
+    psS16           fault
 );
 
@@ -1800,4 +1803,5 @@
     char            *class_id;
     char            *uri;
+    psS16           fault;
 } newImfileRow;
 
@@ -1811,5 +1815,6 @@
     const char      *class,
     const char      *class_id,
-    const char      *uri
+    const char      *uri,
+    psS16           fault
 );
 
@@ -1844,5 +1849,6 @@
     const char      *class,
     const char      *class_id,
-    const char      *uri
+    const char      *uri,
+    psS16           fault
 );
 
Index: /trunk/ippdb/tests/alloc.c
===================================================================
--- /trunk/ippdb/tests/alloc.c	(revision 10988)
+++ /trunk/ippdb/tests/alloc.c	(revision 10989)
@@ -244,5 +244,5 @@
         newExpRow       *object;
 
-        object = newExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32    );
+        object = newExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, -16    );
 
         if (!object) {
@@ -277,4 +277,7 @@
             exit(EXIT_FAILURE);
         }
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
 
         psFree(object);
@@ -284,5 +287,5 @@
         newImfileRow    *object;
 
-        object = newImfileRowAlloc("a string", "a string", "a string", "a string"    );
+        object = newImfileRowAlloc("a string", "a string", "a string", "a string", -16    );
 
         if (!object) {
@@ -303,4 +306,7 @@
         }
         if (strncmp(object->uri, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
             psFree(object);
             exit(EXIT_FAILURE);
Index: /trunk/ippdb/tests/insert.c
===================================================================
--- /trunk/ippdb/tests/insert.c	(revision 10988)
+++ /trunk/ippdb/tests/insert.c	(revision 10989)
@@ -118,20 +118,20 @@
         }
 
-        if (!newExpInsert(dbh, "a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32)) {
-            exit(EXIT_FAILURE);
-        }
-
-        psDBCleanup(dbh);
-    }
-
-    {
-        psDB            *dbh;
-
-        dbh = psDBInit("localhost", "test", NULL, "test");
-        if (!dbh) {
-            exit(EXIT_FAILURE);
-        }
-
-        if (!newImfileInsert(dbh, "a string", "a string", "a string", "a string")) {
+        if (!newExpInsert(dbh, "a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, -16)) {
+            exit(EXIT_FAILURE);
+        }
+
+        psDBCleanup(dbh);
+    }
+
+    {
+        psDB            *dbh;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!newImfileInsert(dbh, "a string", "a string", "a string", "a string", -16)) {
             exit(EXIT_FAILURE);
         }
Index: /trunk/ippdb/tests/insertobject.c
===================================================================
--- /trunk/ippdb/tests/insertobject.c	(revision 10988)
+++ /trunk/ippdb/tests/insertobject.c	(revision 10989)
@@ -168,5 +168,5 @@
         }
 
-        object = newExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32);
+        object = newExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, -16);
         if (!object) {
             exit(EXIT_FAILURE);
@@ -190,5 +190,5 @@
         }
 
-        object = newImfileRowAlloc("a string", "a string", "a string", "a string");
+        object = newImfileRowAlloc("a string", "a string", "a string", "a string", -16);
         if (!object) {
             exit(EXIT_FAILURE);
Index: /trunk/ippdb/tests/metadatafromobject.c
===================================================================
--- /trunk/ippdb/tests/metadatafromobject.c	(revision 10988)
+++ /trunk/ippdb/tests/metadatafromobject.c	(revision 10989)
@@ -302,5 +302,5 @@
         bool            status;
 
-        object = newExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32);
+        object = newExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, -16);
         if (!object) {
             exit(EXIT_FAILURE);
@@ -341,4 +341,7 @@
             exit(EXIT_FAILURE);
         }
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
 
         psFree(md);
@@ -350,5 +353,5 @@
         bool            status;
 
-        object = newImfileRowAlloc("a string", "a string", "a string", "a string");
+        object = newImfileRowAlloc("a string", "a string", "a string", "a string", -16);
         if (!object) {
             exit(EXIT_FAILURE);
@@ -375,4 +378,7 @@
         }
         if (strncmp(psMetadataLookupPtr(&status, md, "uri"), "a string", MAX_STRING_LENGTH)) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
             psFree(md);
             exit(EXIT_FAILURE);
Index: /trunk/ippdb/tests/objectfrommetadata.c
===================================================================
--- /trunk/ippdb/tests/objectfrommetadata.c	(revision 10988)
+++ /trunk/ippdb/tests/objectfrommetadata.c	(revision 10989)
@@ -450,4 +450,7 @@
             exit(EXIT_FAILURE);
         }
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
 
         object = newExpObjectFromMetadata(md);
@@ -486,4 +489,7 @@
             exit(EXIT_FAILURE);
         }
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
 
         psFree(object);
@@ -511,4 +517,7 @@
             exit(EXIT_FAILURE);
         }
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
 
         object = newImfileObjectFromMetadata(md);
@@ -533,4 +542,7 @@
         }
         if (strncmp(object->uri, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
             psFree(object);
             exit(EXIT_FAILURE);
