Index: trunk/ippdb/src/ippdb.h
===================================================================
--- trunk/ippdb/src/ippdb.h	(revision 9970)
+++ trunk/ippdb/src/ippdb.h	(revision 10060)
@@ -134,7 +134,8 @@
     char            *camera;
     char            *telescope;
-    psTime*         time;
+    psTime*         dateobs;
     char            *exp_type;
     char            *uri;
+    psS32           imfiles;
 } summitExpRow;
 
@@ -148,7 +149,8 @@
     const char      *camera,
     const char      *telescope,
-    psTime*         time,
+    psTime*         dateobs,
     const char      *exp_type,
-    const char      *uri
+    const char      *uri,
+    psS32           imfiles
 );
 
@@ -183,7 +185,8 @@
     const char      *camera,
     const char      *telescope,
-    psTime*         time,
+    psTime*         dateobs,
     const char      *exp_type,
-    const char      *uri
+    const char      *uri,
+    psS32           imfiles
 );
 
@@ -322,201 +325,7 @@
     bool            mdcf                ///< format as mdconfig or simple
 );
-/** pzPendingExpRow data structure
- *
- * Structure for representing a single row of pzPendingExp table data.
- */
-
-typedef struct {
-    char            *exp_id;
-    char            *camera;
-    char            *telescope;
-    char            *exp_type;
-    psS32           imfiles;
-} pzPendingExpRow;
-
-/** Creates a new pzPendingExpRow object
- *
- *  @return A new pzPendingExpRow object or NULL on failure.
- */
-
-pzPendingExpRow *pzPendingExpRowAlloc(
-    const char      *exp_id,
-    const char      *camera,
-    const char      *telescope,
-    const char      *exp_type,
-    psS32           imfiles
-);
-
-/** Creates a new pzPendingExp table
- *
- * @return true on success
- */
-
-bool pzPendingExpCreateTable(
-    psDB            *dbh                ///< Database handle
-);
-
-/** Deletes a pzPendingExp table
- *
- * @return true on success
- */
-
-bool pzPendingExpDropTable(
-    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 pzPendingExpInsert(
-    psDB            *dbh,               ///< Database handle
-    const char      *exp_id,
-    const char      *camera,
-    const char      *telescope,
-    const char      *exp_type,
-    psS32           imfiles
-);
-
-/** 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 pzPendingExpDelete(
-    psDB            *dbh,               ///< Database handle
-    const psMetadata *where,            ///< Row match criteria
-    unsigned long long limit            ///< Maximum number of elements to delete 
-);
-
-/** Insert a single pzPendingExpRow object into a table
- *
- * This function constructs and inserts a single row based on it's parameters.
- *
- * @return true on success
- */
-
-bool pzPendingExpInsertObject(
-    psDB            *dbh,               ///< Database handle
-    pzPendingExpRow *object             ///< pzPendingExpRow object
-);
-
-/** Insert an array of pzPendingExpRow object into a table
- *
- * This function constructs and inserts multiple rows based on it's parameters.
- *
- * @return true on success
- */
-
-bool pzPendingExpInsertObjects(
-    psDB            *dbh,               ///< Database handle
-    psArray         *objects            ///< array of pzPendingExpRow objects
-);
-
-/** Insert data from a binary FITS table pzPendingExpRow 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 pzPendingExpInsertFits(
-    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 pzPendingExpSelectRowsFits(
-    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 pzPendingExpRow into an equivalent psMetadata
- *
- * @return A psMetadata pointer or NULL on error
- */
-
-psMetadata *pzPendingExpMetadataFromObject(
-    const pzPendingExpRow *object             ///< fooRow to convert into a psMetadata
-);
-
-/** Convert a psMetadata into an equivalent fooRow
- *
- * @return A pzPendingExpRow pointer or NULL on error
- */
-
-pzPendingExpRow *pzPendingExpObjectFromMetadata(
-    psMetadata      *md                 ///< psMetadata to convert into a fooRow
-);
-/** Selects up to limit rows from the database and returns as pzPendingExpRow objects in a psArray
- *
- *  See psDBSelectRows() for documentation on the format of where.
- *
- * @return A psArray pointer or NULL on error
- */
-
-psArray *pzPendingExpSelectRowObjects(
-    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 pzPendingExp
- *
- *  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 pzPendingExpDeleteObject(
-    psDB            *dbh,               ///< Database handle
-    const pzPendingExpRow *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 pzPendingExpDeleteRowObjects(
-    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 pzPendingExpRow 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 pzPendingExpPrintObjects(
-    FILE            *stream,            ///< a stream
-    psArray         *objects,           ///< An array of pzPendingExpRow objects
-    bool            mdcf                ///< format as mdconfig or simple
-);
-/** pzPendingImfileRow data structure
- *
- * Structure for representing a single row of pzPendingImfile table data.
+/** summitImfileRow data structure
+ *
+ * Structure for representing a single row of summitImfile table data.
  */
 
@@ -530,12 +339,12 @@
     char            *class_id;
     char            *uri;
-} pzPendingImfileRow;
-
-/** Creates a new pzPendingImfileRow object
- *
- *  @return A new pzPendingImfileRow object or NULL on failure.
- */
-
-pzPendingImfileRow *pzPendingImfileRowAlloc(
+} summitImfileRow;
+
+/** Creates a new summitImfileRow object
+ *
+ *  @return A new summitImfileRow object or NULL on failure.
+ */
+
+summitImfileRow *summitImfileRowAlloc(
     const char      *exp_id,
     const char      *camera,
@@ -548,19 +357,19 @@
 );
 
-/** Creates a new pzPendingImfile table
- *
- * @return true on success
- */
-
-bool pzPendingImfileCreateTable(
+/** Creates a new summitImfile table
+ *
+ * @return true on success
+ */
+
+bool summitImfileCreateTable(
     psDB            *dbh                ///< Database handle
 );
 
-/** Deletes a pzPendingImfile table
- *
- * @return true on success
- */
-
-bool pzPendingImfileDropTable(
+/** Deletes a summitImfile table
+ *
+ * @return true on success
+ */
+
+bool summitImfileDropTable(
     psDB            *dbh                ///< Database handle
 );
@@ -573,5 +382,5 @@
  */
 
-bool pzPendingImfileInsert(
+bool summitImfileInsert(
     psDB            *dbh,               ///< Database handle
     const char      *exp_id,
@@ -590,5 +399,5 @@
  */
 
-long long pzPendingImfileDelete(
+long long summitImfileDelete(
     psDB            *dbh,               ///< Database handle
     const psMetadata *where,            ///< Row match criteria
@@ -596,5 +405,5 @@
 );
 
-/** Insert a single pzPendingImfileRow object into a table
+/** Insert a single summitImfileRow object into a table
  *
  * This function constructs and inserts a single row based on it's parameters.
@@ -603,10 +412,10 @@
  */
 
-bool pzPendingImfileInsertObject(
-    psDB            *dbh,               ///< Database handle
-    pzPendingImfileRow *object             ///< pzPendingImfileRow object
-);
-
-/** Insert an array of pzPendingImfileRow object into a table
+bool summitImfileInsertObject(
+    psDB            *dbh,               ///< Database handle
+    summitImfileRow *object             ///< summitImfileRow object
+);
+
+/** Insert an array of summitImfileRow object into a table
  *
  * This function constructs and inserts multiple rows based on it's parameters.
@@ -615,10 +424,10 @@
  */
 
-bool pzPendingImfileInsertObjects(
-    psDB            *dbh,               ///< Database handle
-    psArray         *objects            ///< array of pzPendingImfileRow objects
-);
-
-/** Insert data from a binary FITS table pzPendingImfileRow into the database
+bool summitImfileInsertObjects(
+    psDB            *dbh,               ///< Database handle
+    psArray         *objects            ///< array of summitImfileRow objects
+);
+
+/** Insert data from a binary FITS table summitImfileRow into the database
  *
  * This function expects a psFits object with a FITS table as the first
@@ -630,4 +439,389 @@
  */
 
+bool summitImfileInsertFits(
+    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 summitImfileSelectRowsFits(
+    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 summitImfileRow into an equivalent psMetadata
+ *
+ * @return A psMetadata pointer or NULL on error
+ */
+
+psMetadata *summitImfileMetadataFromObject(
+    const summitImfileRow *object             ///< fooRow to convert into a psMetadata
+);
+
+/** Convert a psMetadata into an equivalent fooRow
+ *
+ * @return A summitImfileRow pointer or NULL on error
+ */
+
+summitImfileRow *summitImfileObjectFromMetadata(
+    psMetadata      *md                 ///< psMetadata to convert into a fooRow
+);
+/** Selects up to limit rows from the database and returns as summitImfileRow objects in a psArray
+ *
+ *  See psDBSelectRows() for documentation on the format of where.
+ *
+ * @return A psArray pointer or NULL on error
+ */
+
+psArray *summitImfileSelectRowObjects(
+    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 summitImfile
+ *
+ *  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 summitImfileDeleteObject(
+    psDB            *dbh,               ///< Database handle
+    const summitImfileRow *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 summitImfileDeleteRowObjects(
+    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 summitImfileRow 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 summitImfilePrintObjects(
+    FILE            *stream,            ///< a stream
+    psArray         *objects,           ///< An array of summitImfileRow objects
+    bool            mdcf                ///< format as mdconfig or simple
+);
+/** pzPendingExpRow data structure
+ *
+ * Structure for representing a single row of pzPendingExp table data.
+ */
+
+typedef struct {
+    char            *exp_id;
+    char            *camera;
+    char            *telescope;
+} pzPendingExpRow;
+
+/** Creates a new pzPendingExpRow object
+ *
+ *  @return A new pzPendingExpRow object or NULL on failure.
+ */
+
+pzPendingExpRow *pzPendingExpRowAlloc(
+    const char      *exp_id,
+    const char      *camera,
+    const char      *telescope
+);
+
+/** Creates a new pzPendingExp table
+ *
+ * @return true on success
+ */
+
+bool pzPendingExpCreateTable(
+    psDB            *dbh                ///< Database handle
+);
+
+/** Deletes a pzPendingExp table
+ *
+ * @return true on success
+ */
+
+bool pzPendingExpDropTable(
+    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 pzPendingExpInsert(
+    psDB            *dbh,               ///< Database handle
+    const char      *exp_id,
+    const char      *camera,
+    const char      *telescope
+);
+
+/** 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 pzPendingExpDelete(
+    psDB            *dbh,               ///< Database handle
+    const psMetadata *where,            ///< Row match criteria
+    unsigned long long limit            ///< Maximum number of elements to delete 
+);
+
+/** Insert a single pzPendingExpRow object into a table
+ *
+ * This function constructs and inserts a single row based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool pzPendingExpInsertObject(
+    psDB            *dbh,               ///< Database handle
+    pzPendingExpRow *object             ///< pzPendingExpRow object
+);
+
+/** Insert an array of pzPendingExpRow object into a table
+ *
+ * This function constructs and inserts multiple rows based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool pzPendingExpInsertObjects(
+    psDB            *dbh,               ///< Database handle
+    psArray         *objects            ///< array of pzPendingExpRow objects
+);
+
+/** Insert data from a binary FITS table pzPendingExpRow 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 pzPendingExpInsertFits(
+    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 pzPendingExpSelectRowsFits(
+    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 pzPendingExpRow into an equivalent psMetadata
+ *
+ * @return A psMetadata pointer or NULL on error
+ */
+
+psMetadata *pzPendingExpMetadataFromObject(
+    const pzPendingExpRow *object             ///< fooRow to convert into a psMetadata
+);
+
+/** Convert a psMetadata into an equivalent fooRow
+ *
+ * @return A pzPendingExpRow pointer or NULL on error
+ */
+
+pzPendingExpRow *pzPendingExpObjectFromMetadata(
+    psMetadata      *md                 ///< psMetadata to convert into a fooRow
+);
+/** Selects up to limit rows from the database and returns as pzPendingExpRow objects in a psArray
+ *
+ *  See psDBSelectRows() for documentation on the format of where.
+ *
+ * @return A psArray pointer or NULL on error
+ */
+
+psArray *pzPendingExpSelectRowObjects(
+    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 pzPendingExp
+ *
+ *  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 pzPendingExpDeleteObject(
+    psDB            *dbh,               ///< Database handle
+    const pzPendingExpRow *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 pzPendingExpDeleteRowObjects(
+    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 pzPendingExpRow 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 pzPendingExpPrintObjects(
+    FILE            *stream,            ///< a stream
+    psArray         *objects,           ///< An array of pzPendingExpRow objects
+    bool            mdcf                ///< format as mdconfig or simple
+);
+/** pzPendingImfileRow data structure
+ *
+ * Structure for representing a single row of pzPendingImfile table data.
+ */
+
+typedef struct {
+    char            *exp_id;
+    char            *camera;
+    char            *telescope;
+    char            *class;
+    char            *class_id;
+    char            *exp_tag;
+} pzPendingImfileRow;
+
+/** Creates a new pzPendingImfileRow object
+ *
+ *  @return A new pzPendingImfileRow object or NULL on failure.
+ */
+
+pzPendingImfileRow *pzPendingImfileRowAlloc(
+    const char      *exp_id,
+    const char      *camera,
+    const char      *telescope,
+    const char      *class,
+    const char      *class_id,
+    const char      *exp_tag
+);
+
+/** Creates a new pzPendingImfile table
+ *
+ * @return true on success
+ */
+
+bool pzPendingImfileCreateTable(
+    psDB            *dbh                ///< Database handle
+);
+
+/** Deletes a pzPendingImfile table
+ *
+ * @return true on success
+ */
+
+bool pzPendingImfileDropTable(
+    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 pzPendingImfileInsert(
+    psDB            *dbh,               ///< Database handle
+    const char      *exp_id,
+    const char      *camera,
+    const char      *telescope,
+    const char      *class,
+    const char      *class_id,
+    const char      *exp_tag
+);
+
+/** 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 pzPendingImfileDelete(
+    psDB            *dbh,               ///< Database handle
+    const psMetadata *where,            ///< Row match criteria
+    unsigned long long limit            ///< Maximum number of elements to delete 
+);
+
+/** Insert a single pzPendingImfileRow object into a table
+ *
+ * This function constructs and inserts a single row based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool pzPendingImfileInsertObject(
+    psDB            *dbh,               ///< Database handle
+    pzPendingImfileRow *object             ///< pzPendingImfileRow object
+);
+
+/** Insert an array of pzPendingImfileRow object into a table
+ *
+ * This function constructs and inserts multiple rows based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool pzPendingImfileInsertObjects(
+    psDB            *dbh,               ///< Database handle
+    psArray         *objects            ///< array of pzPendingImfileRow objects
+);
+
+/** Insert data from a binary FITS table pzPendingImfileRow 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 pzPendingImfileInsertFits(
     psDB            *dbh,               ///< Database handle
@@ -719,14 +913,403 @@
     bool            mdcf                ///< format as mdconfig or simple
 );
-/** newExpRow data structure
- *
- * Structure for representing a single row of newExp table data.
+/** pzDoneExpRow data structure
+ *
+ * Structure for representing a single row of pzDoneExp table data.
  */
 
 typedef struct {
-    char            *exp_tag;
     char            *exp_id;
     char            *camera;
     char            *telescope;
+} pzDoneExpRow;
+
+/** Creates a new pzDoneExpRow object
+ *
+ *  @return A new pzDoneExpRow object or NULL on failure.
+ */
+
+pzDoneExpRow *pzDoneExpRowAlloc(
+    const char      *exp_id,
+    const char      *camera,
+    const char      *telescope
+);
+
+/** Creates a new pzDoneExp table
+ *
+ * @return true on success
+ */
+
+bool pzDoneExpCreateTable(
+    psDB            *dbh                ///< Database handle
+);
+
+/** Deletes a pzDoneExp table
+ *
+ * @return true on success
+ */
+
+bool pzDoneExpDropTable(
+    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 pzDoneExpInsert(
+    psDB            *dbh,               ///< Database handle
+    const char      *exp_id,
+    const char      *camera,
+    const char      *telescope
+);
+
+/** 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 pzDoneExpDelete(
+    psDB            *dbh,               ///< Database handle
+    const psMetadata *where,            ///< Row match criteria
+    unsigned long long limit            ///< Maximum number of elements to delete 
+);
+
+/** Insert a single pzDoneExpRow object into a table
+ *
+ * This function constructs and inserts a single row based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool pzDoneExpInsertObject(
+    psDB            *dbh,               ///< Database handle
+    pzDoneExpRow    *object             ///< pzDoneExpRow object
+);
+
+/** Insert an array of pzDoneExpRow object into a table
+ *
+ * This function constructs and inserts multiple rows based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool pzDoneExpInsertObjects(
+    psDB            *dbh,               ///< Database handle
+    psArray         *objects            ///< array of pzDoneExpRow objects
+);
+
+/** Insert data from a binary FITS table pzDoneExpRow 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 pzDoneExpInsertFits(
+    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 pzDoneExpSelectRowsFits(
+    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 pzDoneExpRow into an equivalent psMetadata
+ *
+ * @return A psMetadata pointer or NULL on error
+ */
+
+psMetadata *pzDoneExpMetadataFromObject(
+    const pzDoneExpRow *object             ///< fooRow to convert into a psMetadata
+);
+
+/** Convert a psMetadata into an equivalent fooRow
+ *
+ * @return A pzDoneExpRow pointer or NULL on error
+ */
+
+pzDoneExpRow *pzDoneExpObjectFromMetadata(
+    psMetadata      *md                 ///< psMetadata to convert into a fooRow
+);
+/** Selects up to limit rows from the database and returns as pzDoneExpRow objects in a psArray
+ *
+ *  See psDBSelectRows() for documentation on the format of where.
+ *
+ * @return A psArray pointer or NULL on error
+ */
+
+psArray *pzDoneExpSelectRowObjects(
+    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 pzDoneExp
+ *
+ *  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 pzDoneExpDeleteObject(
+    psDB            *dbh,               ///< Database handle
+    const pzDoneExpRow *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 pzDoneExpDeleteRowObjects(
+    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 pzDoneExpRow 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 pzDoneExpPrintObjects(
+    FILE            *stream,            ///< a stream
+    psArray         *objects,           ///< An array of pzDoneExpRow objects
+    bool            mdcf                ///< format as mdconfig or simple
+);
+/** pzDoneImfileRow data structure
+ *
+ * Structure for representing a single row of pzDoneImfile table data.
+ */
+
+typedef struct {
+    char            *exp_id;
+    char            *camera;
+    char            *telescope;
+    char            *class;
+    char            *class_id;
+    char            *exp_tag;
+    char            *uri;
+} pzDoneImfileRow;
+
+/** Creates a new pzDoneImfileRow object
+ *
+ *  @return A new pzDoneImfileRow object or NULL on failure.
+ */
+
+pzDoneImfileRow *pzDoneImfileRowAlloc(
+    const char      *exp_id,
+    const char      *camera,
+    const char      *telescope,
+    const char      *class,
+    const char      *class_id,
+    const char      *exp_tag,
+    const char      *uri
+);
+
+/** Creates a new pzDoneImfile table
+ *
+ * @return true on success
+ */
+
+bool pzDoneImfileCreateTable(
+    psDB            *dbh                ///< Database handle
+);
+
+/** Deletes a pzDoneImfile table
+ *
+ * @return true on success
+ */
+
+bool pzDoneImfileDropTable(
+    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 pzDoneImfileInsert(
+    psDB            *dbh,               ///< Database handle
+    const char      *exp_id,
+    const char      *camera,
+    const char      *telescope,
+    const char      *class,
+    const char      *class_id,
+    const char      *exp_tag,
+    const char      *uri
+);
+
+/** 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 pzDoneImfileDelete(
+    psDB            *dbh,               ///< Database handle
+    const psMetadata *where,            ///< Row match criteria
+    unsigned long long limit            ///< Maximum number of elements to delete 
+);
+
+/** Insert a single pzDoneImfileRow object into a table
+ *
+ * This function constructs and inserts a single row based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool pzDoneImfileInsertObject(
+    psDB            *dbh,               ///< Database handle
+    pzDoneImfileRow *object             ///< pzDoneImfileRow object
+);
+
+/** Insert an array of pzDoneImfileRow object into a table
+ *
+ * This function constructs and inserts multiple rows based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool pzDoneImfileInsertObjects(
+    psDB            *dbh,               ///< Database handle
+    psArray         *objects            ///< array of pzDoneImfileRow objects
+);
+
+/** Insert data from a binary FITS table pzDoneImfileRow 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 pzDoneImfileInsertFits(
+    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 pzDoneImfileSelectRowsFits(
+    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 pzDoneImfileRow into an equivalent psMetadata
+ *
+ * @return A psMetadata pointer or NULL on error
+ */
+
+psMetadata *pzDoneImfileMetadataFromObject(
+    const pzDoneImfileRow *object             ///< fooRow to convert into a psMetadata
+);
+
+/** Convert a psMetadata into an equivalent fooRow
+ *
+ * @return A pzDoneImfileRow pointer or NULL on error
+ */
+
+pzDoneImfileRow *pzDoneImfileObjectFromMetadata(
+    psMetadata      *md                 ///< psMetadata to convert into a fooRow
+);
+/** Selects up to limit rows from the database and returns as pzDoneImfileRow objects in a psArray
+ *
+ *  See psDBSelectRows() for documentation on the format of where.
+ *
+ * @return A psArray pointer or NULL on error
+ */
+
+psArray *pzDoneImfileSelectRowObjects(
+    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 pzDoneImfile
+ *
+ *  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 pzDoneImfileDeleteObject(
+    psDB            *dbh,               ///< Database handle
+    const pzDoneImfileRow *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 pzDoneImfileDeleteRowObjects(
+    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 pzDoneImfileRow 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 pzDoneImfilePrintObjects(
+    FILE            *stream,            ///< a stream
+    psArray         *objects,           ///< An array of pzDoneImfileRow objects
+    bool            mdcf                ///< format as mdconfig or simple
+);
+/** newExpRow data structure
+ *
+ * Structure for representing a single row of newExp table data.
+ */
+
+typedef struct {
+    psU64           exp_tag;
+    char            *exp_id;
+    char            *camera;
+    char            *telescope;
+    psTime*         dateobs;
     char            *exp_type;
     psS32           imfiles;
@@ -739,8 +1322,9 @@
 
 newExpRow *newExpRowAlloc(
-    const char      *exp_tag,
+    psU64           exp_tag,
     const char      *exp_id,
     const char      *camera,
     const char      *telescope,
+    psTime*         dateobs,
     const char      *exp_type,
     psS32           imfiles
@@ -774,8 +1358,9 @@
 bool newExpInsert(
     psDB            *dbh,               ///< Database handle
-    const char      *exp_tag,
+    psU64           exp_tag,
     const char      *exp_id,
     const char      *camera,
     const char      *telescope,
+    psTime*         dateobs,
     const char      *exp_type,
     psS32           imfiles
