Index: /trunk/ippdb/Makefile.am
===================================================================
--- /trunk/ippdb/Makefile.am	(revision 18043)
+++ /trunk/ippdb/Makefile.am	(revision 18044)
@@ -26,4 +26,7 @@
     $(top_builddir)/docs/man/man3/camProcessedExpRow.3 \
     $(top_builddir)/docs/man/man3/camMaskRow.3 \
+    $(top_builddir)/docs/man/man3/fakeRunRow.3 \
+    $(top_builddir)/docs/man/man3/fakeProcessedImfileRow.3 \
+    $(top_builddir)/docs/man/man3/fakeMaskRow.3 \
     $(top_builddir)/docs/man/man3/warpRunRow.3 \
     $(top_builddir)/docs/man/man3/warpSkyCellMapRow.3 \
@@ -65,5 +68,5 @@
 
 
-docs/man/man3/ippdb.3 docs/man/man3/pzDataStoreRow.3 docs/man/man3/summitExpRow.3 docs/man/man3/summitImfileRow.3 docs/man/man3/pzDownloadExpRow.3 docs/man/man3/pzDownloadImfileRow.3 docs/man/man3/newExpRow.3 docs/man/man3/newImfileRow.3 docs/man/man3/rawExpRow.3 docs/man/man3/rawImfileRow.3 docs/man/man3/guidePendingExpRow.3 docs/man/man3/chipRunRow.3 docs/man/man3/chipProcessedImfileRow.3 docs/man/man3/chipMaskRow.3 docs/man/man3/camRunRow.3 docs/man/man3/camProcessedExpRow.3 docs/man/man3/camMaskRow.3 docs/man/man3/warpRunRow.3 docs/man/man3/warpSkyCellMapRow.3 docs/man/man3/warpSkyfileRow.3 docs/man/man3/warpMaskRow.3 docs/man/man3/diffRunRow.3 docs/man/man3/diffInputSkyfileRow.3 docs/man/man3/diffSkyfileRow.3 docs/man/man3/stackRunRow.3 docs/man/man3/stackInputSkyfileRow.3 docs/man/man3/stackSumSkyfileRow.3 docs/man/man3/detRunRow.3 docs/man/man3/detInputExpRow.3 docs/man/man3/detProcessedImfileRow.3 docs/man/man3/detProcessedExpRow.3 docs/man/man3/detStackedImfileRow.3 docs/man/man3/detNormalizedStatImfileRow.3 docs/man/man3/detNormalizedImfileRow.3 docs/man/man3/detNormalizedExpRow.3 docs/man/man3/detResidImfileRow.3 docs/man/man3/detResidExpRow.3 docs/man/man3/detRunSummaryRow.3 docs/man/man3/detRegisteredImfileRow.3 docs/man/man3/detCorrectedExpRow.3 docs/man/man3/detCorrectedImfileRow.3 docs/man/man3/magicRunRow.3 docs/man/man3/magicInputSkyfileRow.3 docs/man/man3/magicTreeRow.3 docs/man/man3/magicNodeResultRow.3 docs/man/man3/magicMaskRow.3 docs/man/man3/magicSkyfileMaskRow.3 docs/man/man3/calDBRow.3 docs/man/man3/calRunRow.3 docs/man/man3/flatcorrRunRow.3 docs/man/man3/flatcorrExpRow.3 docs/man/man3/pstampDataStoreRow.3 docs/man/man3/pstampRequestRow.3 docs/man/man3/pstampJobRow.3:
+docs/man/man3/ippdb.3 docs/man/man3/pzDataStoreRow.3 docs/man/man3/summitExpRow.3 docs/man/man3/summitImfileRow.3 docs/man/man3/pzDownloadExpRow.3 docs/man/man3/pzDownloadImfileRow.3 docs/man/man3/newExpRow.3 docs/man/man3/newImfileRow.3 docs/man/man3/rawExpRow.3 docs/man/man3/rawImfileRow.3 docs/man/man3/guidePendingExpRow.3 docs/man/man3/chipRunRow.3 docs/man/man3/chipProcessedImfileRow.3 docs/man/man3/chipMaskRow.3 docs/man/man3/camRunRow.3 docs/man/man3/camProcessedExpRow.3 docs/man/man3/camMaskRow.3 docs/man/man3/fakeRunRow.3 docs/man/man3/fakeProcessedImfileRow.3 docs/man/man3/fakeMaskRow.3 docs/man/man3/warpRunRow.3 docs/man/man3/warpSkyCellMapRow.3 docs/man/man3/warpSkyfileRow.3 docs/man/man3/warpMaskRow.3 docs/man/man3/diffRunRow.3 docs/man/man3/diffInputSkyfileRow.3 docs/man/man3/diffSkyfileRow.3 docs/man/man3/stackRunRow.3 docs/man/man3/stackInputSkyfileRow.3 docs/man/man3/stackSumSkyfileRow.3 docs/man/man3/detRunRow.3 docs/man/man3/detInputExpRow.3 docs/man/man3/detProcessedImfileRow.3 docs/man/man3/detProcessedExpRow.3 docs/man/man3/detStackedImfileRow.3 docs/man/man3/detNormalizedStatImfileRow.3 docs/man/man3/detNormalizedImfileRow.3 docs/man/man3/detNormalizedExpRow.3 docs/man/man3/detResidImfileRow.3 docs/man/man3/detResidExpRow.3 docs/man/man3/detRunSummaryRow.3 docs/man/man3/detRegisteredImfileRow.3 docs/man/man3/detCorrectedExpRow.3 docs/man/man3/detCorrectedImfileRow.3 docs/man/man3/magicRunRow.3 docs/man/man3/magicInputSkyfileRow.3 docs/man/man3/magicTreeRow.3 docs/man/man3/magicNodeResultRow.3 docs/man/man3/magicMaskRow.3 docs/man/man3/magicSkyfileMaskRow.3 docs/man/man3/calDBRow.3 docs/man/man3/calRunRow.3 docs/man/man3/flatcorrRunRow.3 docs/man/man3/flatcorrExpRow.3 docs/man/man3/pstampDataStoreRow.3 docs/man/man3/pstampRequestRow.3 docs/man/man3/pstampJobRow.3:
 	$(DOXYGEN)
 
Index: /trunk/ippdb/src/ippdb.c
===================================================================
--- /trunk/ippdb/src/ippdb.c	(revision 18043)
+++ /trunk/ippdb/src/ippdb.c	(revision 18044)
@@ -47,4 +47,7 @@
 #define CAMPROCESSEDEXP_TABLE_NAME "camProcessedExp"
 #define CAMMASK_TABLE_NAME "camMask"
+#define FAKERUN_TABLE_NAME "fakeRun"
+#define FAKEPROCESSEDIMFILE_TABLE_NAME "fakeProcessedImfile"
+#define FAKEMASK_TABLE_NAME "fakeMask"
 #define WARPRUN_TABLE_NAME "warpRun"
 #define WARPSKYCELLMAP_TABLE_NAME "warpSkyCellMap"
@@ -8617,5 +8620,5 @@
 static void camProcessedExpRowFree(camProcessedExpRow *object);
 
-camProcessedExpRow *camProcessedExpRowAlloc(psS64 cam_id, psS64 chip_id, const char *uri, psF32 bg, psF32 bg_stdev, psF32 bg_mean_stdev, psF32 bias, psF32 bias_stdev, psF32 fringe_0, psF32 fringe_1, psF32 fringe_2, psF32 sigma_ra, psF32 sigma_dec, psF32 ap_resid, psF32 ap_resid_stdev, psF32 zp_mean, psF32 zp_stdev, psF32 fwhm_major, psF32 fwhm_minor, psF32 dtime_detrend, psF32 dtime_photom, psF32 dtime_astrom, const char *hostname, psS32 n_stars, psS32 n_extended, psS32 n_cr, psS32 n_astrom, const char *path_base, psS16 fault)
+camProcessedExpRow *camProcessedExpRowAlloc(psS64 cam_id, const char *uri, psF32 bg, psF32 bg_stdev, psF32 bg_mean_stdev, psF32 bias, psF32 bias_stdev, psF32 fringe_0, psF32 fringe_1, psF32 fringe_2, psF32 sigma_ra, psF32 sigma_dec, psF32 ap_resid, psF32 ap_resid_stdev, psF32 zp_mean, psF32 zp_stdev, psF32 fwhm_major, psF32 fwhm_minor, psF32 dtime_detrend, psF32 dtime_photom, psF32 dtime_astrom, const char *hostname, psS32 n_stars, psS32 n_extended, psS32 n_cr, psS32 n_astrom, const char *path_base, psS16 fault)
 {
     camProcessedExpRow *_object;
@@ -8625,5 +8628,4 @@
 
     _object->cam_id = cam_id;
-    _object->chip_id = chip_id;
     _object->uri = psStringCopy(uri);
     _object->bg = bg;
@@ -8672,10 +8674,5 @@
         return false;
     }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "chip_id", PS_DATA_S64, "Primary Key fkey(cam_id, chip_id) ref camRun(cam_id, chip_id)", 0)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id");
-        psFree(md);
-        return false;
-    }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "uri", PS_DATA_STRING, NULL, "255")) {
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "uri", PS_DATA_STRING, "fkey(cam_id) ref camRun(cam_id)", "255")) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item uri");
         psFree(md);
@@ -8825,14 +8822,9 @@
 }
 
-bool camProcessedExpInsert(psDB * dbh, psS64 cam_id, psS64 chip_id, const char *uri, psF32 bg, psF32 bg_stdev, psF32 bg_mean_stdev, psF32 bias, psF32 bias_stdev, psF32 fringe_0, psF32 fringe_1, psF32 fringe_2, psF32 sigma_ra, psF32 sigma_dec, psF32 ap_resid, psF32 ap_resid_stdev, psF32 zp_mean, psF32 zp_stdev, psF32 fwhm_major, psF32 fwhm_minor, psF32 dtime_detrend, psF32 dtime_photom, psF32 dtime_astrom, const char *hostname, psS32 n_stars, psS32 n_extended, psS32 n_cr, psS32 n_astrom, const char *path_base, psS16 fault)
+bool camProcessedExpInsert(psDB * dbh, psS64 cam_id, const char *uri, psF32 bg, psF32 bg_stdev, psF32 bg_mean_stdev, psF32 bias, psF32 bias_stdev, psF32 fringe_0, psF32 fringe_1, psF32 fringe_2, psF32 sigma_ra, psF32 sigma_dec, psF32 ap_resid, psF32 ap_resid_stdev, psF32 zp_mean, psF32 zp_stdev, psF32 fwhm_major, psF32 fwhm_minor, psF32 dtime_detrend, psF32 dtime_photom, psF32 dtime_astrom, const char *hostname, psS32 n_stars, psS32 n_extended, psS32 n_cr, psS32 n_astrom, const char *path_base, psS16 fault)
 {
     psMetadata *md = psMetadataAlloc();
     if (!psMetadataAdd(md, PS_LIST_TAIL, "cam_id", PS_DATA_S64, NULL, cam_id)) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item cam_id");
-        psFree(md);
-        return false;
-    }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "chip_id", PS_DATA_S64, NULL, chip_id)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id");
         psFree(md);
         return false;
@@ -8996,5 +8988,5 @@
 bool camProcessedExpInsertObject(psDB *dbh, camProcessedExpRow *object)
 {
-    return camProcessedExpInsert(dbh, object->cam_id, object->chip_id, object->uri, object->bg, object->bg_stdev, object->bg_mean_stdev, object->bias, object->bias_stdev, object->fringe_0, object->fringe_1, object->fringe_2, object->sigma_ra, object->sigma_dec, object->ap_resid, object->ap_resid_stdev, object->zp_mean, object->zp_stdev, object->fwhm_major, object->fwhm_minor, object->dtime_detrend, object->dtime_photom, object->dtime_astrom, object->hostname, object->n_stars, object->n_extended, object->n_cr, object->n_astrom, object->path_base, object->fault);
+    return camProcessedExpInsert(dbh, object->cam_id, object->uri, object->bg, object->bg_stdev, object->bg_mean_stdev, object->bias, object->bias_stdev, object->fringe_0, object->fringe_1, object->fringe_2, object->sigma_ra, object->sigma_dec, object->ap_resid, object->ap_resid_stdev, object->zp_mean, object->zp_stdev, object->fwhm_major, object->fwhm_minor, object->dtime_detrend, object->dtime_photom, object->dtime_astrom, object->hostname, object->n_stars, object->n_extended, object->n_cr, object->n_astrom, object->path_base, object->fault);
 }
 
