IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 17, 2006, 2:19:43 PM (20 years ago)
Author:
jhoblitt
Message:

VERSION 0.0.56

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippdb/src/ippdb.h

    r9970 r10060  
    134134    char            *camera;
    135135    char            *telescope;
    136     psTime*         time;
     136    psTime*         dateobs;
    137137    char            *exp_type;
    138138    char            *uri;
     139    psS32           imfiles;
    139140} summitExpRow;
    140141
     
    148149    const char      *camera,
    149150    const char      *telescope,
    150     psTime*         time,
     151    psTime*         dateobs,
    151152    const char      *exp_type,
    152     const char      *uri
     153    const char      *uri,
     154    psS32           imfiles
    153155);
    154156
     
    183185    const char      *camera,
    184186    const char      *telescope,
    185     psTime*         time,
     187    psTime*         dateobs,
    186188    const char      *exp_type,
    187     const char      *uri
     189    const char      *uri,
     190    psS32           imfiles
    188191);
    189192
     
    322325    bool            mdcf                ///< format as mdconfig or simple
    323326);
    324 /** pzPendingExpRow data structure
    325  *
    326  * Structure for representing a single row of pzPendingExp table data.
    327  */
    328 
    329 typedef struct {
    330     char            *exp_id;
    331     char            *camera;
    332     char            *telescope;
    333     char            *exp_type;
    334     psS32           imfiles;
    335 } pzPendingExpRow;
    336 
    337 /** Creates a new pzPendingExpRow object
    338  *
    339  *  @return A new pzPendingExpRow object or NULL on failure.
    340  */
    341 
    342 pzPendingExpRow *pzPendingExpRowAlloc(
    343     const char      *exp_id,
    344     const char      *camera,
    345     const char      *telescope,
    346     const char      *exp_type,
    347     psS32           imfiles
    348 );
    349 
    350 /** Creates a new pzPendingExp table
    351  *
    352  * @return true on success
    353  */
    354 
    355 bool pzPendingExpCreateTable(
    356     psDB            *dbh                ///< Database handle
    357 );
    358 
    359 /** Deletes a pzPendingExp table
    360  *
    361  * @return true on success
    362  */
    363 
    364 bool pzPendingExpDropTable(
    365     psDB            *dbh                ///< Database handle
    366 );
    367 
    368 /** Insert a single row into a table
    369  *
    370  * This function constructs and inserts a single row based on it's parameters.
    371  *
    372  * @return true on success
    373  */
    374 
    375 bool pzPendingExpInsert(
    376     psDB            *dbh,               ///< Database handle
    377     const char      *exp_id,
    378     const char      *camera,
    379     const char      *telescope,
    380     const char      *exp_type,
    381     psS32           imfiles
    382 );
    383 
    384 /** Deletes up to limit rows from the database and returns the number of rows actually deleted.
    385  *
    386  * @return A The number of rows removed or a negative value on error
    387  */
    388 
    389 long long pzPendingExpDelete(
    390     psDB            *dbh,               ///< Database handle
    391     const psMetadata *where,            ///< Row match criteria
    392     unsigned long long limit            ///< Maximum number of elements to delete
    393 );
    394 
    395 /** Insert a single pzPendingExpRow object into a table
    396  *
    397  * This function constructs and inserts a single row based on it's parameters.
    398  *
    399  * @return true on success
    400  */
    401 
    402 bool pzPendingExpInsertObject(
    403     psDB            *dbh,               ///< Database handle
    404     pzPendingExpRow *object             ///< pzPendingExpRow object
    405 );
    406 
    407 /** Insert an array of pzPendingExpRow object into a table
    408  *
    409  * This function constructs and inserts multiple rows based on it's parameters.
    410  *
    411  * @return true on success
    412  */
    413 
    414 bool pzPendingExpInsertObjects(
    415     psDB            *dbh,               ///< Database handle
    416     psArray         *objects            ///< array of pzPendingExpRow objects
    417 );
    418 
    419 /** Insert data from a binary FITS table pzPendingExpRow into the database
    420  *
    421  * This function expects a psFits object with a FITS table as the first
    422  * extension.  The table must have at least one row of data in it, that is of
    423  * the appropriate format (number of columns and their type).  All other
    424  * extensions are ignored.
    425  *
    426  * @return true on success
    427  */
    428 
    429 bool pzPendingExpInsertFits(
    430     psDB            *dbh,               ///< Database handle
    431     const psFits    *fits               ///< psFits object
    432 );
    433 
    434 /** Selects up to limit from the database and returns them in a binary FITS table
    435  *
    436  * This function assumes an empty psFits object and will create a FITS table
    437  * as the first extension.
    438  *
    439  *  See psDBSelectRows() for documentation on the format of where.
    440  *
    441  * @return true on success
    442  */
    443 
    444 bool pzPendingExpSelectRowsFits(
    445     psDB            *dbh,               ///< Database handle
    446     psFits          *fits,              ///< psFits object
    447     const psMetadata *where,            ///< Row match criteria
    448     unsigned long long limit            ///< Maximum number of elements to return
    449 );
    450 
    451 /** Convert a pzPendingExpRow into an equivalent psMetadata
    452  *
    453  * @return A psMetadata pointer or NULL on error
    454  */
    455 
    456 psMetadata *pzPendingExpMetadataFromObject(
    457     const pzPendingExpRow *object             ///< fooRow to convert into a psMetadata
    458 );
    459 
    460 /** Convert a psMetadata into an equivalent fooRow
    461  *
    462  * @return A pzPendingExpRow pointer or NULL on error
    463  */
    464 
    465 pzPendingExpRow *pzPendingExpObjectFromMetadata(
    466     psMetadata      *md                 ///< psMetadata to convert into a fooRow
    467 );
    468 /** Selects up to limit rows from the database and returns as pzPendingExpRow objects in a psArray
    469  *
    470  *  See psDBSelectRows() for documentation on the format of where.
    471  *
    472  * @return A psArray pointer or NULL on error
    473  */
    474 
    475 psArray *pzPendingExpSelectRowObjects(
    476     psDB            *dbh,               ///< Database handle
    477     const psMetadata *where,            ///< Row match criteria
    478     unsigned long long limit            ///< Maximum number of elements to return
    479 );
    480 /** Deletes a row from the database coresponding to an pzPendingExp
    481  *
    482  *  Note that a 'where' search psMetadata is constructed from each object and
    483  *  used to find rows to delete.
    484  *
    485  * @return A The number of rows removed or a negative value on error
    486  */
    487 
    488 bool pzPendingExpDeleteObject(
    489     psDB            *dbh,               ///< Database handle
    490     const pzPendingExpRow *object    ///< Object to delete
    491 );
    492 /** Deletes up to limit rows from the database and returns the number of rows actually deleted.
    493  *
    494  *  Note that a 'where' search psMetadata is constructed from each object and
    495  *  used to find rows to delete.
    496  *
    497  * @return A The number of rows removed or a negative value on error
    498  */
    499 
    500 long long pzPendingExpDeleteRowObjects(
    501     psDB            *dbh,               ///< Database handle
    502     const psArray   *objects,           ///< Array of objects to delete
    503     unsigned long long limit            ///< Maximum number of elements to delete
    504 );
    505 /** Formats and prints an array of pzPendingExpRow objects
    506  *
    507  * When mdcf is set the formated output is in psMetadataConfig
    508  * format, otherwise it is in a simple tabular format.
    509  *
    510  * @return true on success
    511  */
    512 
    513 bool pzPendingExpPrintObjects(
    514     FILE            *stream,            ///< a stream
    515     psArray         *objects,           ///< An array of pzPendingExpRow objects
    516     bool            mdcf                ///< format as mdconfig or simple
    517 );
    518 /** pzPendingImfileRow data structure
    519  *
    520  * Structure for representing a single row of pzPendingImfile table data.
     327/** summitImfileRow data structure
     328 *
     329 * Structure for representing a single row of summitImfile table data.
    521330 */
    522331
     
    530339    char            *class_id;
    531340    char            *uri;
    532 } pzPendingImfileRow;
    533 
    534 /** Creates a new pzPendingImfileRow object
    535  *
    536  *  @return A new pzPendingImfileRow object or NULL on failure.
    537  */
    538 
    539 pzPendingImfileRow *pzPendingImfileRowAlloc(
     341} summitImfileRow;
     342
     343/** Creates a new summitImfileRow object
     344 *
     345 *  @return A new summitImfileRow object or NULL on failure.
     346 */
     347
     348summitImfileRow *summitImfileRowAlloc(
    540349    const char      *exp_id,
    541350    const char      *camera,
     
    548357);
    549358
    550 /** Creates a new pzPendingImfile table
    551  *
    552  * @return true on success
    553  */
    554 
    555 bool pzPendingImfileCreateTable(
     359/** Creates a new summitImfile table
     360 *
     361 * @return true on success
     362 */
     363
     364bool summitImfileCreateTable(
    556365    psDB            *dbh                ///< Database handle
    557366);
    558367
    559 /** Deletes a pzPendingImfile table
    560  *
    561  * @return true on success
    562  */
    563 
    564 bool pzPendingImfileDropTable(
     368/** Deletes a summitImfile table
     369 *
     370 * @return true on success
     371 */
     372
     373bool summitImfileDropTable(
    565374    psDB            *dbh                ///< Database handle
    566375);
     
    573382 */
    574383
    575 bool pzPendingImfileInsert(
     384bool summitImfileInsert(
    576385    psDB            *dbh,               ///< Database handle
    577386    const char      *exp_id,
     
    590399 */
    591400
    592 long long pzPendingImfileDelete(
     401long long summitImfileDelete(
    593402    psDB            *dbh,               ///< Database handle
    594403    const psMetadata *where,            ///< Row match criteria
     
    596405);
    597406
    598 /** Insert a single pzPendingImfileRow object into a table
     407/** Insert a single summitImfileRow object into a table
    599408 *
    600409 * This function constructs and inserts a single row based on it's parameters.
     
    603412 */
    604413
    605 bool pzPendingImfileInsertObject(
    606     psDB            *dbh,               ///< Database handle
    607     pzPendingImfileRow *object             ///< pzPendingImfileRow object
    608 );
    609 
    610 /** Insert an array of pzPendingImfileRow object into a table
     414bool summitImfileInsertObject(
     415    psDB            *dbh,               ///< Database handle
     416    summitImfileRow *object             ///< summitImfileRow object
     417);
     418
     419/** Insert an array of summitImfileRow object into a table
    611420 *
    612421 * This function constructs and inserts multiple rows based on it's parameters.
     
    615424 */
    616425
    617 bool pzPendingImfileInsertObjects(
    618     psDB            *dbh,               ///< Database handle
    619     psArray         *objects            ///< array of pzPendingImfileRow objects
    620 );
    621 
    622 /** Insert data from a binary FITS table pzPendingImfileRow into the database
     426bool summitImfileInsertObjects(
     427    psDB            *dbh,               ///< Database handle
     428    psArray         *objects            ///< array of summitImfileRow objects
     429);
     430
     431/** Insert data from a binary FITS table summitImfileRow into the database
    623432 *
    624433 * This function expects a psFits object with a FITS table as the first
     
    630439 */
    631440
     441bool summitImfileInsertFits(
     442    psDB            *dbh,               ///< Database handle
     443    const psFits    *fits               ///< psFits object
     444);
     445
     446/** Selects up to limit from the database and returns them in a binary FITS table
     447 *
     448 * This function assumes an empty psFits object and will create a FITS table
     449 * as the first extension.
     450 *
     451 *  See psDBSelectRows() for documentation on the format of where.
     452 *
     453 * @return true on success
     454 */
     455
     456bool summitImfileSelectRowsFits(
     457    psDB            *dbh,               ///< Database handle
     458    psFits          *fits,              ///< psFits object
     459    const psMetadata *where,            ///< Row match criteria
     460    unsigned long long limit            ///< Maximum number of elements to return
     461);
     462
     463/** Convert a summitImfileRow into an equivalent psMetadata
     464 *
     465 * @return A psMetadata pointer or NULL on error
     466 */
     467
     468psMetadata *summitImfileMetadataFromObject(
     469    const summitImfileRow *object             ///< fooRow to convert into a psMetadata
     470);
     471
     472/** Convert a psMetadata into an equivalent fooRow
     473 *
     474 * @return A summitImfileRow pointer or NULL on error
     475 */
     476
     477summitImfileRow *summitImfileObjectFromMetadata(
     478    psMetadata      *md                 ///< psMetadata to convert into a fooRow
     479);
     480/** Selects up to limit rows from the database and returns as summitImfileRow objects in a psArray
     481 *
     482 *  See psDBSelectRows() for documentation on the format of where.
     483 *
     484 * @return A psArray pointer or NULL on error
     485 */
     486
     487psArray *summitImfileSelectRowObjects(
     488    psDB            *dbh,               ///< Database handle
     489    const psMetadata *where,            ///< Row match criteria
     490    unsigned long long limit            ///< Maximum number of elements to return
     491);
     492/** Deletes a row from the database coresponding to an summitImfile
     493 *
     494 *  Note that a 'where' search psMetadata is constructed from each object and
     495 *  used to find rows to delete.
     496 *
     497 * @return A The number of rows removed or a negative value on error
     498 */
     499
     500bool summitImfileDeleteObject(
     501    psDB            *dbh,               ///< Database handle
     502    const summitImfileRow *object    ///< Object to delete
     503);
     504/** Deletes up to limit rows from the database and returns the number of rows actually deleted.
     505 *
     506 *  Note that a 'where' search psMetadata is constructed from each object and
     507 *  used to find rows to delete.
     508 *
     509 * @return A The number of rows removed or a negative value on error
     510 */
     511
     512long long summitImfileDeleteRowObjects(
     513    psDB            *dbh,               ///< Database handle
     514    const psArray   *objects,           ///< Array of objects to delete
     515    unsigned long long limit            ///< Maximum number of elements to delete
     516);
     517/** Formats and prints an array of summitImfileRow objects
     518 *
     519 * When mdcf is set the formated output is in psMetadataConfig
     520 * format, otherwise it is in a simple tabular format.
     521 *
     522 * @return true on success
     523 */
     524
     525bool summitImfilePrintObjects(
     526    FILE            *stream,            ///< a stream
     527    psArray         *objects,           ///< An array of summitImfileRow objects
     528    bool            mdcf                ///< format as mdconfig or simple
     529);
     530/** pzPendingExpRow data structure
     531 *
     532 * Structure for representing a single row of pzPendingExp table data.
     533 */
     534
     535typedef struct {
     536    char            *exp_id;
     537    char            *camera;
     538    char            *telescope;
     539} pzPendingExpRow;
     540
     541/** Creates a new pzPendingExpRow object
     542 *
     543 *  @return A new pzPendingExpRow object or NULL on failure.
     544 */
     545
     546pzPendingExpRow *pzPendingExpRowAlloc(
     547    const char      *exp_id,
     548    const char      *camera,
     549    const char      *telescope
     550);
     551
     552/** Creates a new pzPendingExp table
     553 *
     554 * @return true on success
     555 */
     556
     557bool pzPendingExpCreateTable(
     558    psDB            *dbh                ///< Database handle
     559);
     560
     561/** Deletes a pzPendingExp table
     562 *
     563 * @return true on success
     564 */
     565
     566bool pzPendingExpDropTable(
     567    psDB            *dbh                ///< Database handle
     568);
     569
     570/** Insert a single row into a table
     571 *
     572 * This function constructs and inserts a single row based on it's parameters.
     573 *
     574 * @return true on success
     575 */
     576
     577bool pzPendingExpInsert(
     578    psDB            *dbh,               ///< Database handle
     579    const char      *exp_id,
     580    const char      *camera,
     581    const char      *telescope
     582);
     583
     584/** Deletes up to limit rows from the database and returns the number of rows actually deleted.
     585 *
     586 * @return A The number of rows removed or a negative value on error
     587 */
     588
     589long long pzPendingExpDelete(
     590    psDB            *dbh,               ///< Database handle
     591    const psMetadata *where,            ///< Row match criteria
     592    unsigned long long limit            ///< Maximum number of elements to delete
     593);
     594
     595/** Insert a single pzPendingExpRow object into a table
     596 *
     597 * This function constructs and inserts a single row based on it's parameters.
     598 *
     599 * @return true on success
     600 */
     601
     602bool pzPendingExpInsertObject(
     603    psDB            *dbh,               ///< Database handle
     604    pzPendingExpRow *object             ///< pzPendingExpRow object
     605);
     606
     607/** Insert an array of pzPendingExpRow object into a table
     608 *
     609 * This function constructs and inserts multiple rows based on it's parameters.
     610 *
     611 * @return true on success
     612 */
     613
     614bool pzPendingExpInsertObjects(
     615    psDB            *dbh,               ///< Database handle
     616    psArray         *objects            ///< array of pzPendingExpRow objects
     617);
     618
     619/** Insert data from a binary FITS table pzPendingExpRow into the database
     620 *
     621 * This function expects a psFits object with a FITS table as the first
     622 * extension.  The table must have at least one row of data in it, that is of
     623 * the appropriate format (number of columns and their type).  All other
     624 * extensions are ignored.
     625 *
     626 * @return true on success
     627 */
     628
     629bool pzPendingExpInsertFits(
     630    psDB            *dbh,               ///< Database handle
     631    const psFits    *fits               ///< psFits object
     632);
     633
     634/** Selects up to limit from the database and returns them in a binary FITS table
     635 *
     636 * This function assumes an empty psFits object and will create a FITS table
     637 * as the first extension.
     638 *
     639 *  See psDBSelectRows() for documentation on the format of where.
     640 *
     641 * @return true on success
     642 */
     643
     644bool pzPendingExpSelectRowsFits(
     645    psDB            *dbh,               ///< Database handle
     646    psFits          *fits,              ///< psFits object
     647    const psMetadata *where,            ///< Row match criteria
     648    unsigned long long limit            ///< Maximum number of elements to return
     649);
     650
     651/** Convert a pzPendingExpRow into an equivalent psMetadata
     652 *
     653 * @return A psMetadata pointer or NULL on error
     654 */
     655
     656psMetadata *pzPendingExpMetadataFromObject(
     657    const pzPendingExpRow *object             ///< fooRow to convert into a psMetadata
     658);
     659
     660/** Convert a psMetadata into an equivalent fooRow
     661 *
     662 * @return A pzPendingExpRow pointer or NULL on error
     663 */
     664
     665pzPendingExpRow *pzPendingExpObjectFromMetadata(
     666    psMetadata      *md                 ///< psMetadata to convert into a fooRow
     667);
     668/** Selects up to limit rows from the database and returns as pzPendingExpRow objects in a psArray
     669 *
     670 *  See psDBSelectRows() for documentation on the format of where.
     671 *
     672 * @return A psArray pointer or NULL on error
     673 */
     674
     675psArray *pzPendingExpSelectRowObjects(
     676    psDB            *dbh,               ///< Database handle
     677    const psMetadata *where,            ///< Row match criteria
     678    unsigned long long limit            ///< Maximum number of elements to return
     679);
     680/** Deletes a row from the database coresponding to an pzPendingExp
     681 *
     682 *  Note that a 'where' search psMetadata is constructed from each object and
     683 *  used to find rows to delete.
     684 *
     685 * @return A The number of rows removed or a negative value on error
     686 */
     687
     688bool pzPendingExpDeleteObject(
     689    psDB            *dbh,               ///< Database handle
     690    const pzPendingExpRow *object    ///< Object to delete
     691);
     692/** Deletes up to limit rows from the database and returns the number of rows actually deleted.
     693 *
     694 *  Note that a 'where' search psMetadata is constructed from each object and
     695 *  used to find rows to delete.
     696 *
     697 * @return A The number of rows removed or a negative value on error
     698 */
     699
     700long long pzPendingExpDeleteRowObjects(
     701    psDB            *dbh,               ///< Database handle
     702    const psArray   *objects,           ///< Array of objects to delete
     703    unsigned long long limit            ///< Maximum number of elements to delete
     704);
     705/** Formats and prints an array of pzPendingExpRow objects
     706 *
     707 * When mdcf is set the formated output is in psMetadataConfig
     708 * format, otherwise it is in a simple tabular format.
     709 *
     710 * @return true on success
     711 */
     712
     713bool pzPendingExpPrintObjects(
     714    FILE            *stream,            ///< a stream
     715    psArray         *objects,           ///< An array of pzPendingExpRow objects
     716    bool            mdcf                ///< format as mdconfig or simple
     717);
     718/** pzPendingImfileRow data structure
     719 *
     720 * Structure for representing a single row of pzPendingImfile table data.
     721 */
     722
     723typedef struct {
     724    char            *exp_id;
     725    char            *camera;
     726    char            *telescope;
     727    char            *class;
     728    char            *class_id;
     729    char            *exp_tag;
     730} pzPendingImfileRow;
     731
     732/** Creates a new pzPendingImfileRow object
     733 *
     734 *  @return A new pzPendingImfileRow object or NULL on failure.
     735 */
     736
     737pzPendingImfileRow *pzPendingImfileRowAlloc(
     738    const char      *exp_id,
     739    const char      *camera,
     740    const char      *telescope,
     741    const char      *class,
     742    const char      *class_id,
     743    const char      *exp_tag
     744);
     745
     746/** Creates a new pzPendingImfile table
     747 *
     748 * @return true on success
     749 */
     750
     751bool pzPendingImfileCreateTable(
     752    psDB            *dbh                ///< Database handle
     753);
     754
     755/** Deletes a pzPendingImfile table
     756 *
     757 * @return true on success
     758 */
     759
     760bool pzPendingImfileDropTable(
     761    psDB            *dbh                ///< Database handle
     762);
     763
     764/** Insert a single row into a table
     765 *
     766 * This function constructs and inserts a single row based on it's parameters.
     767 *
     768 * @return true on success
     769 */
     770
     771bool pzPendingImfileInsert(
     772    psDB            *dbh,               ///< Database handle
     773    const char      *exp_id,
     774    const char      *camera,
     775    const char      *telescope,
     776    const char      *class,
     777    const char      *class_id,
     778    const char      *exp_tag
     779);
     780
     781/** Deletes up to limit rows from the database and returns the number of rows actually deleted.
     782 *
     783 * @return A The number of rows removed or a negative value on error
     784 */
     785
     786long long pzPendingImfileDelete(
     787    psDB            *dbh,               ///< Database handle
     788    const psMetadata *where,            ///< Row match criteria
     789    unsigned long long limit            ///< Maximum number of elements to delete
     790);
     791
     792/** Insert a single pzPendingImfileRow object into a table
     793 *
     794 * This function constructs and inserts a single row based on it's parameters.
     795 *
     796 * @return true on success
     797 */
     798
     799bool pzPendingImfileInsertObject(
     800    psDB            *dbh,               ///< Database handle
     801    pzPendingImfileRow *object             ///< pzPendingImfileRow object
     802);
     803
     804/** Insert an array of pzPendingImfileRow object into a table
     805 *
     806 * This function constructs and inserts multiple rows based on it's parameters.
     807 *
     808 * @return true on success
     809 */
     810
     811bool pzPendingImfileInsertObjects(
     812    psDB            *dbh,               ///< Database handle
     813    psArray         *objects            ///< array of pzPendingImfileRow objects
     814);
     815
     816/** Insert data from a binary FITS table pzPendingImfileRow into the database
     817 *
     818 * This function expects a psFits object with a FITS table as the first
     819 * extension.  The table must have at least one row of data in it, that is of
     820 * the appropriate format (number of columns and their type).  All other
     821 * extensions are ignored.
     822 *
     823 * @return true on success
     824 */
     825
    632826bool pzPendingImfileInsertFits(
    633827    psDB            *dbh,               ///< Database handle
     
    719913    bool            mdcf                ///< format as mdconfig or simple
    720914);
    721 /** newExpRow data structure
    722  *
    723  * Structure for representing a single row of newExp table data.
     915/** pzDoneExpRow data structure
     916 *
     917 * Structure for representing a single row of pzDoneExp table data.
    724918 */
    725919
    726920typedef struct {
    727     char            *exp_tag;
    728921    char            *exp_id;
    729922    char            *camera;
    730923    char            *telescope;
     924} pzDoneExpRow;
     925
     926/** Creates a new pzDoneExpRow object
     927 *
     928 *  @return A new pzDoneExpRow object or NULL on failure.
     929 */
     930
     931pzDoneExpRow *pzDoneExpRowAlloc(
     932    const char      *exp_id,
     933    const char      *camera,
     934    const char      *telescope
     935);
     936
     937/** Creates a new pzDoneExp table
     938 *
     939 * @return true on success
     940 */
     941
     942bool pzDoneExpCreateTable(
     943    psDB            *dbh                ///< Database handle
     944);
     945
     946/** Deletes a pzDoneExp table
     947 *
     948 * @return true on success
     949 */
     950
     951bool pzDoneExpDropTable(
     952    psDB            *dbh                ///< Database handle
     953);
     954
     955/** Insert a single row into a table
     956 *
     957 * This function constructs and inserts a single row based on it's parameters.
     958 *
     959 * @return true on success
     960 */
     961
     962bool pzDoneExpInsert(
     963    psDB            *dbh,               ///< Database handle
     964    const char      *exp_id,
     965    const char      *camera,
     966    const char      *telescope
     967);
     968
     969/** Deletes up to limit rows from the database and returns the number of rows actually deleted.
     970 *
     971 * @return A The number of rows removed or a negative value on error
     972 */
     973
     974long long pzDoneExpDelete(
     975    psDB            *dbh,               ///< Database handle
     976    const psMetadata *where,            ///< Row match criteria
     977    unsigned long long limit            ///< Maximum number of elements to delete
     978);
     979
     980/** Insert a single pzDoneExpRow object into a table
     981 *
     982 * This function constructs and inserts a single row based on it's parameters.
     983 *
     984 * @return true on success
     985 */
     986
     987bool pzDoneExpInsertObject(
     988    psDB            *dbh,               ///< Database handle
     989    pzDoneExpRow    *object             ///< pzDoneExpRow object
     990);
     991
     992/** Insert an array of pzDoneExpRow object into a table
     993 *
     994 * This function constructs and inserts multiple rows based on it's parameters.
     995 *
     996 * @return true on success
     997 */
     998
     999bool pzDoneExpInsertObjects(
     1000    psDB            *dbh,               ///< Database handle
     1001    psArray         *objects            ///< array of pzDoneExpRow objects
     1002);
     1003
     1004/** Insert data from a binary FITS table pzDoneExpRow into the database
     1005 *
     1006 * This function expects a psFits object with a FITS table as the first
     1007 * extension.  The table must have at least one row of data in it, that is of
     1008 * the appropriate format (number of columns and their type).  All other
     1009 * extensions are ignored.
     1010 *
     1011 * @return true on success
     1012 */
     1013
     1014bool pzDoneExpInsertFits(
     1015    psDB            *dbh,               ///< Database handle
     1016    const psFits    *fits               ///< psFits object
     1017);
     1018
     1019/** Selects up to limit from the database and returns them in a binary FITS table
     1020 *
     1021 * This function assumes an empty psFits object and will create a FITS table
     1022 * as the first extension.
     1023 *
     1024 *  See psDBSelectRows() for documentation on the format of where.
     1025 *
     1026 * @return true on success
     1027 */
     1028
     1029bool pzDoneExpSelectRowsFits(
     1030    psDB            *dbh,               ///< Database handle
     1031    psFits          *fits,              ///< psFits object
     1032    const psMetadata *where,            ///< Row match criteria
     1033    unsigned long long limit            ///< Maximum number of elements to return
     1034);
     1035
     1036/** Convert a pzDoneExpRow into an equivalent psMetadata
     1037 *
     1038 * @return A psMetadata pointer or NULL on error
     1039 */
     1040
     1041psMetadata *pzDoneExpMetadataFromObject(
     1042    const pzDoneExpRow *object             ///< fooRow to convert into a psMetadata
     1043);
     1044
     1045/** Convert a psMetadata into an equivalent fooRow
     1046 *
     1047 * @return A pzDoneExpRow pointer or NULL on error
     1048 */
     1049
     1050pzDoneExpRow *pzDoneExpObjectFromMetadata(
     1051    psMetadata      *md                 ///< psMetadata to convert into a fooRow
     1052);
     1053/** Selects up to limit rows from the database and returns as pzDoneExpRow objects in a psArray
     1054 *
     1055 *  See psDBSelectRows() for documentation on the format of where.
     1056 *
     1057 * @return A psArray pointer or NULL on error
     1058 */
     1059
     1060psArray *pzDoneExpSelectRowObjects(
     1061    psDB            *dbh,               ///< Database handle
     1062    const psMetadata *where,            ///< Row match criteria
     1063    unsigned long long limit            ///< Maximum number of elements to return
     1064);
     1065/** Deletes a row from the database coresponding to an pzDoneExp
     1066 *
     1067 *  Note that a 'where' search psMetadata is constructed from each object and
     1068 *  used to find rows to delete.
     1069 *
     1070 * @return A The number of rows removed or a negative value on error
     1071 */
     1072
     1073bool pzDoneExpDeleteObject(
     1074    psDB            *dbh,               ///< Database handle
     1075    const pzDoneExpRow *object    ///< Object to delete
     1076);
     1077/** Deletes up to limit rows from the database and returns the number of rows actually deleted.
     1078 *
     1079 *  Note that a 'where' search psMetadata is constructed from each object and
     1080 *  used to find rows to delete.
     1081 *
     1082 * @return A The number of rows removed or a negative value on error
     1083 */
     1084
     1085long long pzDoneExpDeleteRowObjects(
     1086    psDB            *dbh,               ///< Database handle
     1087    const psArray   *objects,           ///< Array of objects to delete
     1088    unsigned long long limit            ///< Maximum number of elements to delete
     1089);
     1090/** Formats and prints an array of pzDoneExpRow objects
     1091 *
     1092 * When mdcf is set the formated output is in psMetadataConfig
     1093 * format, otherwise it is in a simple tabular format.
     1094 *
     1095 * @return true on success
     1096 */
     1097
     1098bool pzDoneExpPrintObjects(
     1099    FILE            *stream,            ///< a stream
     1100    psArray         *objects,           ///< An array of pzDoneExpRow objects
     1101    bool            mdcf                ///< format as mdconfig or simple
     1102);
     1103/** pzDoneImfileRow data structure
     1104 *
     1105 * Structure for representing a single row of pzDoneImfile table data.
     1106 */
     1107
     1108typedef struct {
     1109    char            *exp_id;
     1110    char            *camera;
     1111    char            *telescope;
     1112    char            *class;
     1113    char            *class_id;
     1114    char            *exp_tag;
     1115    char            *uri;
     1116} pzDoneImfileRow;
     1117
     1118/** Creates a new pzDoneImfileRow object
     1119 *
     1120 *  @return A new pzDoneImfileRow object or NULL on failure.
     1121 */
     1122
     1123pzDoneImfileRow *pzDoneImfileRowAlloc(
     1124    const char      *exp_id,
     1125    const char      *camera,
     1126    const char      *telescope,
     1127    const char      *class,
     1128    const char      *class_id,
     1129    const char      *exp_tag,
     1130    const char      *uri
     1131);
     1132
     1133/** Creates a new pzDoneImfile table
     1134 *
     1135 * @return true on success
     1136 */
     1137
     1138bool pzDoneImfileCreateTable(
     1139    psDB            *dbh                ///< Database handle
     1140);
     1141
     1142/** Deletes a pzDoneImfile table
     1143 *
     1144 * @return true on success
     1145 */
     1146
     1147bool pzDoneImfileDropTable(
     1148    psDB            *dbh                ///< Database handle
     1149);
     1150
     1151/** Insert a single row into a table
     1152 *
     1153 * This function constructs and inserts a single row based on it's parameters.
     1154 *
     1155 * @return true on success
     1156 */
     1157
     1158bool pzDoneImfileInsert(
     1159    psDB            *dbh,               ///< Database handle
     1160    const char      *exp_id,
     1161    const char      *camera,
     1162    const char      *telescope,
     1163    const char      *class,
     1164    const char      *class_id,
     1165    const char      *exp_tag,
     1166    const char      *uri
     1167);
     1168
     1169/** Deletes up to limit rows from the database and returns the number of rows actually deleted.
     1170 *
     1171 * @return A The number of rows removed or a negative value on error
     1172 */
     1173
     1174long long pzDoneImfileDelete(
     1175    psDB            *dbh,               ///< Database handle
     1176    const psMetadata *where,            ///< Row match criteria
     1177    unsigned long long limit            ///< Maximum number of elements to delete
     1178);
     1179
     1180/** Insert a single pzDoneImfileRow object into a table
     1181 *
     1182 * This function constructs and inserts a single row based on it's parameters.
     1183 *
     1184 * @return true on success
     1185 */
     1186
     1187bool pzDoneImfileInsertObject(
     1188    psDB            *dbh,               ///< Database handle
     1189    pzDoneImfileRow *object             ///< pzDoneImfileRow object
     1190);
     1191
     1192/** Insert an array of pzDoneImfileRow object into a table
     1193 *
     1194 * This function constructs and inserts multiple rows based on it's parameters.
     1195 *
     1196 * @return true on success
     1197 */
     1198
     1199bool pzDoneImfileInsertObjects(
     1200    psDB            *dbh,               ///< Database handle
     1201    psArray         *objects            ///< array of pzDoneImfileRow objects
     1202);
     1203
     1204/** Insert data from a binary FITS table pzDoneImfileRow into the database
     1205 *
     1206 * This function expects a psFits object with a FITS table as the first
     1207 * extension.  The table must have at least one row of data in it, that is of
     1208 * the appropriate format (number of columns and their type).  All other
     1209 * extensions are ignored.
     1210 *
     1211 * @return true on success
     1212 */
     1213
     1214bool pzDoneImfileInsertFits(
     1215    psDB            *dbh,               ///< Database handle
     1216    const psFits    *fits               ///< psFits object
     1217);
     1218
     1219/** Selects up to limit from the database and returns them in a binary FITS table
     1220 *
     1221 * This function assumes an empty psFits object and will create a FITS table
     1222 * as the first extension.
     1223 *
     1224 *  See psDBSelectRows() for documentation on the format of where.
     1225 *
     1226 * @return true on success
     1227 */
     1228
     1229bool pzDoneImfileSelectRowsFits(
     1230    psDB            *dbh,               ///< Database handle
     1231    psFits          *fits,              ///< psFits object
     1232    const psMetadata *where,            ///< Row match criteria
     1233    unsigned long long limit            ///< Maximum number of elements to return
     1234);
     1235
     1236/** Convert a pzDoneImfileRow into an equivalent psMetadata
     1237 *
     1238 * @return A psMetadata pointer or NULL on error
     1239 */
     1240
     1241psMetadata *pzDoneImfileMetadataFromObject(
     1242    const pzDoneImfileRow *object             ///< fooRow to convert into a psMetadata
     1243);
     1244
     1245/** Convert a psMetadata into an equivalent fooRow
     1246 *
     1247 * @return A pzDoneImfileRow pointer or NULL on error
     1248 */
     1249
     1250pzDoneImfileRow *pzDoneImfileObjectFromMetadata(
     1251    psMetadata      *md                 ///< psMetadata to convert into a fooRow
     1252);
     1253/** Selects up to limit rows from the database and returns as pzDoneImfileRow objects in a psArray
     1254 *
     1255 *  See psDBSelectRows() for documentation on the format of where.
     1256 *
     1257 * @return A psArray pointer or NULL on error
     1258 */
     1259
     1260psArray *pzDoneImfileSelectRowObjects(
     1261    psDB            *dbh,               ///< Database handle
     1262    const psMetadata *where,            ///< Row match criteria
     1263    unsigned long long limit            ///< Maximum number of elements to return
     1264);
     1265/** Deletes a row from the database coresponding to an pzDoneImfile
     1266 *
     1267 *  Note that a 'where' search psMetadata is constructed from each object and
     1268 *  used to find rows to delete.
     1269 *
     1270 * @return A The number of rows removed or a negative value on error
     1271 */
     1272
     1273bool pzDoneImfileDeleteObject(
     1274    psDB            *dbh,               ///< Database handle
     1275    const pzDoneImfileRow *object    ///< Object to delete
     1276);
     1277/** Deletes up to limit rows from the database and returns the number of rows actually deleted.
     1278 *
     1279 *  Note that a 'where' search psMetadata is constructed from each object and
     1280 *  used to find rows to delete.
     1281 *
     1282 * @return A The number of rows removed or a negative value on error
     1283 */
     1284
     1285long long pzDoneImfileDeleteRowObjects(
     1286    psDB            *dbh,               ///< Database handle
     1287    const psArray   *objects,           ///< Array of objects to delete
     1288    unsigned long long limit            ///< Maximum number of elements to delete
     1289);
     1290/** Formats and prints an array of pzDoneImfileRow objects
     1291 *
     1292 * When mdcf is set the formated output is in psMetadataConfig
     1293 * format, otherwise it is in a simple tabular format.
     1294 *
     1295 * @return true on success
     1296 */
     1297
     1298bool pzDoneImfilePrintObjects(
     1299    FILE            *stream,            ///< a stream
     1300    psArray         *objects,           ///< An array of pzDoneImfileRow objects
     1301    bool            mdcf                ///< format as mdconfig or simple
     1302);
     1303/** newExpRow data structure
     1304 *
     1305 * Structure for representing a single row of newExp table data.
     1306 */
     1307
     1308typedef struct {
     1309    psU64           exp_tag;
     1310    char            *exp_id;
     1311    char            *camera;
     1312    char            *telescope;
     1313    psTime*         dateobs;
    7311314    char            *exp_type;
    7321315    psS32           imfiles;
     
    7391322
    7401323newExpRow *newExpRowAlloc(
    741     const char      *exp_tag,
     1324    psU64           exp_tag,
    7421325    const char      *exp_id,
    7431326    const char      *camera,
    7441327    const char      *telescope,
     1328    psTime*         dateobs,
    7451329    const char      *exp_type,
    7461330    psS32           imfiles
     
    7741358bool newExpInsert(
    7751359    psDB            *dbh,               ///< Database handle
    776     const char      *exp_tag,
     1360    psU64           exp_tag,
    7771361    const char      *exp_id,
    7781362    const char      *camera,
    7791363    const char      *telescope,
     1364    psTime*         dateobs,
    7801365    const char      *exp_type,
    7811366    psS32           imfiles
Note: See TracChangeset for help on using the changeset viewer.