Index: trunk/ippdb/src/ippdb.h
===================================================================
--- trunk/ippdb/src/ippdb.h	(revision 16177)
+++ trunk/ippdb/src/ippdb.h	(revision 16587)
@@ -758,7 +758,7 @@
     bool            mdcf                ///< format as mdconfig or simple
 );
-/** pzPendingExpRow data structure
- *
- * Structure for representing a single row of pzPendingExp table data.
+/** pzDownloadExpRow data structure
+ *
+ * Structure for representing a single row of pzDownloadExp table data.
  */
 
@@ -767,32 +767,34 @@
     char            *camera;
     char            *telescope;
-} pzPendingExpRow;
-
-/** Creates a new pzPendingExpRow object
- *
- *  @return A new pzPendingExpRow object or NULL on failure.
- */
-
-pzPendingExpRow *pzPendingExpRowAlloc(
+    char            *state;
+} pzDownloadExpRow;
+
+/** Creates a new pzDownloadExpRow object
+ *
+ *  @return A new pzDownloadExpRow object or NULL on failure.
+ */
+
+pzDownloadExpRow *pzDownloadExpRowAlloc(
     const char      *exp_name,
     const char      *camera,
-    const char      *telescope
-);
-
-/** Creates a new pzPendingExp table
- *
- * @return true on success
- */
-
-bool pzPendingExpCreateTable(
+    const char      *telescope,
+    const char      *state
+);
+
+/** Creates a new pzDownloadExp table
+ *
+ * @return true on success
+ */
+
+bool pzDownloadExpCreateTable(
     psDB            *dbh                ///< Database handle
 );
 