@@ -9074,9 +9066,4 @@
         return false;
     }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "chip_id", PS_DATA_S64, NULL, object->chip_id)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id");
-        psFree(md);
-        return false;
-    }
     if (!psMetadataAdd(md, PS_LIST_TAIL, "uri", PS_DATA_STRING, NULL, object->uri)) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item uri");
@@ -9228,9 +9215,4 @@
         return false;
     }
-    psS64 chip_id = psMetadataLookupS64(&status, md, "chip_id");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item chip_id");
-        return false;
-    }
     char* uri = psMetadataLookupPtr(&status, md, "uri");
     if (!status) {
@@ -9369,5 +9351,5 @@
     }
 
-    return camProcessedExpRowAlloc(cam_id, chip_id, uri, bg, bg_stdev, bg_mean_stdev, bias, bias_stdev, fringe_0, fringe_1, fringe_2, sigma_ra, sigma_dec, ap_resid, ap_resid_stdev, zp_mean, zp_stdev, fwhm_major, fwhm_minor, dtime_detrend, dtime_photom, dtime_astrom, hostname, n_stars, n_extended, n_cr, n_astrom, path_base, fault);
+    return camProcessedExpRowAlloc(cam_id, uri, bg, bg_stdev, bg_mean_stdev, bias, bias_stdev, fringe_0, fringe_1, fringe_2, sigma_ra, sigma_dec, ap_resid, ap_resid_stdev, zp_mean, zp_stdev, fwhm_major, fwhm_minor, dtime_detrend, dtime_photom, dtime_astrom, hostname, n_stars, n_extended, n_cr, n_astrom, path_base, fault);
 }
 psArray *camProcessedExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
@@ -9765,7 +9747,1237 @@
     return true;
 }
