Index: trunk/ippdb/src/ippdb.h
===================================================================
--- trunk/ippdb/src/ippdb.h	(revision 11820)
+++ trunk/ippdb/src/ippdb.h	(revision 11867)
@@ -8510,4 +8510,418 @@
     bool            mdcf                ///< format as mdconfig or simple
 );
+/** p6InputScfileRow data structure
+ *
+ * Structure for representing a single row of p6InputScfile table data.
+ */
+
+typedef struct {
+    psS32           p6_id;
+    psS32           p4_id;
+    char            *skycell_id;
+    char            *tess_id;
+} p6InputScfileRow;
+
+/** Creates a new p6InputScfileRow object
+ *
+ *  @return A new p6InputScfileRow object or NULL on failure.
+ */
+
+p6InputScfileRow *p6InputScfileRowAlloc(
+    psS32           p6_id,
+    psS32           p4_id,
+    const char      *skycell_id,
+    const char      *tess_id
+);
+
+/** Creates a new p6InputScfile table
+ *
+ * @return true on success
+ */
+
+bool p6InputScfileCreateTable(
+    psDB            *dbh                ///< Database handle
+);
+
+/** Deletes a p6InputScfile table
+ *
+ * @return true on success
+ */
+
+bool p6InputScfileDropTable(
+    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 p6InputScfileInsert(
+    psDB            *dbh,               ///< Database handle
+    psS32           p6_id,
+    psS32           p4_id,
+    const char      *skycell_id,
+    const char      *tess_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 p6InputScfileDelete(
+    psDB            *dbh,               ///< Database handle
+    const psMetadata *where,            ///< Row match criteria
+    unsigned long long limit            ///< Maximum number of elements to delete 
+);
+
+/** Insert a single p6InputScfileRow object into a table
+ *
+ * This function constructs and inserts a single row based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool p6InputScfileInsertObject(
+    psDB            *dbh,               ///< Database handle
+    p6InputScfileRow *object             ///< p6InputScfileRow object
+);
+
+/** Insert an array of p6InputScfileRow object into a table
+ *
+ * This function constructs and inserts multiple rows based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool p6InputScfileInsertObjects(
+    psDB            *dbh,               ///< Database handle
+    psArray         *objects            ///< array of p6InputScfileRow objects
+);
+
+/** Insert data from a binary FITS table p6InputScfileRow 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 p6InputScfileInsertFits(
+    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 p6InputScfileSelectRowsFits(
+    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 p6InputScfileRow into an equivalent psMetadata
+ *
+ * @return A psMetadata pointer or NULL on error
+ */
+
+psMetadata *p6InputScfileMetadataFromObject(
+    const p6InputScfileRow *object             ///< fooRow to convert into a psMetadata
+);
+
+/** Convert a psMetadata into an equivalent fooRow
+ *
+ * @return A p6InputScfileRow pointer or NULL on error
+ */
+
+p6InputScfileRow *p6InputScfileObjectFromMetadata(
+    psMetadata      *md                 ///< psMetadata to convert into a fooRow
+);
+/** Selects up to limit rows from the database and returns as p6InputScfileRow objects in a psArray
+ *
+ *  See psDBSelectRows() for documentation on the format of where.
+ *
+ * @return A psArray pointer or NULL on error
+ */
+
+psArray *p6InputScfileSelectRowObjects(
+    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 p6InputScfile
+ *
+ *  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 p6InputScfileDeleteObject(
+    psDB            *dbh,               ///< Database handle
+    const p6InputScfileRow *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 p6InputScfileDeleteRowObjects(
+    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 p6InputScfileRow 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 p6InputScfilePrintObjects(
+    FILE            *stream,            ///< a stream
+    psArray         *objects,           ///< An array of p6InputScfileRow objects
+    bool            mdcf                ///< format as mdconfig or simple
+);
+/** Formats and prints an p6InputScfileRow 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 p6InputScfilePrintObject(
+    FILE            *stream,            ///< a stream
+    p6InputScfileRow *object,    ///< an p6InputScfileRow object
+    bool            mdcf                ///< format as mdconfig or simple
+);
+/** p6SumScfileRow data structure
+ *
+ * Structure for representing a single row of p6SumScfile table data.
+ */
+
+typedef struct {
+    psS32           p6_id;
+    char            *skycell_id;
+    char            *tess_id;
+    char            *uri;
+    psF64           bg;
+    psF64           bg_mean_stdev;
+} p6SumScfileRow;
+
+/** Creates a new p6SumScfileRow object
+ *
+ *  @return A new p6SumScfileRow object or NULL on failure.
+ */
+
+p6SumScfileRow *p6SumScfileRowAlloc(
+    psS32           p6_id,
+    const char      *skycell_id,
+    const char      *tess_id,
+    const char      *uri,
+    psF64           bg,
+    psF64           bg_mean_stdev
+);
+
+/** Creates a new p6SumScfile table
+ *
+ * @return true on success
+ */
+
+bool p6SumScfileCreateTable(
+    psDB            *dbh                ///< Database handle
+);
+
+/** Deletes a p6SumScfile table
+ *
+ * @return true on success
+ */
+
+bool p6SumScfileDropTable(
+    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 p6SumScfileInsert(
+    psDB            *dbh,               ///< Database handle
+    psS32           p6_id,
+    const char      *skycell_id,
+    const char      *tess_id,
+    const char      *uri,
+    psF64           bg,
+    psF64           bg_mean_stdev
+);
+
+/** 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 p6SumScfileDelete(
+    psDB            *dbh,               ///< Database handle
+    const psMetadata *where,            ///< Row match criteria
+    unsigned long long limit            ///< Maximum number of elements to delete 
+);
+
+/** Insert a single p6SumScfileRow object into a table
+ *
+ * This function constructs and inserts a single row based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool p6SumScfileInsertObject(
+    psDB            *dbh,               ///< Database handle
+    p6SumScfileRow  *object             ///< p6SumScfileRow object
+);
+
+/** Insert an array of p6SumScfileRow object into a table
+ *
+ * This function constructs and inserts multiple rows based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool p6SumScfileInsertObjects(
+    psDB            *dbh,               ///< Database handle
+    psArray         *objects            ///< array of p6SumScfileRow objects
+);
+
+/** Insert data from a binary FITS table p6SumScfileRow 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 p6SumScfileInsertFits(
+    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 p6SumScfileSelectRowsFits(
+    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 p6SumScfileRow into an equivalent psMetadata
+ *
+ * @return A psMetadata pointer or NULL on error
+ */
+
+psMetadata *p6SumScfileMetadataFromObject(
+    const p6SumScfileRow *object             ///< fooRow to convert into a psMetadata
+);
+
+/** Convert a psMetadata into an equivalent fooRow
+ *
+ * @return A p6SumScfileRow pointer or NULL on error
+ */
+
+p6SumScfileRow *p6SumScfileObjectFromMetadata(
+    psMetadata      *md                 ///< psMetadata to convert into a fooRow
+);
+/** Selects up to limit rows from the database and returns as p6SumScfileRow objects in a psArray
+ *
+ *  See psDBSelectRows() for documentation on the format of where.
+ *
+ * @return A psArray pointer or NULL on error
+ */
+
+psArray *p6SumScfileSelectRowObjects(
+    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 p6SumScfile
+ *
+ *  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 p6SumScfileDeleteObject(
+    psDB            *dbh,               ///< Database handle
+    const p6SumScfileRow *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 p6SumScfileDeleteRowObjects(
+    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 p6SumScfileRow 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 p6SumScfilePrintObjects(
+    FILE            *stream,            ///< a stream
+    psArray         *objects,           ///< An array of p6SumScfileRow objects
+    bool            mdcf                ///< format as mdconfig or simple
+);
+/** Formats and prints an p6SumScfileRow 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 p6SumScfilePrintObject(
+    FILE            *stream,            ///< a stream
+    p6SumScfileRow *object,    ///< an p6SumScfileRow object
+    bool            mdcf                ///< format as mdconfig or simple
+);
 
 /// @}
@@ -8517,3 +8931,3 @@
 #endif
 
-#endif // P6RUN_DB_H
+#endif // P6SUMSCFILE_DB_H