-/** Deletes a pzPendingExp table
- *
- * @return true on success
- */
-
-bool pzPendingExpDropTable(
+/** Deletes a pzDownloadExp table
+ *
+ * @return true on success
+ */
+
+bool pzDownloadExpDropTable(
     psDB            *dbh                ///< Database handle
 );
@@ -805,9 +807,10 @@
  */
 
-bool pzPendingExpInsert(
+bool pzDownloadExpInsert(
     psDB            *dbh,               ///< Database handle
     const char      *exp_name,
     const char      *camera,
-    const char      *telescope
+    const char      *telescope,
+    const char      *state
 );
 
@@ -817,5 +820,5 @@
  */
 
-long long pzPendingExpDelete(
+long long pzDownloadExpDelete(
     psDB            *dbh,               ///< Database handle
     const psMetadata *where,            ///< Row match criteria
@@ -823,5 +826,5 @@
 );
 
-/** Insert a single pzPendingExpRow object into a table
+/** Insert a single pzDownloadExpRow object into a table
  *
  * This function constructs and inserts a single row based on it's parameters.
@@ -830,10 +833,10 @@
  */
 
-bool pzPendingExpInsertObject(
-    psDB            *dbh,               ///< Database handle
-    pzPendingExpRow *object             ///< pzPendingExpRow object
-);
-
-/** Insert an array of pzPendingExpRow object into a table
+bool pzDownloadExpInsertObject(
+    psDB            *dbh,               ///< Database handle
+    pzDownloadExpRow *object             ///< pzDownloadExpRow object
+);
+
+/** Insert an array of pzDownloadExpRow object into a table
  *
  * This function constructs and inserts multiple rows based on it's parameters.
@@ -842,10 +845,10 @@
  */
 
-bool pzPendingExpInsertObjects(
-    psDB            *dbh,               ///< Database handle
-    psArray         *objects            ///< array of pzPendingExpRow objects
-);
-
-/** Insert data from a binary FITS table pzPendingExpRow into the database
+bool pzDownloadExpInsertObjects(
+    psDB            *dbh,               ///< Database handle
+    psArray         *objects            ///< array of pzDownloadExpRow objects
+);
+
+/** Insert data from a binary FITS table pzDownloadExpRow into the database
  *
  * This function expects a psFits object with a FITS table as the first
@@ -857,5 +860,5 @@
  */
 
-bool pzPendingExpInsertFits(
+bool pzDownloadExpInsertFits(
     psDB            *dbh,               ///< Database handle
     const psFits    *fits               ///< psFits object
@@ -872,5 +875,5 @@
  */
 
-bool pzPendingExpSelectRowsFits(
+bool pzDownloadExpSelectRowsFits(
     psDB            *dbh,               ///< Database handle
     psFits          *fits,              ///< psFits object
@@ -879,22 +882,22 @@
 );
 
-/** Convert a pzPendingExpRow into an equivalent psMetadata
+/** Convert a pzDownloadExpRow into an equivalent psMetadata
  *
  * @return A psMetadata pointer or NULL on error
  */
 
-psMetadata *pzPendingExpMetadataFromObject(
-    const pzPendingExpRow *object             ///< fooRow to convert into a psMetadata
+psMetadata *pzDownloadExpMetadataFromObject(
+    const pzDownloadExpRow *object             ///< fooRow to convert into a psMetadata
 );
 
 /** Convert a psMetadata into an equivalent fooRow
  *
- * @return A pzPendingExpRow pointer or NULL on error
- */
-
-pzPendingExpRow *pzPendingExpObjectFromMetadata(
+ * @return A pzDownloadExpRow pointer or NULL on error
+ */
+
+pzDownloadExpRow *pzDownloadExpObjectFromMetadata(
     psMetadata      *md                 ///< psMetadata to convert into a fooRow
 );
-/** Selects up to limit rows from the database and returns as pzPendingExpRow objects in a psArray
+/** Selects up to limit rows from the database and returns as pzDownloadExpRow objects in a psArray
  *
  *  See psDBSelectRows() for documentation on the format of where.
@@ -903,10 +906,10 @@
  */
 
-psArray *pzPendingExpSelectRowObjects(
+psArray *pzDownloadExpSelectRowObjects(
     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
+/** Deletes a row from the database coresponding to an pzDownloadExp
  *
  *  Note that a 'where' search psMetadata is constructed from each object and
@@ -916,7 +919,7 @@
  */
 
-bool pzPendingExpDeleteObject(
-    psDB            *dbh,               ///< Database handle
-    const pzPendingExpRow *object    ///< Object to delete
+bool pzDownloadExpDeleteObject(
+    psDB            *dbh,               ///< Database handle
+    const pzDownloadExpRow *object    ///< Object to delete
 );
 /** Deletes up to limit rows from the database and returns the number of rows actually deleted. 
@@ -928,10 +931,10 @@
  */
 
-long long pzPendingExpDeleteRowObjects(
+long long pzDownloadExpDeleteRowObjects(
     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
+/** Formats and prints an array of pzDownloadExpRow objects
  *
  * When mdcf is set the formated output is in psMetadataConfig
@@ -941,10 +944,10 @@
  */
 
-bool pzPendingExpPrintObjects(
+bool pzDownloadExpPrintObjects(
     FILE            *stream,            ///< a stream
-    psArray         *objects,           ///< An array of pzPendingExpRow objects
+    psArray         *objects,           ///< An array of pzDownloadExpRow objects
     bool            mdcf                ///< format as mdconfig or simple
 );
-/** Formats and prints an pzPendingExpRow object
+/** Formats and prints an pzDownloadExpRow object
  *
  * When mdcf is set the formated output is in psMetadataConfig
@@ -954,420 +957,12 @@
  */
 
-bool pzPendingExpPrintObject(
+bool pzDownloadExpPrintObject(
     FILE            *stream,            ///< a stream
-    pzPendingExpRow *object,    ///< an pzPendingExpRow object
+    pzDownloadExpRow *object,    ///< an pzDownloadExpRow object
     bool            mdcf                ///< format as mdconfig or simple
 );
-/** pzPendingImfileRow data structure
- *
- * Structure for representing a single row of pzPendingImfile table data.
- */
-
-typedef struct {
-    char            *exp_name;
-    char            *camera;
-    char            *telescope;
-    char            *class;
-    char            *class_id;
-} pzPendingImfileRow;
-
-/** Creates a new pzPendingImfileRow object
- *
- *  @return A new pzPendingImfileRow object or NULL on failure.
- */
-
-pzPendingImfileRow *pzPendingImfileRowAlloc(
-    const char      *exp_name,
-    const char      *camera,
-    const char      *telescope,
-    const char      *class,
-    const char      *class_id
-);
-
-/** 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_name,
-    const char      *camera,
-    const char      *telescope,
-    const char      *class,
-    const char      *class_id
-);
-
-/** 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
-    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 pzPendingImfileSelectRowsFits(
-    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 pzPendingImfileRow into an equivalent psMetadata
- *
- * @return A psMetadata pointer or NULL on error
- */
-
-psMetadata *pzPendingImfileMetadataFromObject(
-    const pzPendingImfileRow *object             ///< fooRow to convert into a psMetadata
-);
-
-/** Convert a psMetadata into an equivalent fooRow
- *
- * @return A pzPendingImfileRow pointer or NULL on error
- */
-
-pzPendingImfileRow *pzPendingImfileObjectFromMetadata(
-    psMetadata      *md                 ///< psMetadata to convert into a fooRow
-);
-/** Selects up to limit rows from the database and returns as pzPendingImfileRow objects in a psArray
- *
- *  See psDBSelectRows() for documentation on the format of where.
- *
- * @return A psArray pointer or NULL on error
- */
-
-psArray *pzPendingImfileSelectRowObjects(
-    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 pzPendingImfile
- *
- *  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 pzPendingImfileDeleteObject(
-    psDB            *dbh,               ///< Database handle
-    const pzPendingImfileRow *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 pzPendingImfileDeleteRowObjects(
-    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 pzPendingImfileRow 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 pzPendingImfilePrintObjects(
-    FILE            *stream,            ///< a stream
-    psArray         *objects,           ///< An array of pzPendingImfileRow objects
-    bool            mdcf                ///< format as mdconfig or simple
-);
-/** Formats and prints an pzPendingImfileRow 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 pzPendingImfilePrintObject(
-    FILE            *stream,            ///< a stream
-    pzPendingImfileRow *object,    ///< an pzPendingImfileRow object
-    bool            mdcf                ///< format as mdconfig or simple
-);
-/** pzDoneExpRow data structure
- *
- * Structure for representing a single row of pzDoneExp table data.
- */
-
-typedef struct {
-    char            *exp_name;
-    char            *camera;
-    char            *telescope;
-} pzDoneExpRow;
-
-/** Creates a new pzDoneExpRow object
- *
- *  @return A new pzDoneExpRow object or NULL on failure.
- */
-
-pzDoneExpRow *pzDoneExpRowAlloc(
-    const char      *exp_name,
-    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_name,
-    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
-);
-/** Formats and prints an pzDoneExpRow 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 pzDoneExpPrintObject(
-    FILE            *stream,            ///< a stream
-    pzDoneExpRow *object,    ///< an pzDoneExpRow object
-    bool            mdcf                ///< format as mdconfig or simple
-);
-/** pzDoneImfileRow data structure
- *
- * Structure for representing a single row of pzDoneImfile table data.
+/** pzDownloadImfileRow data structure
+ *
+ * Structure for representing a single row of pzDownloadImfile table data.
  */
 
@@ -1379,12 +974,13 @@
     char            *class_id;
     char            *uri;
-} pzDoneImfileRow;
-
-/** Creates a new pzDoneImfileRow object
- *
- *  @return A new pzDoneImfileRow object or NULL on failure.
- */
-
-pzDoneImfileRow *pzDoneImfileRowAlloc(
+    psS16           fault;
+} pzDownloadImfileRow;
+
+/** Creates a new pzDownloadImfileRow object
+ *
+ *  @return A new pzDownloadImfileRow object or NULL on failure.
+ */
+
+pzDownloadImfileRow *pzDownloadImfileRowAlloc(
     const char      *exp_name,
     const char      *camera,
@@ -1392,22 +988,23 @@
     const char      *class,
     const char      *class_id,
-    const char      *uri
-);
-
-/** Creates a new pzDoneImfile table
- *
- * @return true on success
- */
-
-bool pzDoneImfileCreateTable(
+    const char      *uri,
+    psS16           fault
+);
+
+/** Creates a new pzDownloadImfile table
+ *
+ * @return true on success
+ */
+
+bool pzDownloadImfileCreateTable(
     psDB            *dbh                ///< Database handle
 );
 
-/** Deletes a pzDoneImfile table
- *
- * @return true on success
- */
-
-bool pzDoneImfileDropTable(
+/** Deletes a pzDownloadImfile table
+ *
+ * @return true on success
+ */
+
+bool pzDownloadImfileDropTable(
     psDB            *dbh                ///< Database handle
 );
@@ -1420,5 +1017,5 @@
  */
 
-bool pzDoneImfileInsert(
+bool pzDownloadImfileInsert(
     psDB            *dbh,               ///< Database handle
     const char      *exp_name,
@@ -1427,5 +1024,6 @@
     const char      *class,
     const char      *class_id,
-    const char      *uri
+    const char      *uri,
+    psS16           fault
 );
 
@@ -1435,5 +1033,5 @@
  */
 
-long long pzDoneImfileDelete(
+long long pzDownloadImfileDelete(
     psDB            *dbh,               ///< Database handle
     const psMetadata *where,            ///< Row match criteria
@@ -1441,5 +1039,5 @@
 );
 
-/** Insert a single pzDoneImfileRow object into a table
+/** Insert a single pzDownloadImfileRow object into a table
  *
  * This function constructs and inserts a single row based on it's parameters.
@@ -1448,10 +1046,10 @@
  */
 
-bool pzDoneImfileInsertObject(
-    psDB            *dbh,               ///< Database handle
-    pzDoneImfileRow *object             ///< pzDoneImfileRow object
-);
-
-/** Insert an array of pzDoneImfileRow object into a table
+bool pzDownloadImfileInsertObject(
+    psDB            *dbh,               ///< Database handle
+    pzDownloadImfileRow *object             ///< pzDownloadImfileRow object
+);
+
+/** Insert an array of pzDownloadImfileRow object into a table
  *
  * This function constructs and inserts multiple rows based on it's parameters.
@@ -1460,10 +1058,10 @@
  */
 
-bool pzDoneImfileInsertObjects(
-    psDB            *dbh,               ///< Database handle
-    psArray         *objects            ///< array of pzDoneImfileRow objects
-);
-
-/** Insert data from a binary FITS table pzDoneImfileRow into the database
+bool pzDownloadImfileInsertObjects(
+    psDB            *dbh,               ///< Database handle
+    psArray         *objects            ///< array of pzDownloadImfileRow objects
+);
+
+/** Insert data from a binary FITS table pzDownloadImfileRow into the database
  *
  * This function expects a psFits object with a FITS table as the first
@@ -1475,5 +1073,5 @@
  */
 
-bool pzDoneImfileInsertFits(
+bool pzDownloadImfileInsertFits(
     psDB            *dbh,               ///< Database handle
     const psFits    *fits               ///< psFits object
@@ -1490,5 +1088,5 @@
  */
 
-bool pzDoneImfileSelectRowsFits(
+bool pzDownloadImfileSelectRowsFits(
     psDB            *dbh,               ///< Database handle
     psFits          *fits,              ///< psFits object
@@ -1497,22 +1095,22 @@
 );
 
-/** Convert a pzDoneImfileRow into an equivalent psMetadata
+/** Convert a pzDownloadImfileRow into an equivalent psMetadata
  *
  * @return A psMetadata pointer or NULL on error
  */
 
-psMetadata *pzDoneImfileMetadataFromObject(
-    const pzDoneImfileRow *object             ///< fooRow to convert into a psMetadata
+psMetadata *pzDownloadImfileMetadataFromObject(
+    const pzDownloadImfileRow *object             ///< fooRow to convert into a psMetadata
 );
 
 /** Convert a psMetadata into an equivalent fooRow
  *
- * @return A pzDoneImfileRow pointer or NULL on error
- */
-
-pzDoneImfileRow *pzDoneImfileObjectFromMetadata(
+ * @return A pzDownloadImfileRow pointer or NULL on error
+ */
+
+pzDownloadImfileRow *pzDownloadImfileObjectFromMetadata(
     psMetadata      *md                 ///< psMetadata to convert into a fooRow
 );
-/** Selects up to limit rows from the database and returns as pzDoneImfileRow objects in a psArray
+/** Selects up to limit rows from the database and returns as pzDownloadImfileRow objects in a psArray
  *
  *  See psDBSelectRows() for documentation on the format of where.
@@ -1521,10 +1119,10 @@
  */
 
-psArray *pzDoneImfileSelectRowObjects(
+psArray *pzDownloadImfileSelectRowObjects(
     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
+/** Deletes a row from the database coresponding to an pzDownloadImfile
  *
  *  Note that a 'where' search psMetadata is constructed from each object and
@@ -1534,7 +1132,7 @@
  */
 
-bool pzDoneImfileDeleteObject(
-    psDB            *dbh,               ///< Database handle
-    const pzDoneImfileRow *object    ///< Object to delete
+bool pzDownloadImfileDeleteObject(
+    psDB            *dbh,               ///< Database handle
+    const pzDownloadImfileRow *object    ///< Object to delete
 );
 /** Deletes up to limit rows from the database and returns the number of rows actually deleted. 
@@ -1546,10 +1144,10 @@
  */
 
-long long pzDoneImfileDeleteRowObjects(
+long long pzDownloadImfileDeleteRowObjects(
     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
+/** Formats and prints an array of pzDownloadImfileRow objects
  *
  * When mdcf is set the formated output is in psMetadataConfig
@@ -1559,10 +1157,10 @@
  */
 
-bool pzDoneImfilePrintObjects(
+bool pzDownloadImfilePrintObjects(
     FILE            *stream,            ///< a stream
-    psArray         *objects,           ///< An array of pzDoneImfileRow objects
+    psArray         *objects,           ///< An array of pzDownloadImfileRow objects
     bool            mdcf                ///< format as mdconfig or simple
 );
-/** Formats and prints an pzDoneImfileRow object
+/** Formats and prints an pzDownloadImfileRow object
  *
  * When mdcf is set the formated output is in psMetadataConfig
@@ -1572,7 +1170,7 @@
  */
 
-bool pzDoneImfilePrintObject(
+bool pzDownloadImfilePrintObject(
     FILE            *stream,            ///< a stream
-    pzDoneImfileRow *object,    ///< an pzDoneImfileRow object
+    pzDownloadImfileRow *object,    ///< an pzDownloadImfileRow object
     bool            mdcf                ///< format as mdconfig or simple
 );
@@ -1594,4 +1192,5 @@
     char            *tess_id;
     char            *end_stage;
+    char            *label;
 } newExpRow;
 
@@ -1612,5 +1211,6 @@
     const char      *dvodb,
     const char      *tess_id,
-    const char      *end_stage
+    const char      *end_stage,
+    const char      *label
 );
 
@@ -1652,5 +1252,6 @@
     const char      *dvodb,
     const char      *tess_id,
-    const char      *end_stage
+    const char      *end_stage,
+    const char      *label
 );
 
@@ -3159,6 +2760,12 @@
     psF32           ap_resid;
     psF32           ap_resid_stdev;
-    psF32           fwhm;
-    psF32           fwhm_range;
+    psF32           zp_mean;
+    psF32           zp_stdev;
+    psF32           fwhm_major;
+    psF32           fwhm_minor;
+    psF32           dtime_detrend;
+    psF32           dtime_photom;
+    psF32           dtime_astrom;
+    char            *hostname;
     psS32           n_stars;
     psS32           n_extended;
@@ -3191,6 +2798,12 @@
     psF32           ap_resid,
     psF32           ap_resid_stdev,
-    psF32           fwhm,
-    psF32           fwhm_range,
+    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,
@@ -3244,6 +2857,12 @@
     psF32           ap_resid,
     psF32           ap_resid_stdev,
-    psF32           fwhm,
-    psF32           fwhm_range,
+    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,
@@ -3833,10 +3452,21 @@
     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;
-    psF32           fwhm_range;
+    psF32           fwhm_major;
+    psF32           fwhm_minor;
+    psF32           dtime_detrend;
+    psF32           dtime_photom;
+    psF32           dtime_astrom;
+    char            *hostname;
     psS32           n_stars;
     psS32           n_extended;
@@ -3859,10 +3489,21 @@
     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,
-    psF32           fwhm_range,
+    psF32           fwhm_major,
+    psF32           fwhm_minor,
+    psF32           dtime_detrend,
+    psF32           dtime_photom,
+    psF32           dtime_astrom,
+    const char      *hostname,
     psS32           n_stars,
     psS32           n_extended,
@@ -3906,10 +3547,21 @@
     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,
-    psF32           fwhm_range,
+    psF32           fwhm_major,
+    psF32           fwhm_minor,
+    psF32           dtime_detrend,
+    psF32           dtime_photom,
+    psF32           dtime_astrom,
+    const char      *hostname,
     psS32           n_stars,
     psS32           n_extended,
@@ -4905,5 +4557,7 @@
     psF64           bg;
     psF64           bg_stdev;
-    psF64           good_frac;
+    psF32           dtime_warp;
+    char            *hostname;
+    psF32           good_frac;
     bool            ignored;
     psS16           fault;
@@ -4923,5 +4577,7 @@
     psF64           bg,
     psF64           bg_stdev,
-    psF64           good_frac,
+    psF32           dtime_warp,
+    const char      *hostname,
+    psF32           good_frac,
     bool            ignored,
     psS16           fault
@@ -4962,5 +4618,7 @@
     psF64           bg,
     psF64           bg_stdev,
-    psF64           good_frac,
+    psF32           dtime_warp,
+    const char      *hostname,
+    psF32           good_frac,
     bool            ignored,
     psS16           fault
@@ -5551,5 +5209,7 @@
     psF64           bg;
     psF64           bg_stdev;
-    psF64           good_frac;
+    psF32           dtime_diff;
+    char            *hostname;
+    psF32           good_frac;
     psS16           fault;
 } diffSkyfileRow;
@@ -5566,5 +5226,7 @@
     psF64           bg,
     psF64           bg_stdev,
-    psF64           good_frac,
+    psF32           dtime_diff,
+    const char      *hostname,
+    psF32           good_frac,
     psS16           fault
 );
@@ -5602,5 +5264,7 @@
     psF64           bg,
     psF64           bg_stdev,
-    psF64           good_frac,
+    psF32           dtime_diff,
+    const char      *hostname,
+    psF32           good_frac,
     psS16           fault
 );
@@ -6175,5 +5839,7 @@
     psF64           bg;
     psF64           bg_stdev;
-    psF64           good_frac;
+    psF32           dtime_stack;
+    char            *hostname;
+    psF32           good_frac;
     psS16           fault;
 } stackSumSkyfileRow;
@@ -6190,5 +5856,7 @@
     psF64           bg,
     psF64           bg_stdev,
-    psF64           good_frac,
+    psF32           dtime_stack,
+    const char      *hostname,
+    psF32           good_frac,
     psS16           fault
 );
@@ -6226,5 +5894,7 @@
     psF64           bg,
     psF64           bg_stdev,
-    psF64           good_frac,
+    psF32           dtime_stack,
+    const char      *hostname,
+    psF32           good_frac,
     psS16           fault
 );
@@ -10878,5 +10548,5 @@
 typedef struct {
     psS64           cal_id;
-    char            *catdir;
+    char            *dvodb;
     char            *state;
 } calDBRow;
@@ -10889,5 +10559,5 @@
 calDBRow *calDBRowAlloc(
     psS64           cal_id,
-    const char      *catdir,
+    const char      *dvodb,
     const char      *state
 );
@@ -10921,5 +10591,5 @@
     psDB            *dbh,               ///< Database handle
     psS64           cal_id,
-    const char      *catdir,
+    const char      *dvodb,
     const char      *state
 );
@@ -11284,4 +10954,5 @@
     psS64           corr_id;
     char            *dvodb;
+    char            *filter;
     char            *state;
     char            *workdir;
@@ -11298,4 +10969,5 @@
     psS64           corr_id,
     const char      *dvodb,
+    const char      *filter,
     const char      *state,
     const char      *workdir,
@@ -11333,4 +11005,5 @@
     psS64           corr_id,
     const char      *dvodb,
+    const char      *filter,
     const char      *state,
     const char      *workdir,
@@ -11684,4 +11357,625 @@
     bool            mdcf                ///< format as mdconfig or simple
 );
+/** pstampDataStoreRow data structure
+ *
+ * Structure for representing a single row of pstampDataStore table data.
+ */
+
+typedef struct {
+    psS64           ds_id;
+    char            *uri;
+    char            *lastFileset;
+    char            *state;
+} pstampDataStoreRow;
+
+/** Creates a new pstampDataStoreRow object
+ *
+ *  @return A new pstampDataStoreRow object or NULL on failure.
+ */
+
+pstampDataStoreRow *pstampDataStoreRowAlloc(
+    psS64           ds_id,
+    const char      *uri,
+    const char      *lastFileset,
+    const char      *state
+);
+
+/** Creates a new pstampDataStore table
+ *
+ * @return true on success
+ */
+
+bool pstampDataStoreCreateTable(
+    psDB            *dbh                ///< Database handle
+);
+
+/** Deletes a pstampDataStore table
+ *
+ * @return true on success
+ */
+
+bool pstampDataStoreDropTable(
+    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 pstampDataStoreInsert(
+    psDB            *dbh,               ///< Database handle
+    psS64           ds_id,
+    const char      *uri,
+    const char      *lastFileset,
+    const char      *state
+);
+
+/** 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 pstampDataStoreDelete(
+    psDB            *dbh,               ///< Database handle
+    const psMetadata *where,            ///< Row match criteria
+    unsigned long long limit            ///< Maximum number of elements to delete 
+);
+
+/** Insert a single pstampDataStoreRow object into a table
+ *
+ * This function constructs and inserts a single row based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool pstampDataStoreInsertObject(
+    psDB            *dbh,               ///< Database handle
+    pstampDataStoreRow *object             ///< pstampDataStoreRow object
+);
+
+/** Insert an array of pstampDataStoreRow object into a table
+ *
+ * This function constructs and inserts multiple rows based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool pstampDataStoreInsertObjects(
+    psDB            *dbh,               ///< Database handle
+    psArray         *objects            ///< array of pstampDataStoreRow objects
+);
+
+/** Insert data from a binary FITS table pstampDataStoreRow 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 pstampDataStoreInsertFits(
+    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 pstampDataStoreSelectRowsFits(
+    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 pstampDataStoreRow into an equivalent psMetadata
+ *
+ * @return A psMetadata pointer or NULL on error
+ */
+
+psMetadata *pstampDataStoreMetadataFromObject(
+    const pstampDataStoreRow *object             ///< fooRow to convert into a psMetadata
+);
+
+/** Convert a psMetadata into an equivalent fooRow
+ *
+ * @return A pstampDataStoreRow pointer or NULL on error
+ */
+
+pstampDataStoreRow *pstampDataStoreObjectFromMetadata(
+    psMetadata      *md                 ///< psMetadata to convert into a fooRow
+);
+/** Selects up to limit rows from the database and returns as pstampDataStoreRow objects in a psArray
+ *
+ *  See psDBSelectRows() for documentation on the format of where.
+ *
+ * @return A psArray pointer or NULL on error
+ */
+
+psArray *pstampDataStoreSelectRowObjects(
+    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 pstampDataStore
+ *
+ *  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 pstampDataStoreDeleteObject(
+    psDB            *dbh,               ///< Database handle
+    const pstampDataStoreRow *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 pstampDataStoreDeleteRowObjects(
+    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 pstampDataStoreRow 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 pstampDataStorePrintObjects(
+    FILE            *stream,            ///< a stream
+    psArray         *objects,           ///< An array of pstampDataStoreRow objects
+    bool            mdcf                ///< format as mdconfig or simple
+);
+/** Formats and prints an pstampDataStoreRow 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 pstampDataStorePrintObject(
+    FILE            *stream,            ///< a stream
+    pstampDataStoreRow *object,    ///< an pstampDataStoreRow object
+    bool            mdcf                ///< format as mdconfig or simple
+);
+/** pstampRequestRow data structure
+ *
+ * Structure for representing a single row of pstampRequest table data.
+ */
+
+typedef struct {
+    psS64           req_id;
+    psS64           ds_id;
+    char            *state;
+    char            *uri;
+} pstampRequestRow;
+
+/** Creates a new pstampRequestRow object
+ *
+ *  @return A new pstampRequestRow object or NULL on failure.
+ */
+
+pstampRequestRow *pstampRequestRowAlloc(
+    psS64           req_id,
+    psS64           ds_id,
+    const char      *state,
+    const char      *uri
+);
+
+/** Creates a new pstampRequest table
+ *
+ * @return true on success
+ */
+
+bool pstampRequestCreateTable(
+    psDB            *dbh                ///< Database handle
+);
+
+/** Deletes a pstampRequest table
+ *
+ * @return true on success
+ */
+
+bool pstampRequestDropTable(
+    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 pstampRequestInsert(
+    psDB            *dbh,               ///< Database handle
+    psS64           req_id,
+    psS64           ds_id,
+    const char      *state,
+    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 pstampRequestDelete(
+    psDB            *dbh,               ///< Database handle
+    const psMetadata *where,            ///< Row match criteria
+    unsigned long long limit            ///< Maximum number of elements to delete 
+);
+
+/** Insert a single pstampRequestRow object into a table
+ *
+ * This function constructs and inserts a single row based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool pstampRequestInsertObject(
+    psDB            *dbh,               ///< Database handle
+    pstampRequestRow *object             ///< pstampRequestRow object
+);
+
+/** Insert an array of pstampRequestRow object into a table
+ *
+ * This function constructs and inserts multiple rows based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool pstampRequestInsertObjects(
+    psDB            *dbh,               ///< Database handle
+    psArray         *objects            ///< array of pstampRequestRow objects
+);
+
+/** Insert data from a binary FITS table pstampRequestRow 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 pstampRequestInsertFits(
+    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 pstampRequestSelectRowsFits(
+    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 pstampRequestRow into an equivalent psMetadata
+ *
+ * @return A psMetadata pointer or NULL on error
+ */
+
+psMetadata *pstampRequestMetadataFromObject(
+    const pstampRequestRow *object             ///< fooRow to convert into a psMetadata
+);
+
+/** Convert a psMetadata into an equivalent fooRow
+ *
+ * @return A pstampRequestRow pointer or NULL on error
+ */
+
+pstampRequestRow *pstampRequestObjectFromMetadata(
+    psMetadata      *md                 ///< psMetadata to convert into a fooRow
+);
+/** Selects up to limit rows from the database and returns as pstampRequestRow objects in a psArray
+ *
+ *  See psDBSelectRows() for documentation on the format of where.
+ *
+ * @return A psArray pointer or NULL on error
+ */
+
+psArray *pstampRequestSelectRowObjects(
+    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 pstampRequest
+ *
+ *  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 pstampRequestDeleteObject(
+    psDB            *dbh,               ///< Database handle
+    const pstampRequestRow *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 pstampRequestDeleteRowObjects(
+    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 pstampRequestRow 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 pstampRequestPrintObjects(
+    FILE            *stream,            ///< a stream
+    psArray         *objects,           ///< An array of pstampRequestRow objects
+    bool            mdcf                ///< format as mdconfig or simple
+);
+/** Formats and prints an pstampRequestRow 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 pstampRequestPrintObject(
+    FILE            *stream,            ///< a stream
+    pstampRequestRow *object,    ///< an pstampRequestRow object
+    bool            mdcf                ///< format as mdconfig or simple
+);
+/** pstampJobRow data structure
+ *
+ * Structure for representing a single row of pstampJob table data.
+ */
+
+typedef struct {
+    psS64           job_id;
+    psS64           req_id;
+    char            *state;
+    psS32           result;
+    char            *uri;
+    char            *outputBase;
+    char            *args;
+} pstampJobRow;
+
+/** Creates a new pstampJobRow object
+ *
+ *  @return A new pstampJobRow object or NULL on failure.
+ */
+
+pstampJobRow *pstampJobRowAlloc(
+    psS64           job_id,
+    psS64           req_id,
+    const char      *state,
+    psS32           result,
+    const char      *uri,
+    const char      *outputBase,
+    const char      *args
+);
+
+/** Creates a new pstampJob table
+ *
+ * @return true on success
+ */
+
+bool pstampJobCreateTable(
+    psDB            *dbh                ///< Database handle
+);
+
+/** Deletes a pstampJob table
+ *
+ * @return true on success
+ */
+
+bool pstampJobDropTable(
+    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 pstampJobInsert(
+    psDB            *dbh,               ///< Database handle
+    psS64           job_id,
+    psS64           req_id,
+    const char      *state,
+    psS32           result,
+    const char      *uri,
+    const char      *outputBase,
+    const char      *args
+);
+
+/** 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 pstampJobDelete(
+    psDB            *dbh,               ///< Database handle
+    const psMetadata *where,            ///< Row match criteria
+    unsigned long long limit            ///< Maximum number of elements to delete 
+);
+
+/** Insert a single pstampJobRow object into a table
+ *
+ * This function constructs and inserts a single row based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool pstampJobInsertObject(
+    psDB            *dbh,               ///< Database handle
+    pstampJobRow    *object             ///< pstampJobRow object
+);
+
+/** Insert an array of pstampJobRow object into a table
+ *
+ * This function constructs and inserts multiple rows based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool pstampJobInsertObjects(
+    psDB            *dbh,               ///< Database handle
+    psArray         *objects            ///< array of pstampJobRow objects
+);
+
+/** Insert data from a binary FITS table pstampJobRow 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 pstampJobInsertFits(
+    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 pstampJobSelectRowsFits(
+    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 pstampJobRow into an equivalent psMetadata
+ *
+ * @return A psMetadata pointer or NULL on error
+ */
+
+psMetadata *pstampJobMetadataFromObject(
+    const pstampJobRow *object             ///< fooRow to convert into a psMetadata
+);
+
+/** Convert a psMetadata into an equivalent fooRow
+ *
+ * @return A pstampJobRow pointer or NULL on error
+ */
+
+pstampJobRow *pstampJobObjectFromMetadata(
+    psMetadata      *md                 ///< psMetadata to convert into a fooRow
+);
+/** Selects up to limit rows from the database and returns as pstampJobRow objects in a psArray
+ *
+ *  See psDBSelectRows() for documentation on the format of where.
+ *
+ * @return A psArray pointer or NULL on error
+ */
+
+psArray *pstampJobSelectRowObjects(
+    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 pstampJob
+ *
+ *  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 pstampJobDeleteObject(
+    psDB            *dbh,               ///< Database handle
+    const pstampJobRow *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 pstampJobDeleteRowObjects(
+    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 pstampJobRow 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 pstampJobPrintObjects(
+    FILE            *stream,            ///< a stream
+    psArray         *objects,           ///< An array of pstampJobRow objects
+    bool            mdcf                ///< format as mdconfig or simple
+);
+/** Formats and prints an pstampJobRow 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 pstampJobPrintObject(
+    FILE            *stream,            ///< a stream
+    pstampJobRow *object,    ///< an pstampJobRow object
+    bool            mdcf                ///< format as mdconfig or simple
+);
 
 /// @}
@@ -11691,3 +11985,3 @@
 #endif
 
-#endif // FLATCORREXP_DB_H
+#endif // PSTAMPJOB_DB_H