+static void fakeRunRowFree(fakeRunRow *object);
+
+fakeRunRow *fakeRunRowAlloc(psS64 fake_id, psS64 cam_id, const char *state, const char *workdir, const char *label, const char *reduction, const char *expgroup, const char *dvodb, const char *tess_id, const char *end_stage, psTime* epoch)
+{
+    fakeRunRow      *_object;
+
+    _object = psAlloc(sizeof(fakeRunRow));
+    psMemSetDeallocator(_object, (psFreeFunc)fakeRunRowFree);
+
+    _object->fake_id = fake_id;
+    _object->cam_id = cam_id;
+    _object->state = psStringCopy(state);
+    _object->workdir = psStringCopy(workdir);
+    _object->label = psStringCopy(label);
+    _object->reduction = psStringCopy(reduction);
+    _object->expgroup = psStringCopy(expgroup);
+    _object->dvodb = psStringCopy(dvodb);
+    _object->tess_id = psStringCopy(tess_id);
+    _object->end_stage = psStringCopy(end_stage);
+    _object->epoch = psTimeCopy(epoch);
+
+    return _object;
+}
+
+static void fakeRunRowFree(fakeRunRow *object)
+{
+    psFree(object->state);
+    psFree(object->workdir);
+    psFree(object->label);
+    psFree(object->reduction);
+    psFree(object->expgroup);
+    psFree(object->dvodb);
+    psFree(object->tess_id);
+    psFree(object->end_stage);
+    psFree(object->epoch);
+}
+
+bool fakeRunCreateTable(psDB *dbh)
+{
+    psMetadata *md = psMetadataAlloc();
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "fake_id", PS_DATA_S64, "Primary Key AUTO_INCREMENT", 0)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item fake_id");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "cam_id", PS_DATA_S64, "Key INDEX(fake_id, cam_id) fkey (cam_id) ref camRun(cam_id)", 0)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item cam_id");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "state", PS_DATA_STRING, "Key", "64")) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item state");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "workdir", PS_DATA_STRING, NULL, "255")) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item workdir");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "label", PS_DATA_STRING, "Key", "64")) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item label");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "reduction", PS_DATA_STRING, "Reduction class", "64")) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item reduction");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "expgroup", PS_DATA_STRING, "Key", "64")) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item expgroup");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "dvodb", PS_DATA_STRING, NULL, "255")) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item dvodb");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "tess_id", PS_DATA_STRING, NULL, "64")) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item tess_id");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "end_stage", PS_DATA_STRING, "Key", "64")) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item end_stage");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "epoch", PS_DATA_TIME, NULL, NULL)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item epoch");
+        psFree(md);
+        return false;
+    }
+
+    bool status = psDBCreateTable(dbh, FAKERUN_TABLE_NAME, md);
+
+    psFree(md);
+
+    return status;
+}
+
+bool fakeRunDropTable(psDB *dbh)
+{
+    return psDBDropTable(dbh, FAKERUN_TABLE_NAME);
+}
+
+bool fakeRunInsert(psDB * dbh, psS64 fake_id, psS64 cam_id, const char *state, const char *workdir, const char *label, const char *reduction, const char *expgroup, const char *dvodb, const char *tess_id, const char *end_stage, psTime* epoch)
+{
+    psMetadata *md = psMetadataAlloc();
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "fake_id", PS_DATA_S64, NULL, fake_id)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item fake_id");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "cam_id", PS_DATA_S64, NULL, cam_id)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item cam_id");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "state", PS_DATA_STRING, NULL, state)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item state");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "workdir", PS_DATA_STRING, NULL, workdir)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item workdir");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "label", PS_DATA_STRING, NULL, label)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item label");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "reduction", PS_DATA_STRING, NULL, reduction)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item reduction");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "expgroup", PS_DATA_STRING, NULL, expgroup)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item expgroup");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "dvodb", PS_DATA_STRING, NULL, dvodb)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item dvodb");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "tess_id", PS_DATA_STRING, NULL, tess_id)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item tess_id");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "end_stage", PS_DATA_STRING, NULL, end_stage)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item end_stage");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "epoch", PS_DATA_TIME, NULL, epoch)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item epoch");
+        psFree(md);
+        return false;
+    }
+
+    bool status = psDBInsertOneRow(dbh, FAKERUN_TABLE_NAME, md);
+    psFree(md);
+
+    return status;
+}
+
+long long fakeRunDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)
+{
+    long long       deleted = 0;
+
+    long long count = psDBDeleteRows(dbh, FAKERUN_TABLE_NAME, where, limit);
+    if (count < 0) {
+        psError(PS_ERR_UNKNOWN, true, "failed to delete row from fakeRun");
+        return count;
+
+        deleted += count;
+    }
+
+    return deleted;
+}
+bool fakeRunInsertObject(psDB *dbh, fakeRunRow *object)
+{
+    return fakeRunInsert(dbh, object->fake_id, object->cam_id, object->state, object->workdir, object->label, object->reduction, object->expgroup, object->dvodb, object->tess_id, object->end_stage, object->epoch);
+}
+
+bool fakeRunInsertObjects(psDB *dbh, psArray *objects)
+{
+    for (long i = 0; i < psArrayLength(objects); i++) {
+        if (!fakeRunInsertObject(dbh, objects->data[i])) {
+            return false;
+        }
+    }
+
+    return true;
+}
+
+bool fakeRunInsertFits(psDB *dbh, const psFits *fits)
+{
+    psArray         *rowSet;
+
+    // move to (the first?) extension named  FAKERUN_TABLE_NAME
+    if (!psFitsMoveExtName(fits, FAKERUN_TABLE_NAME)) {
+        psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", FAKERUN_TABLE_NAME);
+        return false;
+    }
+
+    // check HDU type
+    if (psFitsGetExtType(fits) != PS_FITS_TYPE_BINARY_TABLE)  {
+        psError(PS_ERR_UNKNOWN, true, "FITS HDU type is not PS_FITS_TYPE_BINARY_TABLE");
+        return false;
+    }
+
+    // read fits table
+    rowSet = psFitsReadTable(fits);
+    if (!rowSet) {
+        psError(PS_ERR_UNKNOWN, true, "FITS read error or FITS table is empty");
+        psFree(rowSet);
+        return false;
+    }
+
+    if (!psDBInsertRows(dbh, FAKERUN_TABLE_NAME, rowSet)) {
+        psError(PS_ERR_UNKNOWN, false, "databse insert failed");
+        psFree(rowSet);
+        return false;
+    }
+
+    psFree(rowSet);
+
+    return true;
+}
+
+bool fakeRunSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)
+{
+    psArray         *rowSet;
+
+    rowSet = psDBSelectRows(dbh, FAKERUN_TABLE_NAME, where, limit);
+    if (!rowSet) {
+        return false;
+    }
+
+    // output to fits
+    if (!psFitsWriteTable(fits, NULL, rowSet, FAKERUN_TABLE_NAME)) {
+        psError(PS_ERR_UNKNOWN, false, "FITS table write failed");
+        psFree(rowSet);
+        return false;
+    }
+
+    psFree(rowSet);
+
+    return true;
+}
+
+psMetadata *fakeRunMetadataFromObject(const fakeRunRow *object)
+{
+    psMetadata *md = psMetadataAlloc();
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "fake_id", PS_DATA_S64, NULL, object->fake_id)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item fake_id");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "cam_id", PS_DATA_S64, NULL, object->cam_id)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item cam_id");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "state", PS_DATA_STRING, NULL, object->state)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item state");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "workdir", PS_DATA_STRING, NULL, object->workdir)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item workdir");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "label", PS_DATA_STRING, NULL, object->label)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item label");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "reduction", PS_DATA_STRING, NULL, object->reduction)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item reduction");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "expgroup", PS_DATA_STRING, NULL, object->expgroup)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item expgroup");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "dvodb", PS_DATA_STRING, NULL, object->dvodb)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item dvodb");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "tess_id", PS_DATA_STRING, NULL, object->tess_id)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item tess_id");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "end_stage", PS_DATA_STRING, NULL, object->end_stage)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item end_stage");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "epoch", PS_DATA_TIME, NULL, object->epoch)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item epoch");
+        psFree(md);
+        return false;
+    }
+
+
+    return md;
+}
+
+fakeRunRow *fakeRunObjectFromMetadata(psMetadata *md)
+{
+
+bool status = false;
+    psS64 fake_id = psMetadataLookupS64(&status, md, "fake_id");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fake_id");
+        return false;
+    }
+    psS64 cam_id = psMetadataLookupS64(&status, md, "cam_id");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item cam_id");
+        return false;
+    }
+    char* state = psMetadataLookupPtr(&status, md, "state");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item state");
+        return false;
+    }
+    char* workdir = psMetadataLookupPtr(&status, md, "workdir");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item workdir");
+        return false;
+    }
+    char* label = psMetadataLookupPtr(&status, md, "label");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item label");
+        return false;
+    }
+    char* reduction = psMetadataLookupPtr(&status, md, "reduction");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item reduction");
+        return false;
+    }
+    char* expgroup = psMetadataLookupPtr(&status, md, "expgroup");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item expgroup");
+        return false;
+    }
+    char* dvodb = psMetadataLookupPtr(&status, md, "dvodb");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item dvodb");
+        return false;
+    }
+    char* tess_id = psMetadataLookupPtr(&status, md, "tess_id");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item tess_id");
+        return false;
+    }
+    char* end_stage = psMetadataLookupPtr(&status, md, "end_stage");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item end_stage");
+        return false;
+    }
+    psTime* epoch = psMetadataLookupPtr(&status, md, "epoch");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item epoch");
+        return false;
+    }
+
+    return fakeRunRowAlloc(fake_id, cam_id, state, workdir, label, reduction, expgroup, dvodb, tess_id, end_stage, epoch);
+}
+psArray *fakeRunSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
+{
+    psArray         *rowSet;
+    psArray         *returnSet;
+    psU64           i;
+
+    rowSet = psDBSelectRows(dbh, FAKERUN_TABLE_NAME, where, limit);
+    if (!rowSet) {
+        return NULL;
+    }
+
+    // convert psMetadata rows to row objects
+
+    returnSet = psArrayAllocEmpty(rowSet->n);
+
+    for (i = 0; i < rowSet->n; i++) {
+        fakeRunRow *object = fakeRunObjectFromMetadata(rowSet->data[i]);
+        if (!object) {
+            psFree(object);
+            psFree(returnSet);
+            psError(PS_ERR_UNKNOWN, false, "database error");
+            return NULL;
+        }
+        psArrayAdd(returnSet, 0, object);
+        psFree(object);
+    }
+
+    psFree(rowSet);
+
+    return returnSet;
+}
+bool fakeRunDeleteObject(psDB *dbh, const fakeRunRow *object)
+{
+    psMetadata *where = fakeRunMetadataFromObject(object);
+    long long count = psDBDeleteRows(dbh, FAKERUN_TABLE_NAME, where, 0);
+    psFree(where);
+    if (count < 0) {
+        psError(PS_ERR_UNKNOWN, true, "failed to delete row from fakeRun");
+        return false;
+    }
+    if (count > 1) {
+        // XXX should this be a psAbort() instead?  It is possible that
+        // having an object match multiple rows was by design.
+        psError(PS_ERR_UNKNOWN, true, "fakeRunRow object matched more then one row.  Check your database schema");
+        return false;
+    }
+
+    return true;
+}
+long long fakeRunDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)
+{
+    long long       deleted = 0;
+
+    for (long long i = 0; i < objects->n; i++) {
+        fakeRunRow *object = objects->data[i];
+        psMetadata *where = fakeRunMetadataFromObject(object);
+        long long count = psDBDeleteRows(dbh, FAKERUN_TABLE_NAME, where, limit);
+        psFree(where);
+        if (count < 0) {
+            psError(PS_ERR_UNKNOWN, true, "failed to delete row from fakeRun");
+            return count;
+        }
+
+        deleted += count;
+    }
+
+    return deleted;
+}
+bool fakeRunPrintObjects(FILE *stream, psArray *objects, bool mdcf)
+{
+    PS_ASSERT_PTR_NON_NULL(objects, false);
+
+    psMetadata *output = psMetadataAlloc();
+    for (long i = 0; i < psArrayLength(objects); i++) {
+        psMetadata *md = fakeRunMetadataFromObject(objects->data[i]);
+        if (!psMetadataAddMetadata(
+            output,
+            PS_LIST_TAIL,
+            FAKERUN_TABLE_NAME,
+            PS_META_DUPLICATE_OK,
+            NULL,
+            md
+        )) {
+            psError(PS_ERR_UNKNOWN, false, "failed to add metadata");
+            psFree(md);
+            psFree(output);
+            return false;
+        }
+        psFree(md);
+    }
+
+    if (!ippdbPrintMetadataRaw(stream, output, mdcf)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to print metadata");
+        psFree(output);
+    }
+    psFree(output);
+
+    return true;
+}
+bool fakeRunPrintObject(FILE *stream, fakeRunRow *object, bool mdcf)
+{
+    PS_ASSERT_PTR_NON_NULL(object, false);
+
+    psMetadata *md = fakeRunMetadataFromObject(object);
+
+    if (!ippdbPrintMetadataRaw(stream, md, mdcf)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to print metadata");
+        psFree(md);
+    }
+
+    psFree(md);
+
+    return true;
+}
+static void fakeProcessedImfileRowFree(fakeProcessedImfileRow *object);
+
+fakeProcessedImfileRow *fakeProcessedImfileRowAlloc(psS64 fake_id, psS64 exp_id, const char *class_id, const char *uri, psF32 dtime_fake, const char *hostname, const char *path_base, psS16 fault, psTime* epoch)
+{
+    fakeProcessedImfileRow *_object;
+
+    _object = psAlloc(sizeof(fakeProcessedImfileRow));
+    psMemSetDeallocator(_object, (psFreeFunc)fakeProcessedImfileRowFree);
+
+    _object->fake_id = fake_id;
+    _object->exp_id = exp_id;
+    _object->class_id = psStringCopy(class_id);
+    _object->uri = psStringCopy(uri);
+    _object->dtime_fake = dtime_fake;
+    _object->hostname = psStringCopy(hostname);
+    _object->path_base = psStringCopy(path_base);
+    _object->fault = fault;
+    _object->epoch = psTimeCopy(epoch);
+
+    return _object;
+}
+
+static void fakeProcessedImfileRowFree(fakeProcessedImfileRow *object)
+{
+    psFree(object->class_id);
+    psFree(object->uri);
+    psFree(object->hostname);
+    psFree(object->path_base);
+    psFree(object->epoch);
+}
+
+bool fakeProcessedImfileCreateTable(psDB *dbh)
+{
+    psMetadata *md = psMetadataAlloc();
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "fake_id", PS_DATA_S64, "Primary Key fkey (fake_id) ref fakeRun(fake_id)", 0)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item fake_id");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_id", PS_DATA_S64, "Primary Key fkey (exp_id, class_id) ref rawImfile(exp_id, class_id)", 64)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "class_id", PS_DATA_STRING, "Primary Key", "64")) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item class_id");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "uri", PS_DATA_STRING, NULL, "255")) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item uri");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "dtime_fake", PS_DATA_F32, NULL, 0.0)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item dtime_fake");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "hostname", PS_DATA_STRING, NULL, "64")) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item hostname");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "path_base", PS_DATA_STRING, NULL, "255")) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item path_base");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, "Key NOT NULL", 0)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "epoch", PS_DATA_TIME, NULL, NULL)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item epoch");
+        psFree(md);
+        return false;
+    }
+
+    bool status = psDBCreateTable(dbh, FAKEPROCESSEDIMFILE_TABLE_NAME, md);
+
+    psFree(md);
+
+    return status;
+}
+
+bool fakeProcessedImfileDropTable(psDB *dbh)
+{
+    return psDBDropTable(dbh, FAKEPROCESSEDIMFILE_TABLE_NAME);
+}
+
+bool fakeProcessedImfileInsert(psDB * dbh, psS64 fake_id, psS64 exp_id, const char *class_id, const char *uri, psF32 dtime_fake, const char *hostname, const char *path_base, psS16 fault, psTime* epoch)
+{
+    psMetadata *md = psMetadataAlloc();
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "fake_id", PS_DATA_S64, NULL, fake_id)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item fake_id");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_id", PS_DATA_S64, NULL, exp_id)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "class_id", PS_DATA_STRING, NULL, class_id)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item class_id");
+        psFree(md);
+        return false;
+    }
+    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, "dtime_fake", PS_DATA_F32, NULL, dtime_fake)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item dtime_fake");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "hostname", PS_DATA_STRING, NULL, hostname)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item hostname");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "path_base", PS_DATA_STRING, NULL, path_base)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item path_base");
+        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;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "epoch", PS_DATA_TIME, NULL, epoch)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item epoch");
+        psFree(md);
+        return false;
+    }
+
+    bool status = psDBInsertOneRow(dbh, FAKEPROCESSEDIMFILE_TABLE_NAME, md);
+    psFree(md);
+
+    return status;
+}
+
+long long fakeProcessedImfileDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)
+{
+    long long       deleted = 0;
+
+    long long count = psDBDeleteRows(dbh, FAKEPROCESSEDIMFILE_TABLE_NAME, where, limit);
+    if (count < 0) {
+        psError(PS_ERR_UNKNOWN, true, "failed to delete row from fakeProcessedImfile");
+        return count;
+
+        deleted += count;
+    }
+
+    return deleted;
+}
+bool fakeProcessedImfileInsertObject(psDB *dbh, fakeProcessedImfileRow *object)
+{
+    return fakeProcessedImfileInsert(dbh, object->fake_id, object->exp_id, object->class_id, object->uri, object->dtime_fake, object->hostname, object->path_base, object->fault, object->epoch);
+}
+
+bool fakeProcessedImfileInsertObjects(psDB *dbh, psArray *objects)
+{
+    for (long i = 0; i < psArrayLength(objects); i++) {
+        if (!fakeProcessedImfileInsertObject(dbh, objects->data[i])) {
+            return false;
+        }
+    }
+
+    return true;
+}
+
+bool fakeProcessedImfileInsertFits(psDB *dbh, const psFits *fits)
+{
+    psArray         *rowSet;
+
+    // move to (the first?) extension named  FAKEPROCESSEDIMFILE_TABLE_NAME
+    if (!psFitsMoveExtName(fits, FAKEPROCESSEDIMFILE_TABLE_NAME)) {
+        psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", FAKEPROCESSEDIMFILE_TABLE_NAME);
+        return false;
+    }
+
+    // check HDU type
+    if (psFitsGetExtType(fits) != PS_FITS_TYPE_BINARY_TABLE)  {
+        psError(PS_ERR_UNKNOWN, true, "FITS HDU type is not PS_FITS_TYPE_BINARY_TABLE");
+        return false;
+    }
+
+    // read fits table
+    rowSet = psFitsReadTable(fits);
+    if (!rowSet) {
+        psError(PS_ERR_UNKNOWN, true, "FITS read error or FITS table is empty");
+        psFree(rowSet);
+        return false;
+    }
+
+    if (!psDBInsertRows(dbh, FAKEPROCESSEDIMFILE_TABLE_NAME, rowSet)) {
+        psError(PS_ERR_UNKNOWN, false, "databse insert failed");
+        psFree(rowSet);
+        return false;
+    }
+
+    psFree(rowSet);
+
+    return true;
+}
+
+bool fakeProcessedImfileSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)
+{
+    psArray         *rowSet;
+
+    rowSet = psDBSelectRows(dbh, FAKEPROCESSEDIMFILE_TABLE_NAME, where, limit);
+    if (!rowSet) {
+        return false;
+    }
+
+    // output to fits
+    if (!psFitsWriteTable(fits, NULL, rowSet, FAKEPROCESSEDIMFILE_TABLE_NAME)) {
+        psError(PS_ERR_UNKNOWN, false, "FITS table write failed");
+        psFree(rowSet);
+        return false;
+    }
+
+    psFree(rowSet);
+
+    return true;
+}
+
+psMetadata *fakeProcessedImfileMetadataFromObject(const fakeProcessedImfileRow *object)
+{
+    psMetadata *md = psMetadataAlloc();
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "fake_id", PS_DATA_S64, NULL, object->fake_id)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item fake_id");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_id", PS_DATA_S64, NULL, object->exp_id)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "class_id", PS_DATA_STRING, NULL, object->class_id)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item class_id");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "uri", PS_DATA_STRING, NULL, object->uri)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item uri");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "dtime_fake", PS_DATA_F32, NULL, object->dtime_fake)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item dtime_fake");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "hostname", PS_DATA_STRING, NULL, object->hostname)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item hostname");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "path_base", PS_DATA_STRING, NULL, object->path_base)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item path_base");
+        psFree(md);
+        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;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "epoch", PS_DATA_TIME, NULL, object->epoch)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item epoch");
+        psFree(md);
+        return false;
+    }
+
+
+    return md;
+}
+
+fakeProcessedImfileRow *fakeProcessedImfileObjectFromMetadata(psMetadata *md)
+{
+
+bool status = false;
+    psS64 fake_id = psMetadataLookupS64(&status, md, "fake_id");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fake_id");
+        return false;
+    }
+    psS64 exp_id = psMetadataLookupS64(&status, md, "exp_id");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_id");
+        return false;
+    }
+    char* class_id = psMetadataLookupPtr(&status, md, "class_id");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class_id");
+        return false;
+    }
+    char* uri = psMetadataLookupPtr(&status, md, "uri");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item uri");
+        return false;
+    }
+    psF32 dtime_fake = psMetadataLookupF32(&status, md, "dtime_fake");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item dtime_fake");
+        return false;
+    }
+    char* hostname = psMetadataLookupPtr(&status, md, "hostname");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item hostname");
+        return false;
+    }
+    char* path_base = psMetadataLookupPtr(&status, md, "path_base");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item path_base");
+        return false;
+    }
+    psS16 fault = psMetadataLookupS16(&status, md, "fault");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fault");
+        return false;
+    }
+    psTime* epoch = psMetadataLookupPtr(&status, md, "epoch");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item epoch");
+        return false;
+    }
+
+    return fakeProcessedImfileRowAlloc(fake_id, exp_id, class_id, uri, dtime_fake, hostname, path_base, fault, epoch);
+}
+psArray *fakeProcessedImfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
+{
+    psArray         *rowSet;
+    psArray         *returnSet;
+    psU64           i;
+
+    rowSet = psDBSelectRows(dbh, FAKEPROCESSEDIMFILE_TABLE_NAME, where, limit);
+    if (!rowSet) {
+        return NULL;
+    }
+
+    // convert psMetadata rows to row objects
+
+    returnSet = psArrayAllocEmpty(rowSet->n);
+
+    for (i = 0; i < rowSet->n; i++) {
+        fakeProcessedImfileRow *object = fakeProcessedImfileObjectFromMetadata(rowSet->data[i]);
+        if (!object) {
+            psFree(object);
+            psFree(returnSet);
+            psError(PS_ERR_UNKNOWN, false, "database error");
+            return NULL;
+        }
+        psArrayAdd(returnSet, 0, object);
+        psFree(object);
+    }
+
+    psFree(rowSet);
+
+    return returnSet;
+}
+bool fakeProcessedImfileDeleteObject(psDB *dbh, const fakeProcessedImfileRow *object)
+{
+    psMetadata *where = fakeProcessedImfileMetadataFromObject(object);
+    long long count = psDBDeleteRows(dbh, FAKEPROCESSEDIMFILE_TABLE_NAME, where, 0);
+    psFree(where);
+    if (count < 0) {
+        psError(PS_ERR_UNKNOWN, true, "failed to delete row from fakeProcessedImfile");
+        return false;
+    }
+    if (count > 1) {
+        // XXX should this be a psAbort() instead?  It is possible that
+        // having an object match multiple rows was by design.
+        psError(PS_ERR_UNKNOWN, true, "fakeProcessedImfileRow object matched more then one row.  Check your database schema");
+        return false;
+    }
+
+    return true;
+}
+long long fakeProcessedImfileDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)
+{
+    long long       deleted = 0;
+
+    for (long long i = 0; i < objects->n; i++) {
+        fakeProcessedImfileRow *object = objects->data[i];
+        psMetadata *where = fakeProcessedImfileMetadataFromObject(object);
+        long long count = psDBDeleteRows(dbh, FAKEPROCESSEDIMFILE_TABLE_NAME, where, limit);
+        psFree(where);
+        if (count < 0) {
+            psError(PS_ERR_UNKNOWN, true, "failed to delete row from fakeProcessedImfile");
+            return count;
+        }
+
+        deleted += count;
+    }
+
+    return deleted;
+}
+bool fakeProcessedImfilePrintObjects(FILE *stream, psArray *objects, bool mdcf)
+{
+    PS_ASSERT_PTR_NON_NULL(objects, false);
+
+    psMetadata *output = psMetadataAlloc();
+    for (long i = 0; i < psArrayLength(objects); i++) {
+        psMetadata *md = fakeProcessedImfileMetadataFromObject(objects->data[i]);
+        if (!psMetadataAddMetadata(
+            output,
+            PS_LIST_TAIL,
+            FAKEPROCESSEDIMFILE_TABLE_NAME,
+            PS_META_DUPLICATE_OK,
+            NULL,
+            md
+        )) {
+            psError(PS_ERR_UNKNOWN, false, "failed to add metadata");
+            psFree(md);
+            psFree(output);
+            return false;
+        }
+        psFree(md);
+    }
+
+    if (!ippdbPrintMetadataRaw(stream, output, mdcf)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to print metadata");
+        psFree(output);
+    }
+    psFree(output);
+
+    return true;
+}
+bool fakeProcessedImfilePrintObject(FILE *stream, fakeProcessedImfileRow *object, bool mdcf)
+{
+    PS_ASSERT_PTR_NON_NULL(object, false);
+
+    psMetadata *md = fakeProcessedImfileMetadataFromObject(object);
+
+    if (!ippdbPrintMetadataRaw(stream, md, mdcf)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to print metadata");
+        psFree(md);
+    }
+
+    psFree(md);
+
+    return true;
+}
+static void fakeMaskRowFree(fakeMaskRow *object);
+
+fakeMaskRow *fakeMaskRowAlloc(const char *label)
+{
+    fakeMaskRow     *_object;
+
+    _object = psAlloc(sizeof(fakeMaskRow));
+    psMemSetDeallocator(_object, (psFreeFunc)fakeMaskRowFree);
+
+    _object->label = psStringCopy(label);
+
+    return _object;
+}
+
+static void fakeMaskRowFree(fakeMaskRow *object)
+{
+    psFree(object->label);
+}
+
+bool fakeMaskCreateTable(psDB *dbh)
+{
+    psMetadata *md = psMetadataAlloc();
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "label", PS_DATA_STRING, "Primary Key", "64")) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item label");
+        psFree(md);
+        return false;
+    }
+
+    bool status = psDBCreateTable(dbh, FAKEMASK_TABLE_NAME, md);
+
+    psFree(md);
+
+    return status;
+}
+
+bool fakeMaskDropTable(psDB *dbh)
+{
+    return psDBDropTable(dbh, FAKEMASK_TABLE_NAME);
+}
+
+bool fakeMaskInsert(psDB * dbh, const char *label)
+{
+    psMetadata *md = psMetadataAlloc();
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "label", PS_DATA_STRING, NULL, label)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item label");
+        psFree(md);
+        return false;
+    }
+
+    bool status = psDBInsertOneRow(dbh, FAKEMASK_TABLE_NAME, md);
+    psFree(md);
+
+    return status;
+}
+
+long long fakeMaskDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)
+{
+    long long       deleted = 0;
+
+    long long count = psDBDeleteRows(dbh, FAKEMASK_TABLE_NAME, where, limit);
+    if (count < 0) {
+        psError(PS_ERR_UNKNOWN, true, "failed to delete row from fakeMask");
+        return count;
+
+        deleted += count;
+    }
+
+    return deleted;
+}
+bool fakeMaskInsertObject(psDB *dbh, fakeMaskRow *object)
+{
+    return fakeMaskInsert(dbh, object->label);
+}
+
+bool fakeMaskInsertObjects(psDB *dbh, psArray *objects)
+{
+    for (long i = 0; i < psArrayLength(objects); i++) {
+        if (!fakeMaskInsertObject(dbh, objects->data[i])) {
+            return false;
+        }
+    }
+
+    return true;
+}
+
+bool fakeMaskInsertFits(psDB *dbh, const psFits *fits)
+{
+    psArray         *rowSet;
+
+    // move to (the first?) extension named  FAKEMASK_TABLE_NAME
+    if (!psFitsMoveExtName(fits, FAKEMASK_TABLE_NAME)) {
+        psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", FAKEMASK_TABLE_NAME);
+        return false;
+    }
+
+    // check HDU type
+    if (psFitsGetExtType(fits) != PS_FITS_TYPE_BINARY_TABLE)  {
+        psError(PS_ERR_UNKNOWN, true, "FITS HDU type is not PS_FITS_TYPE_BINARY_TABLE");
+        return false;
+    }
+
+    // read fits table
+    rowSet = psFitsReadTable(fits);
+    if (!rowSet) {
+        psError(PS_ERR_UNKNOWN, true, "FITS read error or FITS table is empty");
+        psFree(rowSet);
+        return false;
+    }
+
+    if (!psDBInsertRows(dbh, FAKEMASK_TABLE_NAME, rowSet)) {
+        psError(PS_ERR_UNKNOWN, false, "databse insert failed");
+        psFree(rowSet);
+        return false;
+    }
+
+    psFree(rowSet);
+
+    return true;
+}
+
+bool fakeMaskSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)
+{
+    psArray         *rowSet;
+
+    rowSet = psDBSelectRows(dbh, FAKEMASK_TABLE_NAME, where, limit);
+    if (!rowSet) {
+        return false;
+    }
+
+    // output to fits
+    if (!psFitsWriteTable(fits, NULL, rowSet, FAKEMASK_TABLE_NAME)) {
+        psError(PS_ERR_UNKNOWN, false, "FITS table write failed");
+        psFree(rowSet);
+        return false;
+    }
+
+    psFree(rowSet);
+
+    return true;
+}
+
+psMetadata *fakeMaskMetadataFromObject(const fakeMaskRow *object)
+{
+    psMetadata *md = psMetadataAlloc();
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "label", PS_DATA_STRING, NULL, object->label)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item label");
+        psFree(md);
+        return false;
+    }
+
+
+    return md;
+}
+
+fakeMaskRow *fakeMaskObjectFromMetadata(psMetadata *md)
+{
+
+bool status = false;
+    char* label = psMetadataLookupPtr(&status, md, "label");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item label");
+        return false;
+    }
+
+    return fakeMaskRowAlloc(label);
+}
+psArray *fakeMaskSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
+{
+    psArray         *rowSet;
+    psArray         *returnSet;
+    psU64           i;
+
+    rowSet = psDBSelectRows(dbh, FAKEMASK_TABLE_NAME, where, limit);
+    if (!rowSet) {
+        return NULL;
+    }
+
+    // convert psMetadata rows to row objects
+
+    returnSet = psArrayAllocEmpty(rowSet->n);
+
+    for (i = 0; i < rowSet->n; i++) {
+        fakeMaskRow *object = fakeMaskObjectFromMetadata(rowSet->data[i]);
+        if (!object) {
+            psFree(object);
+            psFree(returnSet);
+            psError(PS_ERR_UNKNOWN, false, "database error");
+            return NULL;
+        }
+        psArrayAdd(returnSet, 0, object);
+        psFree(object);
+    }
+
+    psFree(rowSet);
+
+    return returnSet;
+}
+bool fakeMaskDeleteObject(psDB *dbh, const fakeMaskRow *object)
+{
+    psMetadata *where = fakeMaskMetadataFromObject(object);
+    long long count = psDBDeleteRows(dbh, FAKEMASK_TABLE_NAME, where, 0);
+    psFree(where);
+    if (count < 0) {
+        psError(PS_ERR_UNKNOWN, true, "failed to delete row from fakeMask");
+        return false;
+    }
+    if (count > 1) {
+        // XXX should this be a psAbort() instead?  It is possible that
+        // having an object match multiple rows was by design.
+        psError(PS_ERR_UNKNOWN, true, "fakeMaskRow object matched more then one row.  Check your database schema");
+        return false;
+    }
+
+    return true;
+}
+long long fakeMaskDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)
+{
+    long long       deleted = 0;
+
+    for (long long i = 0; i < objects->n; i++) {
+        fakeMaskRow *object = objects->data[i];
+        psMetadata *where = fakeMaskMetadataFromObject(object);
+        long long count = psDBDeleteRows(dbh, FAKEMASK_TABLE_NAME, where, limit);
+        psFree(where);
+        if (count < 0) {
+            psError(PS_ERR_UNKNOWN, true, "failed to delete row from fakeMask");
+            return count;
+        }
+
+        deleted += count;
+    }
+
+    return deleted;
+}
+bool fakeMaskPrintObjects(FILE *stream, psArray *objects, bool mdcf)
+{
+    PS_ASSERT_PTR_NON_NULL(objects, false);
+
+    psMetadata *output = psMetadataAlloc();
+    for (long i = 0; i < psArrayLength(objects); i++) {
+        psMetadata *md = fakeMaskMetadataFromObject(objects->data[i]);
+        if (!psMetadataAddMetadata(
+            output,
+            PS_LIST_TAIL,
+            FAKEMASK_TABLE_NAME,
+            PS_META_DUPLICATE_OK,
+            NULL,
+            md
+        )) {
+            psError(PS_ERR_UNKNOWN, false, "failed to add metadata");
+            psFree(md);
+            psFree(output);
+            return false;
+        }
+        psFree(md);
+    }
+
+    if (!ippdbPrintMetadataRaw(stream, output, mdcf)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to print metadata");
+        psFree(output);
+    }
+    psFree(output);
+
+    return true;
+}
+bool fakeMaskPrintObject(FILE *stream, fakeMaskRow *object, bool mdcf)
+{
+    PS_ASSERT_PTR_NON_NULL(object, false);
+
+    psMetadata *md = fakeMaskMetadataFromObject(object);
+
+    if (!ippdbPrintMetadataRaw(stream, md, mdcf)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to print metadata");
+        psFree(md);
+    }
+
+    psFree(md);
+
+    return true;
+}
 static void warpRunRowFree(warpRunRow *object);
 
