Index: trunk/ippdb/src/ippdb.h
===================================================================
--- trunk/ippdb/src/ippdb.h	(revision 11809)
+++ trunk/ippdb/src/ippdb.h	(revision 11820)
@@ -2018,4 +2018,5 @@
     psF64           posang;
     char            *object;
+    psF32           solang;
     psS16           fault;
 } rawExpRow;
@@ -2048,4 +2049,5 @@
     psF64           posang,
     const char      *object,
+    psF32           solang,
     psS16           fault
 );
@@ -2099,4 +2101,5 @@
     psF64           posang,
     const char      *object,
+    psF32           solang,
     psS16           fault
 );
@@ -4417,4 +4420,8 @@
     psTime*         use_begin;
     psTime*         use_end;
+    psF32           solang_min;
+    psF32           solang_max;
+    char            *label;
+    psS32           parent;
 } detRunRow;
 
@@ -4447,5 +4454,9 @@
     psTime*         time_end,
     psTime*         use_begin,
-    psTime*         use_end
+    psTime*         use_end,
+    psF32           solang_min,
+    psF32           solang_max,
+    const char      *label,
+    psS32           parent
 );
 
@@ -4499,5 +4510,9 @@
     psTime*         time_end,
     psTime*         use_begin,
-    psTime*         use_end
+    psTime*         use_end,
+    psF32           solang_min,
+    psF32           solang_max,
+    const char      *label,
+    psS32           parent
 );
 
@@ -7881,6 +7896,4 @@
     char            *skycell_id;
     char            *tess_id;
-    char            *exp_tag;
-    psS32           p3_version;
     char            *kind;
     bool            template;
@@ -7897,6 +7910,4 @@
     const char      *skycell_id,
     const char      *tess_id,
-    const char      *exp_tag,
-    psS32           p3_version,
     const char      *kind,
     bool            template
@@ -7934,6 +7945,4 @@
     const char      *skycell_id,
     const char      *tess_id,
-    const char      *exp_tag,
-    psS32           p3_version,
     const char      *kind,
     bool            template
@@ -8297,4 +8306,208 @@
     bool            mdcf                ///< format as mdconfig or simple
 );
+/** p6RunRow data structure
+ *
+ * Structure for representing a single row of p6Run table data.
+ */
+
+typedef struct {
+    psS32           p6_id;
+    char            *state;
+    char            *workdir;
+    psTime*         registered;
+} p6RunRow;
+
+/** Creates a new p6RunRow object
+ *
+ *  @return A new p6RunRow object or NULL on failure.
+ */
+
+p6RunRow *p6RunRowAlloc(
+    psS32           p6_id,
+    const char      *state,
+    const char      *workdir,
+    psTime*         registered
+);
+
+/** Creates a new p6Run table
+ *
+ * @return true on success
+ */
+
+bool p6RunCreateTable(
+    psDB            *dbh                ///< Database handle
+);
+
+/** Deletes a p6Run table
+ *
+ * @return true on success
+ */
+
+bool p6RunDropTable(
+    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 p6RunInsert(
+    psDB            *dbh,               ///< Database handle
+    psS32           p6_id,
+    const char      *state,
+    const char      *workdir,
+    psTime*         registered
+);
+
+/** 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 p6RunDelete(
+    psDB            *dbh,               ///< Database handle
+    const psMetadata *where,            ///< Row match criteria
+    unsigned long long limit            ///< Maximum number of elements to delete 
+);
+
+/** Insert a single p6RunRow object into a table
+ *
+ * This function constructs and inserts a single row based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool p6RunInsertObject(
+    psDB            *dbh,               ///< Database handle
+    p6RunRow        *object             ///< p6RunRow object
+);
+
+/** Insert an array of p6RunRow object into a table
+ *
+ * This function constructs and inserts multiple rows based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool p6RunInsertObjects(
+    psDB            *dbh,               ///< Database handle
+    psArray         *objects            ///< array of p6RunRow objects
+);
+
+/** Insert data from a binary FITS table p6RunRow 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 p6RunInsertFits(
+    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 p6RunSelectRowsFits(
+    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 p6RunRow into an equivalent psMetadata
+ *
+ * @return A psMetadata pointer or NULL on error
+ */
+
+psMetadata *p6RunMetadataFromObject(
+    const p6RunRow  *object             ///< fooRow to convert into a psMetadata
+);
+
+/** Convert a psMetadata into an equivalent fooRow
+ *
+ * @return A p6RunRow pointer or NULL on error
+ */
+
+p6RunRow *p6RunObjectFromMetadata(
+    psMetadata      *md                 ///< psMetadata to convert into a fooRow
+);
+/** Selects up to limit rows from the database and returns as p6RunRow objects in a psArray
+ *
+ *  See psDBSelectRows() for documentation on the format of where.
+ *
+ * @return A psArray pointer or NULL on error
+ */
+
+psArray *p6RunSelectRowObjects(
+    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 p6Run
+ *
+ *  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 p6RunDeleteObject(
+    psDB            *dbh,               ///< Database handle
+    const p6RunRow *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 p6RunDeleteRowObjects(
+    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 p6RunRow 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 p6RunPrintObjects(
+    FILE            *stream,            ///< a stream
+    psArray         *objects,           ///< An array of p6RunRow objects
+    bool            mdcf                ///< format as mdconfig or simple
+);
+/** Formats and prints an p6RunRow 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 p6RunPrintObject(
+    FILE            *stream,            ///< a stream
+    p6RunRow *object,    ///< an p6RunRow object
+    bool            mdcf                ///< format as mdconfig or simple
+);
 
 /// @}
@@ -8304,3 +8517,3 @@
 #endif
 
-#endif // P5DIFFSCFILE_DB_H
+#endif // P6RUN_DB_H
