Index: trunk/ippdb/src/ippdb.c
===================================================================
--- trunk/ippdb/src/ippdb.c	(revision 10753)
+++ 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)