-warpRunRow *warpRunRowAlloc(psS64 warp_id, psS64 cam_id, const char *mode, const char *state, const char *workdir, const char *workdir_state, const char *label, const char *dvodb, const char *tess_id, const char *end_stage, psTime* registered, bool magiced)
+warpRunRow *warpRunRowAlloc(psS64 warp_id, psS64 fake_id, const char *mode, const char *state, const char *workdir, const char *workdir_state, const char *label, const char *dvodb, const char *tess_id, const char *end_stage, psTime* registered, bool magiced)
 {
     warpRunRow      *_object;
@@ -9775,5 +10987,5 @@
 
     _object->warp_id = warp_id;
-    _object->cam_id = cam_id;
+    _object->fake_id = fake_id;
     _object->mode = psStringCopy(mode);
     _object->state = psStringCopy(state);
@@ -9811,6 +11023,6 @@
         return false;
     }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "cam_id", PS_DATA_S64, "Key INDEX(warp_id, cam_id) fkey(cam_id) ref camProcessedExp(cam_id)", 0)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item cam_id");
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "fake_id", PS_DATA_S64, "Key INDEX(warp_id, fake_id) fkey(fake_id) ref camProcessedExp(fake_id)", 0)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item fake_id");
         psFree(md);
         return false;
@@ -9879,5 +11091,5 @@
 }
 
