Index: trunk/ippdb/src/ippdb.h
===================================================================
--- trunk/ippdb/src/ippdb.h	(revision 10449)
+++ trunk/ippdb/src/ippdb.h	(revision 10681)
@@ -6597,4 +6597,1192 @@
     bool            mdcf                ///< format as mdconfig or simple
 );
+/** p4RunRow data structure
+ *
+ * Structure for representing a single row of p4Run table data.
+ */
+
+typedef struct {
+    psS32           p4_id;
+    char            *survey_mode;
+    char            *state;
+    char            *filter;
+    char            *skycell_id;
+    char            *tess_id;
+    psF64           ra;
+    psF64           decl;
+    char            *input_ss;
+    char            *output_ss;
+} p4RunRow;
+
+/** Creates a new p4RunRow object
+ *
+ *  @return A new p4RunRow object or NULL on failure.
+ */
+
+p4RunRow *p4RunRowAlloc(
+    psS32           p4_id,
+    const char      *survey_mode,
+    const char      *state,
+    const char      *filter,
+    const char      *skycell_id,
+    const char      *tess_id,
+    psF64           ra,
+    psF64           decl,
+    const char      *input_ss,
+    const char      *output_ss
+);
+
+/** Creates a new p4Run table
+ *
+ * @return true on success
+ */
+
+bool p4RunCreateTable(
+    psDB            *dbh                ///< Database handle
+);
+
+/** Deletes a p4Run table
+ *
+ * @return true on success
+ */
+
+bool p4RunDropTable(
+    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 p4RunInsert(
+    psDB            *dbh,               ///< Database handle
+    psS32           p4_id,
+    const char      *survey_mode,
+    const char      *state,
+    const char      *filter,
+    const char      *skycell_id,
+    const char      *tess_id,
+    psF64           ra,
+    psF64           decl,
+    const char      *input_ss,
+    const char      *output_ss
+);
+
+/** 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 p4RunDelete(
+    psDB            *dbh,               ///< Database handle
+    const psMetadata *where,            ///< Row match criteria
+    unsigned long long limit            ///< Maximum number of elements to delete 
+);
+
+/** Insert a single p4RunRow object into a table
+ *
+ * This function constructs and inserts a single row based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool p4RunInsertObject(
+    psDB            *dbh,               ///< Database handle
+    p4RunRow        *object             ///< p4RunRow object
+);
+
+/** Insert an array of p4RunRow object into a table
+ *
+ * This function constructs and inserts multiple rows based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool p4RunInsertObjects(
+    psDB            *dbh,               ///< Database handle
+    psArray         *objects            ///< array of p4RunRow objects
+);
+
+/** Insert data from a binary FITS table p4RunRow 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 p4RunInsertFits(
+    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 p4RunSelectRowsFits(
+    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 p4RunRow into an equivalent psMetadata
+ *
+ * @return A psMetadata pointer or NULL on error
+ */
+
+psMetadata *p4RunMetadataFromObject(
+    const p4RunRow  *object             ///< fooRow to convert into a psMetadata
+);
+
+/** Convert a psMetadata into an equivalent fooRow
+ *
+ * @return A p4RunRow pointer or NULL on error
+ */
+
+p4RunRow *p4RunObjectFromMetadata(
+    psMetadata      *md                 ///< psMetadata to convert into a fooRow
+);
+/** Selects up to limit rows from the database and returns as p4RunRow objects in a psArray
+ *
+ *  See psDBSelectRows() for documentation on the format of where.
+ *
+ * @return A psArray pointer or NULL on error
+ */
+
+psArray *p4RunSelectRowObjects(
+    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 p4Run
+ *
+ *  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 p4RunDeleteObject(
+    psDB            *dbh,               ///< Database handle
+    const p4RunRow *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 p4RunDeleteRowObjects(
+    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 p4RunRow 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 p4RunPrintObjects(
+    FILE            *stream,            ///< a stream
+    psArray         *objects,           ///< An array of p4RunRow objects
+    bool            mdcf                ///< format as mdconfig or simple
+);
+/** p4InputImfileRow data structure
+ *
+ * Structure for representing a single row of p4InputImfile table data.
+ */
+
+typedef struct {
+    psS32           p4_id;
+    char            *exp_tag;
+    psS32           p3_version;
+    char            *class_id;
+} p4InputImfileRow;
+
+/** Creates a new p4InputImfileRow object
+ *
+ *  @return A new p4InputImfileRow object or NULL on failure.
+ */
+
+p4InputImfileRow *p4InputImfileRowAlloc(
+    psS32           p4_id,
+    const char      *exp_tag,
+    psS32           p3_version,
+    const char      *class_id
+);
+
+/** Creates a new p4InputImfile table
+ *
+ * @return true on success
+ */
+
+bool p4InputImfileCreateTable(
+    psDB            *dbh                ///< Database handle
+);
+
+/** Deletes a p4InputImfile table
+ *
+ * @return true on success
+ */
+
+bool p4InputImfileDropTable(
+    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 p4InputImfileInsert(
+    psDB            *dbh,               ///< Database handle
+    psS32           p4_id,
+    const char      *exp_tag,
+    psS32           p3_version,
+    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 p4InputImfileDelete(
+    psDB            *dbh,               ///< Database handle
+    const psMetadata *where,            ///< Row match criteria
+    unsigned long long limit            ///< Maximum number of elements to delete 
+);
+
+/** Insert a single p4InputImfileRow object into a table
+ *
+ * This function constructs and inserts a single row based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool p4InputImfileInsertObject(
+    psDB            *dbh,               ///< Database handle
+    p4InputImfileRow *object             ///< p4InputImfileRow object
+);
+
+/** Insert an array of p4InputImfileRow object into a table
+ *
+ * This function constructs and inserts multiple rows based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool p4InputImfileInsertObjects(
+    psDB            *dbh,               ///< Database handle
+    psArray         *objects            ///< array of p4InputImfileRow objects
+);
+
+/** Insert data from a binary FITS table p4InputImfileRow 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 p4InputImfileInsertFits(
+    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 p4InputImfileSelectRowsFits(
+    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 p4InputImfileRow into an equivalent psMetadata
+ *
+ * @return A psMetadata pointer or NULL on error
+ */
+
+psMetadata *p4InputImfileMetadataFromObject(
+    const p4InputImfileRow *object             ///< fooRow to convert into a psMetadata
+);
+
+/** Convert a psMetadata into an equivalent fooRow
+ *
+ * @return A p4InputImfileRow pointer or NULL on error
+ */
+
+p4InputImfileRow *p4InputImfileObjectFromMetadata(
+    psMetadata      *md                 ///< psMetadata to convert into a fooRow
+);
+/** Selects up to limit rows from the database and returns as p4InputImfileRow objects in a psArray
+ *
+ *  See psDBSelectRows() for documentation on the format of where.
+ *
+ * @return A psArray pointer or NULL on error
+ */
+
+psArray *p4InputImfileSelectRowObjects(
+    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 p4InputImfile
+ *
+ *  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 p4InputImfileDeleteObject(
+    psDB            *dbh,               ///< Database handle
+    const p4InputImfileRow *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 p4InputImfileDeleteRowObjects(
+    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 p4InputImfileRow 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 p4InputImfilePrintObjects(
+    FILE            *stream,            ///< a stream
+    psArray         *objects,           ///< An array of p4InputImfileRow objects
+    bool            mdcf                ///< format as mdconfig or simple
+);
+/** p4PWarpedImfileRow data structure
+ *
+ * Structure for representing a single row of p4PWarpedImfile table data.
+ */
+
+typedef struct {
+    psS32           p4_id;
+    char            *exp_tag;
+    psS32           p3_version;
+    char            *class_id;
+    char            *uri;
+    char            *b1_uri;
+    char            *b2_uri;
+} p4PWarpedImfileRow;
+
+/** Creates a new p4PWarpedImfileRow object
+ *
+ *  @return A new p4PWarpedImfileRow object or NULL on failure.
+ */
+
+p4PWarpedImfileRow *p4PWarpedImfileRowAlloc(
+    psS32           p4_id,
+    const char      *exp_tag,
+    psS32           p3_version,
+    const char      *class_id,
+    const char      *uri,
+    const char      *b1_uri,
+    const char      *b2_uri
+);
+
+/** Creates a new p4PWarpedImfile table
+ *
+ * @return true on success
+ */
+
+bool p4PWarpedImfileCreateTable(
+    psDB            *dbh                ///< Database handle
+);
+
+/** Deletes a p4PWarpedImfile table
+ *
+ * @return true on success
+ */
+
+bool p4PWarpedImfileDropTable(
+    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 p4PWarpedImfileInsert(
+    psDB            *dbh,               ///< Database handle
+    psS32           p4_id,
+    const char      *exp_tag,
+    psS32           p3_version,
+    const char      *class_id,
+    const char      *uri,
+    const char      *b1_uri,
+    const char      *b2_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 p4PWarpedImfileDelete(
+    psDB            *dbh,               ///< Database handle
+    const psMetadata *where,            ///< Row match criteria
+    unsigned long long limit            ///< Maximum number of elements to delete 
+);
+
+/** Insert a single p4PWarpedImfileRow object into a table
+ *
+ * This function constructs and inserts a single row based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool p4PWarpedImfileInsertObject(
+    psDB            *dbh,               ///< Database handle
+    p4PWarpedImfileRow *object             ///< p4PWarpedImfileRow object
+);
+
+/** Insert an array of p4PWarpedImfileRow object into a table
+ *
+ * This function constructs and inserts multiple rows based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool p4PWarpedImfileInsertObjects(
+    psDB            *dbh,               ///< Database handle
+    psArray         *objects            ///< array of p4PWarpedImfileRow objects
+);
+
+/** Insert data from a binary FITS table p4PWarpedImfileRow 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 p4PWarpedImfileInsertFits(
+    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 p4PWarpedImfileSelectRowsFits(
+    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 p4PWarpedImfileRow into an equivalent psMetadata
+ *
+ * @return A psMetadata pointer or NULL on error
+ */
+
+psMetadata *p4PWarpedImfileMetadataFromObject(
+    const p4PWarpedImfileRow *object             ///< fooRow to convert into a psMetadata
+);
+
+/** Convert a psMetadata into an equivalent fooRow
+ *
+ * @return A p4PWarpedImfileRow pointer or NULL on error
+ */
+
+p4PWarpedImfileRow *p4PWarpedImfileObjectFromMetadata(
+    psMetadata      *md                 ///< psMetadata to convert into a fooRow
+);
+/** Selects up to limit rows from the database and returns as p4PWarpedImfileRow objects in a psArray
+ *
+ *  See psDBSelectRows() for documentation on the format of where.
+ *
+ * @return A psArray pointer or NULL on error
+ */
+
+psArray *p4PWarpedImfileSelectRowObjects(
+    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 p4PWarpedImfile
+ *
+ *  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 p4PWarpedImfileDeleteObject(
+    psDB            *dbh,               ///< Database handle
+    const p4PWarpedImfileRow *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 p4PWarpedImfileDeleteRowObjects(
+    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 p4PWarpedImfileRow 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 p4PWarpedImfilePrintObjects(
+    FILE            *stream,            ///< a stream
+    psArray         *objects,           ///< An array of p4PWarpedImfileRow objects
+    bool            mdcf                ///< format as mdconfig or simple
+);
+/** p4PStackedImfileRow data structure
+ *
+ * Structure for representing a single row of p4PStackedImfile table data.
+ */
+
+typedef struct {
+    psS32           p4_id;
+    char            *class_id;
+    char            *uri;
+    char            *b1_uri;
+    char            *b2_uri;
+} p4PStackedImfileRow;
+
+/** Creates a new p4PStackedImfileRow object
+ *
+ *  @return A new p4PStackedImfileRow object or NULL on failure.
+ */
+
+p4PStackedImfileRow *p4PStackedImfileRowAlloc(
+    psS32           p4_id,
+    const char      *class_id,
+    const char      *uri,
+    const char      *b1_uri,
+    const char      *b2_uri
+);
+
+/** Creates a new p4PStackedImfile table
+ *
+ * @return true on success
+ */
+
+bool p4PStackedImfileCreateTable(
+    psDB            *dbh                ///< Database handle
+);
+
+/** Deletes a p4PStackedImfile table
+ *
+ * @return true on success
+ */
+
+bool p4PStackedImfileDropTable(
+    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 p4PStackedImfileInsert(
+    psDB            *dbh,               ///< Database handle
+    psS32           p4_id,
+    const char      *class_id,
+    const char      *uri,
+    const char      *b1_uri,
+    const char      *b2_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 p4PStackedImfileDelete(
+    psDB            *dbh,               ///< Database handle
+    const psMetadata *where,            ///< Row match criteria
+    unsigned long long limit            ///< Maximum number of elements to delete 
+);
+
+/** Insert a single p4PStackedImfileRow object into a table
+ *
+ * This function constructs and inserts a single row based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool p4PStackedImfileInsertObject(
+    psDB            *dbh,               ///< Database handle
+    p4PStackedImfileRow *object             ///< p4PStackedImfileRow object
+);
+
+/** Insert an array of p4PStackedImfileRow object into a table
+ *
+ * This function constructs and inserts multiple rows based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool p4PStackedImfileInsertObjects(
+    psDB            *dbh,               ///< Database handle
+    psArray         *objects            ///< array of p4PStackedImfileRow objects
+);
+
+/** Insert data from a binary FITS table p4PStackedImfileRow 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 p4PStackedImfileInsertFits(
+    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 p4PStackedImfileSelectRowsFits(
+    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 p4PStackedImfileRow into an equivalent psMetadata
+ *
+ * @return A psMetadata pointer or NULL on error
+ */
+
+psMetadata *p4PStackedImfileMetadataFromObject(
+    const p4PStackedImfileRow *object             ///< fooRow to convert into a psMetadata
+);
+
+/** Convert a psMetadata into an equivalent fooRow
+ *
+ * @return A p4PStackedImfileRow pointer or NULL on error
+ */
+
+p4PStackedImfileRow *p4PStackedImfileObjectFromMetadata(
+    psMetadata      *md                 ///< psMetadata to convert into a fooRow
+);
+/** Selects up to limit rows from the database and returns as p4PStackedImfileRow objects in a psArray
+ *
+ *  See psDBSelectRows() for documentation on the format of where.
+ *
+ * @return A psArray pointer or NULL on error
+ */
+
+psArray *p4PStackedImfileSelectRowObjects(
+    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 p4PStackedImfile
+ *
+ *  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 p4PStackedImfileDeleteObject(
+    psDB            *dbh,               ///< Database handle
+    const p4PStackedImfileRow *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 p4PStackedImfileDeleteRowObjects(
+    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 p4PStackedImfileRow 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 p4PStackedImfilePrintObjects(
+    FILE            *stream,            ///< a stream
+    psArray         *objects,           ///< An array of p4PStackedImfileRow objects
+    bool            mdcf                ///< format as mdconfig or simple
+);
+/** p4PDiffImfileRow data structure
+ *
+ * Structure for representing a single row of p4PDiffImfile table data.
+ */
+
+typedef struct {
+    psS32           p4_id;
+    char            *exp_tag;
+    psS32           p3_version;
+    char            *class_id;
+    char            *uri;
+    char            *b1_uri;
+    char            *b2_uri;
+} p4PDiffImfileRow;
+
+/** Creates a new p4PDiffImfileRow object
+ *
+ *  @return A new p4PDiffImfileRow object or NULL on failure.
+ */
+
+p4PDiffImfileRow *p4PDiffImfileRowAlloc(
+    psS32           p4_id,
+    const char      *exp_tag,
+    psS32           p3_version,
+    const char      *class_id,
+    const char      *uri,
+    const char      *b1_uri,
+    const char      *b2_uri
+);
+
+/** Creates a new p4PDiffImfile table
+ *
+ * @return true on success
+ */
+
+bool p4PDiffImfileCreateTable(
+    psDB            *dbh                ///< Database handle
+);
+
+/** Deletes a p4PDiffImfile table
+ *
+ * @return true on success
+ */
+
+bool p4PDiffImfileDropTable(
+    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 p4PDiffImfileInsert(
+    psDB            *dbh,               ///< Database handle
+    psS32           p4_id,
+    const char      *exp_tag,
+    psS32           p3_version,
+    const char      *class_id,
+    const char      *uri,
+    const char      *b1_uri,
+    const char      *b2_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 p4PDiffImfileDelete(
+    psDB            *dbh,               ///< Database handle
+    const psMetadata *where,            ///< Row match criteria
+    unsigned long long limit            ///< Maximum number of elements to delete 
+);
+
+/** Insert a single p4PDiffImfileRow object into a table
+ *
+ * This function constructs and inserts a single row based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool p4PDiffImfileInsertObject(
+    psDB            *dbh,               ///< Database handle
+    p4PDiffImfileRow *object             ///< p4PDiffImfileRow object
+);
+
+/** Insert an array of p4PDiffImfileRow object into a table
+ *
+ * This function constructs and inserts multiple rows based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool p4PDiffImfileInsertObjects(
+    psDB            *dbh,               ///< Database handle
+    psArray         *objects            ///< array of p4PDiffImfileRow objects
+);
+
+/** Insert data from a binary FITS table p4PDiffImfileRow 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 p4PDiffImfileInsertFits(
+    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 p4PDiffImfileSelectRowsFits(
+    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 p4PDiffImfileRow into an equivalent psMetadata
+ *
+ * @return A psMetadata pointer or NULL on error
+ */
+
+psMetadata *p4PDiffImfileMetadataFromObject(
+    const p4PDiffImfileRow *object             ///< fooRow to convert into a psMetadata
+);
+
+/** Convert a psMetadata into an equivalent fooRow
+ *
+ * @return A p4PDiffImfileRow pointer or NULL on error
+ */
+
+p4PDiffImfileRow *p4PDiffImfileObjectFromMetadata(
+    psMetadata      *md                 ///< psMetadata to convert into a fooRow
+);
+/** Selects up to limit rows from the database and returns as p4PDiffImfileRow objects in a psArray
+ *
+ *  See psDBSelectRows() for documentation on the format of where.
+ *
+ * @return A psArray pointer or NULL on error
+ */
+
+psArray *p4PDiffImfileSelectRowObjects(
+    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 p4PDiffImfile
+ *
+ *  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 p4PDiffImfileDeleteObject(
+    psDB            *dbh,               ///< Database handle
+    const p4PDiffImfileRow *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 p4PDiffImfileDeleteRowObjects(
+    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 p4PDiffImfileRow 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 p4PDiffImfilePrintObjects(
+    FILE            *stream,            ///< a stream
+    psArray         *objects,           ///< An array of p4PDiffImfileRow objects
+    bool            mdcf                ///< format as mdconfig or simple
+);
+/** p4PMagicMaskImfileRow data structure
+ *
+ * Structure for representing a single row of p4PMagicMaskImfile table data.
+ */
+
+typedef struct {
+    psS32           p4_id;
+    char            *exp_tag;
+    psS32           p3_version;
+    char            *class_id;
+    char            *uri;
+} p4PMagicMaskImfileRow;
+
+/** Creates a new p4PMagicMaskImfileRow object
+ *
+ *  @return A new p4PMagicMaskImfileRow object or NULL on failure.
+ */
+
+p4PMagicMaskImfileRow *p4PMagicMaskImfileRowAlloc(
+    psS32           p4_id,
+    const char      *exp_tag,
+    psS32           p3_version,
+    const char      *class_id,
+    const char      *uri
+);
+
+/** Creates a new p4PMagicMaskImfile table
+ *
+ * @return true on success
+ */
+
+bool p4PMagicMaskImfileCreateTable(
+    psDB            *dbh                ///< Database handle
+);
+
+/** Deletes a p4PMagicMaskImfile table
+ *
+ * @return true on success
+ */
+
+bool p4PMagicMaskImfileDropTable(
+    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 p4PMagicMaskImfileInsert(
+    psDB            *dbh,               ///< Database handle
+    psS32           p4_id,
+    const char      *exp_tag,
+    psS32           p3_version,
+    const char      *class_id,
+    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 p4PMagicMaskImfileDelete(
+    psDB            *dbh,               ///< Database handle
+    const psMetadata *where,            ///< Row match criteria
+    unsigned long long limit            ///< Maximum number of elements to delete 
+);
+
+/** Insert a single p4PMagicMaskImfileRow object into a table
+ *
+ * This function constructs and inserts a single row based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool p4PMagicMaskImfileInsertObject(
+    psDB            *dbh,               ///< Database handle
+    p4PMagicMaskImfileRow *object             ///< p4PMagicMaskImfileRow object
+);
+
+/** Insert an array of p4PMagicMaskImfileRow object into a table
+ *
+ * This function constructs and inserts multiple rows based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool p4PMagicMaskImfileInsertObjects(
+    psDB            *dbh,               ///< Database handle
+    psArray         *objects            ///< array of p4PMagicMaskImfileRow objects
+);
+
+/** Insert data from a binary FITS table p4PMagicMaskImfileRow 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 p4PMagicMaskImfileInsertFits(
+    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 p4PMagicMaskImfileSelectRowsFits(
+    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 p4PMagicMaskImfileRow into an equivalent psMetadata
+ *
+ * @return A psMetadata pointer or NULL on error
+ */
+
+psMetadata *p4PMagicMaskImfileMetadataFromObject(
+    const p4PMagicMaskImfileRow *object             ///< fooRow to convert into a psMetadata
+);
+
+/** Convert a psMetadata into an equivalent fooRow
+ *
+ * @return A p4PMagicMaskImfileRow pointer or NULL on error
+ */
+
+p4PMagicMaskImfileRow *p4PMagicMaskImfileObjectFromMetadata(
+    psMetadata      *md                 ///< psMetadata to convert into a fooRow
+);
+/** Selects up to limit rows from the database and returns as p4PMagicMaskImfileRow objects in a psArray
+ *
+ *  See psDBSelectRows() for documentation on the format of where.
+ *
+ * @return A psArray pointer or NULL on error
+ */
+
+psArray *p4PMagicMaskImfileSelectRowObjects(
+    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 p4PMagicMaskImfile
+ *
+ *  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 p4PMagicMaskImfileDeleteObject(
+    psDB            *dbh,               ///< Database handle
+    const p4PMagicMaskImfileRow *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 p4PMagicMaskImfileDeleteRowObjects(
+    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 p4PMagicMaskImfileRow 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 p4PMagicMaskImfilePrintObjects(
+    FILE            *stream,            ///< a stream
+    psArray         *objects,           ///< An array of p4PMagicMaskImfileRow objects
+    bool            mdcf                ///< format as mdconfig or simple
+);
 
 /// @}
@@ -6604,3 +7792,3 @@
 #endif
 
-#endif // DETRUNSUMMARY_DB_H
+#endif // P4PMAGICMASKIMFILE_DB_H
