Index: trunk/ippdb/src/ippdb.h
===================================================================
--- trunk/ippdb/src/ippdb.h	(revision 15569)
+++ trunk/ippdb/src/ippdb.h	(revision 15576)
@@ -11105,4 +11105,412 @@
     bool            mdcf                ///< format as mdconfig or simple
 );
+/** flatcorrRunRow data structure
+ *
+ * Structure for representing a single row of flatcorrRun table data.
+ */
+
+typedef struct {
+    psS64           corr_id;
+    char            *dvodb;
+    char            *state;
+    char            *workdir;
+    char            *label;
+} flatcorrRunRow;
+
+/** Creates a new flatcorrRunRow object
+ *
+ *  @return A new flatcorrRunRow object or NULL on failure.
+ */
+
+flatcorrRunRow *flatcorrRunRowAlloc(
+    psS64           corr_id,
+    const char      *dvodb,
+    const char      *state,
+    const char      *workdir,
+    const char      *label
+);
+
+/** Creates a new flatcorrRun table
+ *
+ * @return true on success
+ */
+
+bool flatcorrRunCreateTable(
+    psDB            *dbh                ///< Database handle
+);
+
+/** Deletes a flatcorrRun table
+ *
+ * @return true on success
+ */
+
+bool flatcorrRunDropTable(
+    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 flatcorrRunInsert(
+    psDB            *dbh,               ///< Database handle
+    psS64           corr_id,
+    const char      *dvodb,
+    const char      *state,
+    const char      *workdir,
+    const char      *label
+);
+
+/** Deletes up to limit rows from the database and returns the number of rows actually deleted. 
+ *
+ * @return A The number of rows removed or a negative value on error
+ */
+
+long long flatcorrRunDelete(
+    psDB            *dbh,               ///< Database handle
+    const psMetadata *where,            ///< Row match criteria
+    unsigned long long limit            ///< Maximum number of elements to delete 
+);
+
+/** Insert a single flatcorrRunRow object into a table
+ *
+ * This function constructs and inserts a single row based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool flatcorrRunInsertObject(
+    psDB            *dbh,               ///< Database handle
+    flatcorrRunRow  *object             ///< flatcorrRunRow object
+);
+
+/** Insert an array of flatcorrRunRow object into a table
+ *
+ * This function constructs and inserts multiple rows based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool flatcorrRunInsertObjects(
+    psDB            *dbh,               ///< Database handle
+    psArray         *objects            ///< array of flatcorrRunRow objects
+);
+
+/** Insert data from a binary FITS table flatcorrRunRow 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 flatcorrRunInsertFits(
+    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 flatcorrRunSelectRowsFits(
+    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 flatcorrRunRow into an equivalent psMetadata
+ *
+ * @return A psMetadata pointer or NULL on error
+ */
+
+psMetadata *flatcorrRunMetadataFromObject(
+    const flatcorrRunRow *object             ///< fooRow to convert into a psMetadata
+);
+
+/** Convert a psMetadata into an equivalent fooRow
+ *
+ * @return A flatcorrRunRow pointer or NULL on error
+ */
+
+flatcorrRunRow *flatcorrRunObjectFromMetadata(
+    psMetadata      *md                 ///< psMetadata to convert into a fooRow
+);
+/** Selects up to limit rows from the database and returns as flatcorrRunRow objects in a psArray
+ *
+ *  See psDBSelectRows() for documentation on the format of where.
+ *
+ * @return A psArray pointer or NULL on error
+ */
+
+psArray *flatcorrRunSelectRowObjects(
+    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 flatcorrRun
+ *
+ *  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 flatcorrRunDeleteObject(
+    psDB            *dbh,               ///< Database handle
+    const flatcorrRunRow *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 flatcorrRunDeleteRowObjects(
+    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 flatcorrRunRow 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 flatcorrRunPrintObjects(
+    FILE            *stream,            ///< a stream
+    psArray         *objects,           ///< An array of flatcorrRunRow objects
+    bool            mdcf                ///< format as mdconfig or simple
+);
+/** Formats and prints an flatcorrRunRow 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 flatcorrRunPrintObject(
+    FILE            *stream,            ///< a stream
+    flatcorrRunRow *object,    ///< an flatcorrRunRow object
+    bool            mdcf                ///< format as mdconfig or simple
+);
+/** flatcorrExpRow data structure
+ *
+ * Structure for representing a single row of flatcorrExp table data.
+ */
+
+typedef struct {
+    psS64           corr_id;
+    psS64           chip_id;
+    char            *state;
+} flatcorrExpRow;
+
+/** Creates a new flatcorrExpRow object
+ *
+ *  @return A new flatcorrExpRow object or NULL on failure.
+ */
+
+flatcorrExpRow *flatcorrExpRowAlloc(
+    psS64           corr_id,
+    psS64           chip_id,
+    const char      *state
+);
+
+/** Creates a new flatcorrExp table
+ *
+ * @return true on success
+ */
+
+bool flatcorrExpCreateTable(
+    psDB            *dbh                ///< Database handle
+);
+
+/** Deletes a flatcorrExp table
+ *
+ * @return true on success
+ */
+
+bool flatcorrExpDropTable(
+    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 flatcorrExpInsert(
+    psDB            *dbh,               ///< Database handle
+    psS64           corr_id,
+    psS64           chip_id,
+    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 flatcorrExpDelete(
+    psDB            *dbh,               ///< Database handle
+    const psMetadata *where,            ///< Row match criteria
+    unsigned long long limit            ///< Maximum number of elements to delete 
+);
+
+/** Insert a single flatcorrExpRow object into a table
+ *
+ * This function constructs and inserts a single row based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool flatcorrExpInsertObject(
+    psDB            *dbh,               ///< Database handle
+    flatcorrExpRow  *object             ///< flatcorrExpRow object
+);
+
+/** Insert an array of flatcorrExpRow object into a table
+ *
+ * This function constructs and inserts multiple rows based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool flatcorrExpInsertObjects(
+    psDB            *dbh,               ///< Database handle
+    psArray         *objects            ///< array of flatcorrExpRow objects
+);
+
+/** Insert data from a binary FITS table flatcorrExpRow 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 flatcorrExpInsertFits(
+    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 flatcorrExpSelectRowsFits(
+    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 flatcorrExpRow into an equivalent psMetadata
+ *
+ * @return A psMetadata pointer or NULL on error
+ */
+
+psMetadata *flatcorrExpMetadataFromObject(
+    const flatcorrExpRow *object             ///< fooRow to convert into a psMetadata
+);
+
+/** Convert a psMetadata into an equivalent fooRow
+ *
+ * @return A flatcorrExpRow pointer or NULL on error
+ */
+
+flatcorrExpRow *flatcorrExpObjectFromMetadata(
+    psMetadata      *md                 ///< psMetadata to convert into a fooRow
+);
+/** Selects up to limit rows from the database and returns as flatcorrExpRow objects in a psArray
+ *
+ *  See psDBSelectRows() for documentation on the format of where.
+ *
+ * @return A psArray pointer or NULL on error
+ */
+
+psArray *flatcorrExpSelectRowObjects(
+    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 flatcorrExp
+ *
+ *  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 flatcorrExpDeleteObject(
+    psDB            *dbh,               ///< Database handle
+    const flatcorrExpRow *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 flatcorrExpDeleteRowObjects(
+    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 flatcorrExpRow 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 flatcorrExpPrintObjects(
+    FILE            *stream,            ///< a stream
+    psArray         *objects,           ///< An array of flatcorrExpRow objects
+    bool            mdcf                ///< format as mdconfig or simple
+);
+/** Formats and prints an flatcorrExpRow 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 flatcorrExpPrintObject(
+    FILE            *stream,            ///< a stream
+    flatcorrExpRow *object,    ///< an flatcorrExpRow object
+    bool            mdcf                ///< format as mdconfig or simple
+);
 
 /// @}
@@ -11112,3 +11520,3 @@
 #endif
 
-#endif // CALRUN_DB_H
+#endif // FLATCORREXP_DB_H