-bool warpRunInsert(psDB * dbh, psS64 warp_id, psS64 cam_id, const char *mode, const char *state, const char *workdir, const char *workdir_state, const char *label, const char *dvodb, const char *tess_id, const char *end_stage, psTime* registered, bool magiced)
+bool warpRunInsert(psDB * dbh, psS64 warp_id, psS64 fake_id, const char *mode, const char *state, const char *workdir, const char *workdir_state, const char *label, const char *dvodb, const char *tess_id, const char *end_stage, psTime* registered, bool magiced)
 {
     psMetadata *md = psMetadataAlloc();
@@ -9887,6 +11099,6 @@
         return false;
     }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "cam_id", PS_DATA_S64, NULL, cam_id)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item cam_id");
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "fake_id", PS_DATA_S64, NULL, fake_id)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item fake_id");
         psFree(md);
         return false;
@@ -9965,5 +11177,5 @@
 bool warpRunInsertObject(psDB *dbh, warpRunRow *object)
 {
-    return warpRunInsert(dbh, object->warp_id, object->cam_id, object->mode, object->state, object->workdir, object->workdir_state, object->label, object->dvodb, object->tess_id, object->end_stage, object->registered, object->magiced);
+    return warpRunInsert(dbh, object->warp_id, object->fake_id, object->mode, object->state, object->workdir, object->workdir_state, object->label, object->dvodb, object->tess_id, object->end_stage, object->registered, object->magiced);
 }
 
@@ -10043,6 +11255,6 @@
         return false;
     }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "cam_id", PS_DATA_S64, NULL, object->cam_id)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item cam_id");
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "fake_id", PS_DATA_S64, NULL, object->fake_id)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item fake_id");
         psFree(md);
         return false;
@@ -10112,7 +11324,7 @@
         return false;
     }
-    psS64 cam_id = psMetadataLookupS64(&status, md, "cam_id");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item cam_id");
+    psS64 fake_id = psMetadataLookupS64(&status, md, "fake_id");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fake_id");
         return false;
     }
@@ -10168,5 +11380,5 @@
     }
 
-    return warpRunRowAlloc(warp_id, cam_id, mode, state, workdir, workdir_state, label, dvodb, tess_id, end_stage, registered, magiced);
+    return warpRunRowAlloc(warp_id, fake_id, mode, state, workdir, workdir_state, label, dvodb, tess_id, end_stage, registered, magiced);
 }
 psArray *warpRunSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
@@ -10286,5 +11498,5 @@
 static void warpSkyCellMapRowFree(warpSkyCellMapRow *object);
 
-warpSkyCellMapRow *warpSkyCellMapRowAlloc(psS64 warp_id, const char *skycell_id, const char *tess_id, psS64 cam_id, const char *class_id, psS16 fault)
+warpSkyCellMapRow *warpSkyCellMapRowAlloc(psS64 warp_id, const char *skycell_id, const char *tess_id, const char *class_id, psS16 fault)
 {
     warpSkyCellMapRow *_object;
@@ -10296,5 +11508,4 @@
     _object->skycell_id = psStringCopy(skycell_id);
     _object->tess_id = psStringCopy(tess_id);
-    _object->cam_id = cam_id;
     _object->class_id = psStringCopy(class_id);
     _object->fault = fault;
@@ -10313,5 +11524,5 @@
 {
     psMetadata *md = psMetadataAlloc();
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "warp_id", PS_DATA_S64, "Primary Key fkey(warp_id, cam_id) ref warpRun(warp_id, cam_id)", 0)) {
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "warp_id", PS_DATA_S64, "Primary Key fkey(warp_id) ref warpRun(warp_id)", 0)) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id");
         psFree(md);
@@ -10328,9 +11539,4 @@
         return false;
     }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "cam_id", PS_DATA_S64, "Primary Key", 0)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item cam_id");
-        psFree(md);
-        return false;
-    }
     if (!psMetadataAdd(md, PS_LIST_TAIL, "class_id", PS_DATA_STRING, "Primary Key", "64")) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item class_id");
@@ -10356,5 +11562,5 @@
 }
 
-bool warpSkyCellMapInsert(psDB * dbh, psS64 warp_id, const char *skycell_id, const char *tess_id, psS64 cam_id, const char *class_id, psS16 fault)
+bool warpSkyCellMapInsert(psDB * dbh, psS64 warp_id, const char *skycell_id, const char *tess_id, const char *class_id, psS16 fault)
 {
     psMetadata *md = psMetadataAlloc();
@@ -10371,9 +11577,4 @@
     if (!psMetadataAdd(md, PS_LIST_TAIL, "tess_id", PS_DATA_STRING, NULL, tess_id)) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item tess_id");
-        psFree(md);
-        return false;
-    }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "cam_id", PS_DATA_S64, NULL, cam_id)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item cam_id");
         psFree(md);
         return false;
@@ -10412,5 +11613,5 @@
 bool warpSkyCellMapInsertObject(psDB *dbh, warpSkyCellMapRow *object)
 {
-    return warpSkyCellMapInsert(dbh, object->warp_id, object->skycell_id, object->tess_id, object->cam_id, object->class_id, object->fault);
+    return warpSkyCellMapInsert(dbh, object->warp_id, object->skycell_id, object->tess_id, object->class_id, object->fault);
 }
 
@@ -10500,9 +11701,4 @@
         return false;
     }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "cam_id", PS_DATA_S64, NULL, object->cam_id)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item cam_id");
-        psFree(md);
-        return false;
-    }
     if (!psMetadataAdd(md, PS_LIST_TAIL, "class_id", PS_DATA_STRING, NULL, object->class_id)) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item class_id");
@@ -10539,9 +11735,4 @@
         return false;
     }
-    psS64 cam_id = psMetadataLookupS64(&status, md, "cam_id");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item cam_id");
-        return false;
-    }
     char* class_id = psMetadataLookupPtr(&status, md, "class_id");
     if (!status) {
@@ -10555,5 +11746,5 @@
     }
 
-    return warpSkyCellMapRowAlloc(warp_id, skycell_id, tess_id, cam_id, class_id, fault);
+    return warpSkyCellMapRowAlloc(warp_id, skycell_id, tess_id, class_id, fault);
 }
 psArray *warpSkyCellMapSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
Index: /trunk/ippdb/src/ippdb.h
===================================================================
--- /trunk/ippdb/src/ippdb.h	(revision 18043)
+++ /trunk/ippdb/src/ippdb.h	(revision 18044)
@@ -3483,5 +3483,4 @@
 typedef struct {
     psS64           cam_id;
-    psS64           chip_id;
     char            *uri;
     psF32           bg;
@@ -3520,5 +3519,4 @@
 camProcessedExpRow *camProcessedExpRowAlloc(
     psS64           cam_id,
-    psS64           chip_id,
     const char      *uri,
     psF32           bg,
@@ -3578,5 +3576,4 @@
     psDB            *dbh,               ///< Database handle
     psS64           cam_id,
-    psS64           chip_id,
     const char      *uri,
     psF32           bg,
@@ -3950,4 +3947,643 @@
     bool            mdcf                ///< format as mdconfig or simple
 );
+/** fakeRunRow data structure
+ *
+ * Structure for representing a single row of fakeRun table data.
+ */
+
+typedef struct {
+    psS64           fake_id;
+    psS64           cam_id;
+    char            *state;
+    char            *workdir;
+    char            *label;
+    char            *reduction;
+    char            *expgroup;
+    char            *dvodb;
+    char            *tess_id;
+    char            *end_stage;
+    psTime*         epoch;
+} fakeRunRow;
+
+/** Creates a new fakeRunRow object
+ *
+ *  @return A new fakeRunRow object or NULL on failure.
+ */
+
+fakeRunRow *fakeRunRowAlloc(
+    psS64           fake_id,
+    psS64           cam_id,
+    const char      *state,
+    const char      *workdir,
+    const char      *label,
+    const char      *reduction,
+    const char      *expgroup,
+    const char      *dvodb,
+    const char      *tess_id,
+    const char      *end_stage,
+    psTime*         epoch
+);
+
+/** Creates a new fakeRun table
+ *
+ * @return true on success
+ */
+
+bool fakeRunCreateTable(
+    psDB            *dbh                ///< Database handle
+);
+
+/** Deletes a fakeRun table
+ *
+ * @return true on success
+ */
+
+bool fakeRunDropTable(
+    psDB            *dbh                ///< Database handle
+);
+
+/** Insert a single row into a table
+ *
+ * This function constructs and inserts a single row based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool fakeRunInsert(
+    psDB            *dbh,               ///< Database handle
+    psS64           fake_id,
+    psS64           cam_id,
+    const char      *state,
+    const char      *workdir,
+    const char      *label,
+    const char      *reduction,
+    const char      *expgroup,
+    const char      *dvodb,
+    const char      *tess_id,
+    const char      *end_stage,
+    psTime*         epoch
+);
+
+/** Deletes up to limit rows from the database and returns the number of rows actually deleted. 
+ *
+ * @return A The number of rows removed or a negative value on error
+ */
+
+long long fakeRunDelete(
+    psDB            *dbh,               ///< Database handle
+    const psMetadata *where,            ///< Row match criteria
+    unsigned long long limit            ///< Maximum number of elements to delete 
+);
+
+/** Insert a single fakeRunRow object into a table
+ *
+ * This function constructs and inserts a single row based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool fakeRunInsertObject(
+    psDB            *dbh,               ///< Database handle
+    fakeRunRow      *object             ///< fakeRunRow object
+);
+
+/** Insert an array of fakeRunRow object into a table
+ *
+ * This function constructs and inserts multiple rows based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool fakeRunInsertObjects(
+    psDB            *dbh,               ///< Database handle
+    psArray         *objects            ///< array of fakeRunRow objects
+);
+
+/** Insert data from a binary FITS table fakeRunRow into the database
+ *
+ * This function expects a psFits object with a FITS table as the first
+ * extension.  The table must have at least one row of data in it, that is of
+ * the appropriate format (number of columns and their type).  All other
+ * extensions are ignored.
+ *
+ * @return true on success
+ */
+
+bool fakeRunInsertFits(
+    psDB            *dbh,               ///< Database handle
+    const psFits    *fits               ///< psFits object
+);
+
+/** Selects up to limit from the database and returns them in a binary FITS table
+ *
+ * This function assumes an empty psFits object and will create a FITS table
+ * as the first extension.
+ *
+ *  See psDBSelectRows() for documentation on the format of where.
+ *
+ * @return true on success
+ */
+
+bool fakeRunSelectRowsFits(
+    psDB            *dbh,               ///< Database handle
+    psFits          *fits,              ///< psFits object
+    const psMetadata *where,            ///< Row match criteria
+    unsigned long long limit            ///< Maximum number of elements to return
+);
+
+/** Convert a fakeRunRow into an equivalent psMetadata
+ *
+ * @return A psMetadata pointer or NULL on error
+ */
+
+psMetadata *fakeRunMetadataFromObject(
+    const fakeRunRow *object             ///< fooRow to convert into a psMetadata
+);
+
+/** Convert a psMetadata into an equivalent fooRow
+ *
+ * @return A fakeRunRow pointer or NULL on error
+ */
+
+fakeRunRow *fakeRunObjectFromMetadata(
+    psMetadata      *md                 ///< psMetadata to convert into a fooRow
+);
+/** Selects up to limit rows from the database and returns as fakeRunRow objects in a psArray
+ *
+ *  See psDBSelectRows() for documentation on the format of where.
+ *
+ * @return A psArray pointer or NULL on error
+ */
+
+psArray *fakeRunSelectRowObjects(
+    psDB            *dbh,               ///< Database handle
+    const psMetadata *where,            ///< Row match criteria
+    unsigned long long limit            ///< Maximum number of elements to return
+);
+/** Deletes a row from the database coresponding to an fakeRun
+ *
+ *  Note that a 'where' search psMetadata is constructed from each object and
+ *  used to find rows to delete.
+ *
+ * @return A The number of rows removed or a negative value on error
+ */
+
+bool fakeRunDeleteObject(
+    psDB            *dbh,               ///< Database handle
+    const fakeRunRow *object    ///< Object to delete
+);
+/** Deletes up to limit rows from the database and returns the number of rows actually deleted. 
+ *
+ *  Note that a 'where' search psMetadata is constructed from each object and
+ *  used to find rows to delete.
+ *
+ * @return A The number of rows removed or a negative value on error
+ */
+
+long long fakeRunDeleteRowObjects(
+    psDB            *dbh,               ///< Database handle
+    const psArray   *objects,           ///< Array of objects to delete
+    unsigned long long limit            ///< Maximum number of elements to delete 
+);
+/** Formats and prints an array of fakeRunRow objects
+ *
+ * When mdcf is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
+ */
+
+bool fakeRunPrintObjects(
+    FILE            *stream,            ///< a stream
+    psArray         *objects,           ///< An array of fakeRunRow objects
+    bool            mdcf                ///< format as mdconfig or simple
+);
+/** Formats and prints an fakeRunRow object
+ *
+ * When mdcf is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
+ */
+
+bool fakeRunPrintObject(
+    FILE            *stream,            ///< a stream
+    fakeRunRow *object,    ///< an fakeRunRow object
+    bool            mdcf                ///< format as mdconfig or simple
+);
+/** fakeProcessedImfileRow data structure
+ *
+ * Structure for representing a single row of fakeProcessedImfile table data.
+ */
+
+typedef struct {
+    psS64           fake_id;
+    psS64           exp_id;
+    char            *class_id;
+    char            *uri;
+    psF32           dtime_fake;
+    char            *hostname;
+    char            *path_base;
+    psS16           fault;
+    psTime*         epoch;
+} fakeProcessedImfileRow;
+
+/** Creates a new fakeProcessedImfileRow object
+ *
+ *  @return A new fakeProcessedImfileRow object or NULL on failure.
+ */
+
+fakeProcessedImfileRow *fakeProcessedImfileRowAlloc(
+    psS64           fake_id,
+    psS64           exp_id,
+    const char      *class_id,
+    const char      *uri,
+    psF32           dtime_fake,
+    const char      *hostname,
+    const char      *path_base,
+    psS16           fault,
+    psTime*         epoch
+);
+
+/** Creates a new fakeProcessedImfile table
+ *
+ * @return true on success
+ */
+
+bool fakeProcessedImfileCreateTable(
+    psDB            *dbh                ///< Database handle
+);
+
+/** Deletes a fakeProcessedImfile table
+ *
+ * @return true on success
+ */
+
+bool fakeProcessedImfileDropTable(
+    psDB            *dbh                ///< Database handle
+);
+
+/** Insert a single row into a table
+ *
+ * This function constructs and inserts a single row based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool fakeProcessedImfileInsert(
+    psDB            *dbh,               ///< Database handle
+    psS64           fake_id,
+    psS64           exp_id,
+    const char      *class_id,
+    const char      *uri,
+    psF32           dtime_fake,
+    const char      *hostname,
+    const char      *path_base,
+    psS16           fault,
+    psTime*         epoch
+);
+
+/** Deletes up to limit rows from the database and returns the number of rows actually deleted. 
+ *
+ * @return A The number of rows removed or a negative value on error
+ */
+
+long long fakeProcessedImfileDelete(
+    psDB            *dbh,               ///< Database handle
+    const psMetadata *where,            ///< Row match criteria
+    unsigned long long limit            ///< Maximum number of elements to delete 
+);
+
+/** Insert a single fakeProcessedImfileRow object into a table
+ *
+ * This function constructs and inserts a single row based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool fakeProcessedImfileInsertObject(
+    psDB            *dbh,               ///< Database handle
+    fakeProcessedImfileRow *object             ///< fakeProcessedImfileRow object
+);
+
+/** Insert an array of fakeProcessedImfileRow object into a table
+ *
+ * This function constructs and inserts multiple rows based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool fakeProcessedImfileInsertObjects(
+    psDB            *dbh,               ///< Database handle
+    psArray         *objects            ///< array of fakeProcessedImfileRow objects
+);
+
+/** Insert data from a binary FITS table fakeProcessedImfileRow into the database
+ *
+ * This function expects a psFits object with a FITS table as the first
+ * extension.  The table must have at least one row of data in it, that is of
+ * the appropriate format (number of columns and their type).  All other
+ * extensions are ignored.
+ *
+ * @return true on success
+ */
+
+bool fakeProcessedImfileInsertFits(
+    psDB            *dbh,               ///< Database handle
+    const psFits    *fits               ///< psFits object
+);
+
+/** Selects up to limit from the database and returns them in a binary FITS table
+ *
+ * This function assumes an empty psFits object and will create a FITS table
+ * as the first extension.
+ *
+ *  See psDBSelectRows() for documentation on the format of where.
+ *
+ * @return true on success
+ */
+
+bool fakeProcessedImfileSelectRowsFits(
+    psDB            *dbh,               ///< Database handle
+    psFits          *fits,              ///< psFits object
+    const psMetadata *where,            ///< Row match criteria
+    unsigned long long limit            ///< Maximum number of elements to return
+);
+
+/** Convert a fakeProcessedImfileRow into an equivalent psMetadata
+ *
+ * @return A psMetadata pointer or NULL on error
+ */
+
+psMetadata *fakeProcessedImfileMetadataFromObject(
+    const fakeProcessedImfileRow *object             ///< fooRow to convert into a psMetadata
+);
+
+/** Convert a psMetadata into an equivalent fooRow
+ *
+ * @return A fakeProcessedImfileRow pointer or NULL on error
+ */
+
+fakeProcessedImfileRow *fakeProcessedImfileObjectFromMetadata(
+    psMetadata      *md                 ///< psMetadata to convert into a fooRow
+);
+/** Selects up to limit rows from the database and returns as fakeProcessedImfileRow objects in a psArray
+ *
+ *  See psDBSelectRows() for documentation on the format of where.
+ *
+ * @return A psArray pointer or NULL on error
+ */
+
+psArray *fakeProcessedImfileSelectRowObjects(
+    psDB            *dbh,               ///< Database handle
+    const psMetadata *where,            ///< Row match criteria
+    unsigned long long limit            ///< Maximum number of elements to return
+);
+/** Deletes a row from the database coresponding to an fakeProcessedImfile
+ *
+ *  Note that a 'where' search psMetadata is constructed from each object and
+ *  used to find rows to delete.
+ *
+ * @return A The number of rows removed or a negative value on error
+ */
+
+bool fakeProcessedImfileDeleteObject(
+    psDB            *dbh,               ///< Database handle
+    const fakeProcessedImfileRow *object    ///< Object to delete
+);
+/** Deletes up to limit rows from the database and returns the number of rows actually deleted. 
+ *
+ *  Note that a 'where' search psMetadata is constructed from each object and
+ *  used to find rows to delete.
+ *
+ * @return A The number of rows removed or a negative value on error
+ */
+
+long long fakeProcessedImfileDeleteRowObjects(
+    psDB            *dbh,               ///< Database handle
+    const psArray   *objects,           ///< Array of objects to delete
+    unsigned long long limit            ///< Maximum number of elements to delete 
+);
+/** Formats and prints an array of fakeProcessedImfileRow objects
+ *
+ * When mdcf is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
+ */
+
+bool fakeProcessedImfilePrintObjects(
+    FILE            *stream,            ///< a stream
+    psArray         *objects,           ///< An array of fakeProcessedImfileRow objects
+    bool            mdcf                ///< format as mdconfig or simple
+);
+/** Formats and prints an fakeProcessedImfileRow object
+ *
+ * When mdcf is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
+ */
+
+bool fakeProcessedImfilePrintObject(
+    FILE            *stream,            ///< a stream
+    fakeProcessedImfileRow *object,    ///< an fakeProcessedImfileRow object
+    bool            mdcf                ///< format as mdconfig or simple
+);
+/** fakeMaskRow data structure
+ *
+ * Structure for representing a single row of fakeMask table data.
+ */
+
+typedef struct {
+    char            *label;
+} fakeMaskRow;
+
+/** Creates a new fakeMaskRow object
+ *
+ *  @return A new fakeMaskRow object or NULL on failure.
+ */
+
+fakeMaskRow *fakeMaskRowAlloc(
+    const char      *label
+);
+
+/** Creates a new fakeMask table
+ *
+ * @return true on success
+ */
+
+bool fakeMaskCreateTable(
+    psDB            *dbh                ///< Database handle
+);
+
+/** Deletes a fakeMask table
+ *
+ * @return true on success
+ */
+
+bool fakeMaskDropTable(
+    psDB            *dbh                ///< Database handle
+);
+
+/** Insert a single row into a table
+ *
+ * This function constructs and inserts a single row based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool fakeMaskInsert(
+    psDB            *dbh,               ///< Database handle
+    const char      *label
+);
+
+/** Deletes up to limit rows from the database and returns the number of rows actually deleted. 
+ *
+ * @return A The number of rows removed or a negative value on error
+ */
+
+long long fakeMaskDelete(
+    psDB            *dbh,               ///< Database handle
+    const psMetadata *where,            ///< Row match criteria
+    unsigned long long limit            ///< Maximum number of elements to delete 
+);
+
+/** Insert a single fakeMaskRow object into a table
+ *
+ * This function constructs and inserts a single row based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool fakeMaskInsertObject(
+    psDB            *dbh,               ///< Database handle
+    fakeMaskRow     *object             ///< fakeMaskRow object
+);
+
+/** Insert an array of fakeMaskRow object into a table
+ *
+ * This function constructs and inserts multiple rows based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool fakeMaskInsertObjects(
+    psDB            *dbh,               ///< Database handle
+    psArray         *objects            ///< array of fakeMaskRow objects
+);
+
+/** Insert data from a binary FITS table fakeMaskRow into the database
+ *
+ * This function expects a psFits object with a FITS table as the first
+ * extension.  The table must have at least one row of data in it, that is of
+ * the appropriate format (number of columns and their type).  All other
+ * extensions are ignored.
+ *
+ * @return true on success
+ */
+
+bool fakeMaskInsertFits(
+    psDB            *dbh,               ///< Database handle
+    const psFits    *fits               ///< psFits object
+);
+
+/** Selects up to limit from the database and returns them in a binary FITS table
+ *
+ * This function assumes an empty psFits object and will create a FITS table
+ * as the first extension.
+ *
+ *  See psDBSelectRows() for documentation on the format of where.
+ *
+ * @return true on success
+ */
+
+bool fakeMaskSelectRowsFits(
+    psDB            *dbh,               ///< Database handle
+    psFits          *fits,              ///< psFits object
+    const psMetadata *where,            ///< Row match criteria
+    unsigned long long limit            ///< Maximum number of elements to return
+);
+
+/** Convert a fakeMaskRow into an equivalent psMetadata
+ *
+ * @return A psMetadata pointer or NULL on error
+ */
+
+psMetadata *fakeMaskMetadataFromObject(
+    const fakeMaskRow *object             ///< fooRow to convert into a psMetadata
+);
+
+/** Convert a psMetadata into an equivalent fooRow
+ *
+ * @return A fakeMaskRow pointer or NULL on error
+ */
+
+fakeMaskRow *fakeMaskObjectFromMetadata(
+    psMetadata      *md                 ///< psMetadata to convert into a fooRow
+);
+/** Selects up to limit rows from the database and returns as fakeMaskRow objects in a psArray
+ *
+ *  See psDBSelectRows() for documentation on the format of where.
+ *
+ * @return A psArray pointer or NULL on error
+ */
+
+psArray *fakeMaskSelectRowObjects(
+    psDB            *dbh,               ///< Database handle
+    const psMetadata *where,            ///< Row match criteria
+    unsigned long long limit            ///< Maximum number of elements to return
+);
+/** Deletes a row from the database coresponding to an fakeMask
+ *
+ *  Note that a 'where' search psMetadata is constructed from each object and
+ *  used to find rows to delete.
+ *
+ * @return A The number of rows removed or a negative value on error
+ */
+
+bool fakeMaskDeleteObject(
+    psDB            *dbh,               ///< Database handle
+    const fakeMaskRow *object    ///< Object to delete
+);
+/** Deletes up to limit rows from the database and returns the number of rows actually deleted. 
+ *
+ *  Note that a 'where' search psMetadata is constructed from each object and
+ *  used to find rows to delete.
+ *
+ * @return A The number of rows removed or a negative value on error
+ */
+
+long long fakeMaskDeleteRowObjects(
+    psDB            *dbh,               ///< Database handle
+    const psArray   *objects,           ///< Array of objects to delete
+    unsigned long long limit            ///< Maximum number of elements to delete 
+);
+/** Formats and prints an array of fakeMaskRow objects
+ *
+ * When mdcf is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
+ */
+
+bool fakeMaskPrintObjects(
+    FILE            *stream,            ///< a stream
+    psArray         *objects,           ///< An array of fakeMaskRow objects
+    bool            mdcf                ///< format as mdconfig or simple
+);
+/** Formats and prints an fakeMaskRow object
+ *
+ * When mdcf is set the formated output is in psMetadataConfig
+ * format, otherwise it is in a simple tabular format.
+ *
+ * @return true on success
+ */
+
+bool fakeMaskPrintObject(
+    FILE            *stream,            ///< a stream
+    fakeMaskRow *object,    ///< an fakeMaskRow object
+    bool            mdcf                ///< format as mdconfig or simple
+);
 /** warpRunRow data structure
  *
@@ -3957,5 +4593,5 @@
 typedef struct {
     psS64           warp_id;
-    psS64           cam_id;
+    psS64           fake_id;
     char            *mode;
     char            *state;
@@ -3977,5 +4613,5 @@
 warpRunRow *warpRunRowAlloc(
     psS64           warp_id,
-    psS64           cam_id,
+    psS64           fake_id,
     const char      *mode,
     const char      *state,
@@ -4018,5 +4654,5 @@
     psDB            *dbh,               ///< Database handle
     psS64           warp_id,
-    psS64           cam_id,
+    psS64           fake_id,
     const char      *mode,
     const char      *state,
@@ -4187,5 +4823,4 @@
     char            *skycell_id;
     char            *tess_id;
-    psS64           cam_id;
     char            *class_id;
     psS16           fault;
@@ -4201,5 +4836,4 @@
     const char      *skycell_id,
     const char      *tess_id,
-    psS64           cam_id,
     const char      *class_id,
     psS16           fault
@@ -4236,5 +4870,4 @@
     const char      *skycell_id,
     const char      *tess_id,
-    psS64           cam_id,
     const char      *class_id,
     psS16           fault
Index: /trunk/ippdb/tests/alloc.c
===================================================================
--- /trunk/ippdb/tests/alloc.c	(revision 18043)
+++ /trunk/ippdb/tests/alloc.c	(revision 18044)
@@ -1065,5 +1065,5 @@
         camProcessedExpRow *object;
 
-        object = camProcessedExpRowAlloc(-64, -64, "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, "a string", -32, -32, -32, -32, "a string", -16    );
+        object = camProcessedExpRowAlloc(-64, "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, "a string", -32, -32, -32, -32, "a string", -16    );
 
         if (!object) {
@@ -1075,8 +1075,4 @@
             exit(EXIT_FAILURE);
         }
-        if (!object->chip_id == -64) {
-            psFree(object);
-            exit(EXIT_FAILURE);
-        }
         if (strncmp(object->uri, "a string", MAX_STRING_LENGTH)) {
             psFree(object);
@@ -1209,4 +1205,125 @@
 
     {
+        fakeRunRow      *object;
+
+        object = fakeRunRowAlloc(-64, -64, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z"    );
+
+        if (!object) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!object->fake_id == -64) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (!object->cam_id == -64) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->state, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->workdir, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->label, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->reduction, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->expgroup, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->dvodb, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->tess_id, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->end_stage, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(object);
+    }
+
+    {
+        fakeProcessedImfileRow *object;
+
+        object = fakeProcessedImfileRowAlloc(-64, -64, "a string", "a string", 32.32, "a string", "a string", -16, "0001-01-01T00:00:00Z"    );
+
+        if (!object) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!object->fake_id == -64) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (!object->exp_id == -64) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->class_id, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->uri, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (!object->dtime_fake == 32.32) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->hostname, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->path_base, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (!object->fault == -16) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(object);
+    }
+
+    {
+        fakeMaskRow     *object;
+
+        object = fakeMaskRowAlloc("a string"    );
+
+        if (!object) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (strncmp(object->label, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(object);
+    }
+
+    {
         warpRunRow      *object;
 
@@ -1221,5 +1338,5 @@
             exit(EXIT_FAILURE);
         }
-        if (!object->cam_id == -64) {
+        if (!object->fake_id == -64) {
             psFree(object);
             exit(EXIT_FAILURE);
@@ -1271,5 +1388,5 @@
         warpSkyCellMapRow *object;
 
-        object = warpSkyCellMapRowAlloc(-64, "a string", "a string", -64, "a string", -16    );
+        object = warpSkyCellMapRowAlloc(-64, "a string", "a string", "a string", -16    );
 
         if (!object) {
@@ -1286,8 +1403,4 @@
         }
         if (strncmp(object->tess_id, "a string", MAX_STRING_LENGTH)) {
-            psFree(object);
-            exit(EXIT_FAILURE);
-        }
-        if (!object->cam_id == -64) {
             psFree(object);
             exit(EXIT_FAILURE);
Index: /trunk/ippdb/tests/createtable.c
===================================================================
--- /trunk/ippdb/tests/createtable.c	(revision 18043)
+++ /trunk/ippdb/tests/createtable.c	(revision 18044)
@@ -253,4 +253,49 @@
         }
 
+        if(!fakeRunCreateTable(dbh)) {
+            exit(EXIT_FAILURE);
+        }
+
+        psDBCleanup(dbh);
+    }
+
+    {
+        psDB            *dbh;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        if(!fakeProcessedImfileCreateTable(dbh)) {
+            exit(EXIT_FAILURE);
+        }
+
+        psDBCleanup(dbh);
+    }
+
+    {
+        psDB            *dbh;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        if(!fakeMaskCreateTable(dbh)) {
+            exit(EXIT_FAILURE);
+        }
+
+        psDBCleanup(dbh);
+    }
+
+    {
+        psDB            *dbh;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
         if(!warpRunCreateTable(dbh)) {
             exit(EXIT_FAILURE);
Index: /trunk/ippdb/tests/dbcleanup.c
===================================================================
--- /trunk/ippdb/tests/dbcleanup.c	(revision 18043)
+++ /trunk/ippdb/tests/dbcleanup.c	(revision 18044)
@@ -27,4 +27,7 @@
     p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS camProcessedExp");
     p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS camMask");
+    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS fakeRun");
+    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS fakeProcessedImfile");
+    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS fakeMask");
     p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS warpRun");
     p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS warpSkyCellMap");
Index: /trunk/ippdb/tests/dbsetup.c
===================================================================
--- /trunk/ippdb/tests/dbsetup.c	(revision 18043)
+++ /trunk/ippdb/tests/dbsetup.c	(revision 18044)
@@ -60,4 +60,13 @@
     p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS camMask");
     camMaskCreateTable(dbh);
+
+    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS fakeRun");
+    fakeRunCreateTable(dbh);
+
+    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS fakeProcessedImfile");
+    fakeProcessedImfileCreateTable(dbh);
+
+    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS fakeMask");
+    fakeMaskCreateTable(dbh);
 
     p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS warpRun");
Index: /trunk/ippdb/tests/droptable.c
===================================================================
--- /trunk/ippdb/tests/droptable.c	(revision 18043)
+++ /trunk/ippdb/tests/droptable.c	(revision 18044)
@@ -253,4 +253,49 @@
         }
 
+        if (!fakeRunDropTable(dbh)) {
+            exit(EXIT_FAILURE);
+        }
+
+        psDBCleanup(dbh);
+    }
+
+    {
+        psDB            *dbh;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!fakeProcessedImfileDropTable(dbh)) {
+            exit(EXIT_FAILURE);
+        }
+
+        psDBCleanup(dbh);
+    }
+
+    {
+        psDB            *dbh;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!fakeMaskDropTable(dbh)) {
+            exit(EXIT_FAILURE);
+        }
+
+        psDBCleanup(dbh);
+    }
+
+    {
+        psDB            *dbh;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
         if (!warpRunDropTable(dbh)) {
             exit(EXIT_FAILURE);
Index: /trunk/ippdb/tests/insert.c
===================================================================
--- /trunk/ippdb/tests/insert.c	(revision 18043)
+++ /trunk/ippdb/tests/insert.c	(revision 18044)
@@ -223,5 +223,5 @@
         }
 
-        if (!camProcessedExpInsert(dbh, -64, -64, "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, "a string", -32, -32, -32, -32, "a string", -16)) {
+        if (!camProcessedExpInsert(dbh, -64, "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, "a string", -32, -32, -32, -32, "a string", -16)) {
             exit(EXIT_FAILURE);
         }
@@ -253,4 +253,49 @@
         }
 
+        if (!fakeRunInsert(dbh, -64, -64, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z")) {
+            exit(EXIT_FAILURE);
+        }
+
+        psDBCleanup(dbh);
+    }
+
+    {
+        psDB            *dbh;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!fakeProcessedImfileInsert(dbh, -64, -64, "a string", "a string", 32.32, "a string", "a string", -16, "0001-01-01T00:00:00Z")) {
+            exit(EXIT_FAILURE);
+        }
+
+        psDBCleanup(dbh);
+    }
+
+    {
+        psDB            *dbh;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!fakeMaskInsert(dbh, "a string")) {
+            exit(EXIT_FAILURE);
+        }
+
+        psDBCleanup(dbh);
+    }
+
+    {
+        psDB            *dbh;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
         if (!warpRunInsert(dbh, -64, -64, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", true)) {
             exit(EXIT_FAILURE);
@@ -268,5 +313,5 @@
         }
 
-        if (!warpSkyCellMapInsert(dbh, -64, "a string", "a string", -64, "a string", -16)) {
+        if (!warpSkyCellMapInsert(dbh, -64, "a string", "a string", "a string", -16)) {
             exit(EXIT_FAILURE);
         }
Index: /trunk/ippdb/tests/insertfits.c
===================================================================
--- /trunk/ippdb/tests/insertfits.c	(revision 18043)
+++ /trunk/ippdb/tests/insertfits.c	(revision 18044)
@@ -440,4 +440,82 @@
         }
 
+        if (!fakeRunInsertFits(dbh, fits)) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!psFitsClose(fits)) {
+            exit(EXIT_FAILURE);
+        }
+
+        psDBCleanup(dbh);
+    }
+
+    {
+        psDB            *dbh;
+        psFits          *fits;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        // open a temp
+        fits = psFitsOpen(TMP_FILENAME, "r");
+        if (!fits) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!fakeProcessedImfileInsertFits(dbh, fits)) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!psFitsClose(fits)) {
+            exit(EXIT_FAILURE);
+        }
+
+        psDBCleanup(dbh);
+    }
+
+    {
+        psDB            *dbh;
+        psFits          *fits;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        // open a temp
+        fits = psFitsOpen(TMP_FILENAME, "r");
+        if (!fits) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!fakeMaskInsertFits(dbh, fits)) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!psFitsClose(fits)) {
+            exit(EXIT_FAILURE);
+        }
+
+        psDBCleanup(dbh);
+    }
+
+    {
+        psDB            *dbh;
+        psFits          *fits;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        // open a temp
+        fits = psFitsOpen(TMP_FILENAME, "r");
+        if (!fits) {
+            exit(EXIT_FAILURE);
+        }
+
         if (!warpRunInsertFits(dbh, fits)) {
             exit(EXIT_FAILURE);
Index: /trunk/ippdb/tests/insertobject.c
===================================================================
--- /trunk/ippdb/tests/insertobject.c	(revision 18043)
+++ /trunk/ippdb/tests/insertobject.c	(revision 18044)
@@ -322,5 +322,5 @@
         }
 
-        object = camProcessedExpRowAlloc(-64, -64, "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, "a string", -32, -32, -32, -32, "a string", -16);
+        object = camProcessedExpRowAlloc(-64, "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, "a string", -32, -32, -32, -32, "a string", -16);
         if (!object) {
             exit(EXIT_FAILURE);
@@ -359,4 +359,70 @@
     {
         psDB            *dbh;
+        fakeRunRow      *object;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        object = fakeRunRowAlloc(-64, -64, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z");
+        if (!object) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!fakeRunInsertObject(dbh, object)) {
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(object);
+        psDBCleanup(dbh);
+    }
+
+    {
+        psDB            *dbh;
+        fakeProcessedImfileRow *object;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        object = fakeProcessedImfileRowAlloc(-64, -64, "a string", "a string", 32.32, "a string", "a string", -16, "0001-01-01T00:00:00Z");
+        if (!object) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!fakeProcessedImfileInsertObject(dbh, object)) {
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(object);
+        psDBCleanup(dbh);
+    }
+
+    {
+        psDB            *dbh;
+        fakeMaskRow     *object;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        object = fakeMaskRowAlloc("a string");
+        if (!object) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!fakeMaskInsertObject(dbh, object)) {
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(object);
+        psDBCleanup(dbh);
+    }
+
+    {
+        psDB            *dbh;
         warpRunRow      *object;
 
@@ -388,5 +454,5 @@
         }
 
-        object = warpSkyCellMapRowAlloc(-64, "a string", "a string", -64, "a string", -16);
+        object = warpSkyCellMapRowAlloc(-64, "a string", "a string", "a string", -16);
         if (!object) {
             exit(EXIT_FAILURE);
Index: /trunk/ippdb/tests/metadatafromobject.c
===================================================================
--- /trunk/ippdb/tests/metadatafromobject.c	(revision 18043)
+++ /trunk/ippdb/tests/metadatafromobject.c	(revision 18044)
@@ -1162,5 +1162,5 @@
         bool            status;
 
-        object = camProcessedExpRowAlloc(-64, -64, "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, "a string", -32, -32, -32, -32, "a string", -16);
+        object = camProcessedExpRowAlloc(-64, "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, "a string", -32, -32, -32, -32, "a string", -16);
         if (!object) {
             exit(EXIT_FAILURE);
@@ -1177,7 +1177,4 @@
             exit(EXIT_FAILURE);
         }
-            psFree(md);
-            exit(EXIT_FAILURE);
-        }
         if (strncmp(psMetadataLookupPtr(&status, md, "uri"), "a string", MAX_STRING_LENGTH)) {
             psFree(md);
@@ -1318,4 +1315,144 @@
     {
         psMetadata      *md;
+        fakeRunRow      *object;
+        bool            status;
+
+        object = fakeRunRowAlloc(-64, -64, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z");
+        if (!object) {
+            exit(EXIT_FAILURE);
+        }
+
+        md = fakeRunMetadataFromObject(object);
+        if (!md) {
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(object);
+
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(psMetadataLookupPtr(&status, md, "state"), "a string", MAX_STRING_LENGTH)) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(psMetadataLookupPtr(&status, md, "workdir"), "a string", MAX_STRING_LENGTH)) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(psMetadataLookupPtr(&status, md, "label"), "a string", MAX_STRING_LENGTH)) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(psMetadataLookupPtr(&status, md, "reduction"), "a string", MAX_STRING_LENGTH)) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(psMetadataLookupPtr(&status, md, "expgroup"), "a string", MAX_STRING_LENGTH)) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(psMetadataLookupPtr(&status, md, "dvodb"), "a string", MAX_STRING_LENGTH)) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(psMetadataLookupPtr(&status, md, "tess_id"), "a string", MAX_STRING_LENGTH)) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(psMetadataLookupPtr(&status, md, "end_stage"), "a string", MAX_STRING_LENGTH)) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(md);
+    }
+
+    {
+        psMetadata      *md;
+        fakeProcessedImfileRow *object;
+        bool            status;
+
+        object = fakeProcessedImfileRowAlloc(-64, -64, "a string", "a string", 32.32, "a string", "a string", -16, "0001-01-01T00:00:00Z");
+        if (!object) {
+            exit(EXIT_FAILURE);
+        }
+
+        md = fakeProcessedImfileMetadataFromObject(object);
+        if (!md) {
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(object);
+
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(psMetadataLookupPtr(&status, md, "class_id"), "a string", MAX_STRING_LENGTH)) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(psMetadataLookupPtr(&status, md, "uri"), "a string", MAX_STRING_LENGTH)) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (!psMetadataLookupF32(&status, md, "dtime_fake") == 32.32) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(psMetadataLookupPtr(&status, md, "hostname"), "a string", MAX_STRING_LENGTH)) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(psMetadataLookupPtr(&status, md, "path_base"), "a string", MAX_STRING_LENGTH)) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(md);
+    }
+
+    {
+        psMetadata      *md;
+        fakeMaskRow     *object;
+        bool            status;
+
+        object = fakeMaskRowAlloc("a string");
+        if (!object) {
+            exit(EXIT_FAILURE);
+        }
+
+        md = fakeMaskMetadataFromObject(object);
+        if (!md) {
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(object);
+
+        if (strncmp(psMetadataLookupPtr(&status, md, "label"), "a string", MAX_STRING_LENGTH)) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(md);
+    }
+
+    {
+        psMetadata      *md;
         warpRunRow      *object;
         bool            status;
@@ -1387,5 +1524,5 @@
         bool            status;
 
-        object = warpSkyCellMapRowAlloc(-64, "a string", "a string", -64, "a string", -16);
+        object = warpSkyCellMapRowAlloc(-64, "a string", "a string", "a string", -16);
         if (!object) {
             exit(EXIT_FAILURE);
@@ -1407,7 +1544,4 @@
         }
         if (strncmp(psMetadataLookupPtr(&status, md, "tess_id"), "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 18043)
+++ /trunk/ippdb/tests/objectfrommetadata.c	(revision 18044)
@@ -1978,7 +1978,4 @@
             exit(EXIT_FAILURE);
         }
-            psFree(md);
-            exit(EXIT_FAILURE);
-        }
         if (!psMetadataAddStr(md, PS_LIST_TAIL, "uri", 0, NULL, "a string")) {
             psFree(md);
@@ -2097,7 +2094,4 @@
         psFree(md);
 
-            psFree(object);
-            exit(EXIT_FAILURE);
-        }
             psFree(object);
             exit(EXIT_FAILURE);
@@ -2242,4 +2236,212 @@
     {
         psMetadata      *md;
+        fakeRunRow      *object;
+
+        md = psMetadataAlloc();
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (!psMetadataAddStr(md, PS_LIST_TAIL, "state", 0, NULL, "a string")) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (!psMetadataAddStr(md, PS_LIST_TAIL, "workdir", 0, NULL, "a string")) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (!psMetadataAddStr(md, PS_LIST_TAIL, "label", 0, NULL, "a string")) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (!psMetadataAddStr(md, PS_LIST_TAIL, "reduction", 0, NULL, "a string")) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (!psMetadataAddStr(md, PS_LIST_TAIL, "expgroup", 0, NULL, "a string")) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (!psMetadataAddStr(md, PS_LIST_TAIL, "dvodb", 0, NULL, "a string")) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (!psMetadataAddStr(md, PS_LIST_TAIL, "tess_id", 0, NULL, "a string")) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (!psMetadataAddStr(md, PS_LIST_TAIL, "end_stage", 0, NULL, "a string")) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+
+        object = fakeRunObjectFromMetadata(md);
+        if (!object) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(md);
+
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->state, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->workdir, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->label, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->reduction, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->expgroup, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->dvodb, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->tess_id, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->end_stage, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(object);
+    }
+
+    {
+        psMetadata      *md;
+        fakeProcessedImfileRow *object;
+
+        md = psMetadataAlloc();
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (!psMetadataAddStr(md, PS_LIST_TAIL, "class_id", 0, NULL, "a string")) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (!psMetadataAddStr(md, PS_LIST_TAIL, "uri", 0, NULL, "a string")) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (!psMetadataAddF32(md, PS_LIST_TAIL, "dtime_fake", 0, NULL, 32.32)) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (!psMetadataAddStr(md, PS_LIST_TAIL, "hostname", 0, NULL, "a string")) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (!psMetadataAddStr(md, PS_LIST_TAIL, "path_base", 0, NULL, "a string")) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+
+        object = fakeProcessedImfileObjectFromMetadata(md);
+        if (!object) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(md);
+
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->class_id, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->uri, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (!object->dtime_fake == 32.32) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->hostname, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->path_base, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(object);
+    }
+
+    {
+        psMetadata      *md;
+        fakeMaskRow     *object;
+
+        md = psMetadataAlloc();
+        if (!psMetadataAddStr(md, PS_LIST_TAIL, "label", 0, NULL, "a string")) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+
+        object = fakeMaskObjectFromMetadata(md);
+        if (!object) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(md);
+
+        if (strncmp(object->label, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(object);
+    }
+
+    {
+        psMetadata      *md;
         warpRunRow      *object;
 
@@ -2364,7 +2566,4 @@
             exit(EXIT_FAILURE);
         }
-            psFree(md);
-            exit(EXIT_FAILURE);
-        }
         if (!psMetadataAddStr(md, PS_LIST_TAIL, "class_id", 0, NULL, "a string")) {
             psFree(md);
@@ -2391,7 +2590,4 @@
         }
         if (strncmp(object->tess_id, "a string", MAX_STRING_LENGTH)) {
-            psFree(object);
-            exit(EXIT_FAILURE);
-        }
             psFree(object);
             exit(EXIT_FAILURE);
Index: /trunk/ippdb/tests/selectrowsfits.c
===================================================================
--- /trunk/ippdb/tests/selectrowsfits.c	(revision 18043)
+++ /trunk/ippdb/tests/selectrowsfits.c	(revision 18044)
@@ -373,4 +373,70 @@
         }
 
+        if (!fakeRunSelectRowsFits(dbh, fits, NULL, 1)) {
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(fits);
+        psDBCleanup(dbh);
+    }
+
+    {
+        psDB            *dbh;
+        psFits          *fits;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        fits = psFitsOpen(TMP_FILENAME, "w");
+        if (!fits) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!fakeProcessedImfileSelectRowsFits(dbh, fits, NULL, 1)) {
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(fits);
+        psDBCleanup(dbh);
+    }
+
+    {
+        psDB            *dbh;
+        psFits          *fits;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        fits = psFitsOpen(TMP_FILENAME, "w");
+        if (!fits) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!fakeMaskSelectRowsFits(dbh, fits, NULL, 1)) {
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(fits);
+        psDBCleanup(dbh);
+    }
+
+    {
+        psDB            *dbh;
+        psFits          *fits;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        fits = psFitsOpen(TMP_FILENAME, "w");
+        if (!fits) {
+            exit(EXIT_FAILURE);
+        }
+
         if (!warpRunSelectRowsFits(dbh, fits, NULL, 1)) {
             exit(EXIT_FAILURE);
