IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 17144


Ignore:
Timestamp:
Mar 25, 2008, 1:14:07 PM (18 years ago)
Author:
jhoblitt
Message:

add warpMask table

Location:
trunk
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/dbconfig/changes.txt

    r17141 r17144  
    142142ALTER TABLE warpRun ADD COLUMN label VARCHAR(64) AFTER workdir_state;
    143143ALTER TABLE warpRun ADD KEY(label);
     144CREATE TABLE warpMask (label VARCHAR(64), PRIMARY KEY(label)) ENGINE=innodb;
     145
  • trunk/dbconfig/warp.md

    r17141 r17144  
    1 # $Id: warp.md,v 1.14 2008-03-25 22:27:25 jhoblitt Exp $
     1# $Id: warp.md,v 1.15 2008-03-25 23:14:07 jhoblitt Exp $
    22
    33#
     
    5151END
    5252
     53warpMask METADATA
     54    label       STR         64      # Primary Key
     55END
  • trunk/ippdb/Makefile.am

    r16731 r17144  
    2929    $(top_builddir)/docs/man/man3/warpSkyCellMapRow.3 \
    3030    $(top_builddir)/docs/man/man3/warpSkyfileRow.3 \
     31    $(top_builddir)/docs/man/man3/warpMaskRow.3 \
    3132    $(top_builddir)/docs/man/man3/diffRunRow.3 \
    3233    $(top_builddir)/docs/man/man3/diffInputSkyfileRow.3 \
     
    6465
    6566
    66 docs/man/man3/ippdb.3 docs/man/man3/pzDataStoreRow.3 docs/man/man3/summitExpRow.3 docs/man/man3/summitImfileRow.3 docs/man/man3/pzDownloadExpRow.3 docs/man/man3/pzDownloadImfileRow.3 docs/man/man3/newExpRow.3 docs/man/man3/newImfileRow.3 docs/man/man3/rawExpRow.3 docs/man/man3/rawImfileRow.3 docs/man/man3/guidePendingExpRow.3 docs/man/man3/chipRunRow.3 docs/man/man3/chipProcessedImfileRow.3 docs/man/man3/chipMaskRow.3 docs/man/man3/camRunRow.3 docs/man/man3/camProcessedExpRow.3 docs/man/man3/camMaskRow.3 docs/man/man3/warpRunRow.3 docs/man/man3/warpSkyCellMapRow.3 docs/man/man3/warpSkyfileRow.3 docs/man/man3/diffRunRow.3 docs/man/man3/diffInputSkyfileRow.3 docs/man/man3/diffSkyfileRow.3 docs/man/man3/stackRunRow.3 docs/man/man3/stackInputSkyfileRow.3 docs/man/man3/stackSumSkyfileRow.3 docs/man/man3/detRunRow.3 docs/man/man3/detInputExpRow.3 docs/man/man3/detProcessedImfileRow.3 docs/man/man3/detProcessedExpRow.3 docs/man/man3/detStackedImfileRow.3 docs/man/man3/detNormalizedStatImfileRow.3 docs/man/man3/detNormalizedImfileRow.3 docs/man/man3/detNormalizedExpRow.3 docs/man/man3/detResidImfileRow.3 docs/man/man3/detResidExpRow.3 docs/man/man3/detRunSummaryRow.3 docs/man/man3/detRegisteredImfileRow.3 docs/man/man3/detCorrectedExpRow.3 docs/man/man3/detCorrectedImfileRow.3 docs/man/man3/magicRunRow.3 docs/man/man3/magicInputSkyfileRow.3 docs/man/man3/magicTreeRow.3 docs/man/man3/magicNodeResultRow.3 docs/man/man3/magicMaskRow.3 docs/man/man3/magicSkyfileMaskRow.3 docs/man/man3/calDBRow.3 docs/man/man3/calRunRow.3 docs/man/man3/flatcorrRunRow.3 docs/man/man3/flatcorrExpRow.3 docs/man/man3/pstampDataStoreRow.3 docs/man/man3/pstampRequestRow.3 docs/man/man3/pstampJobRow.3:
     67docs/man/man3/ippdb.3 docs/man/man3/pzDataStoreRow.3 docs/man/man3/summitExpRow.3 docs/man/man3/summitImfileRow.3 docs/man/man3/pzDownloadExpRow.3 docs/man/man3/pzDownloadImfileRow.3 docs/man/man3/newExpRow.3 docs/man/man3/newImfileRow.3 docs/man/man3/rawExpRow.3 docs/man/man3/rawImfileRow.3 docs/man/man3/guidePendingExpRow.3 docs/man/man3/chipRunRow.3 docs/man/man3/chipProcessedImfileRow.3 docs/man/man3/chipMaskRow.3 docs/man/man3/camRunRow.3 docs/man/man3/camProcessedExpRow.3 docs/man/man3/camMaskRow.3 docs/man/man3/warpRunRow.3 docs/man/man3/warpSkyCellMapRow.3 docs/man/man3/warpSkyfileRow.3 docs/man/man3/warpMaskRow.3 docs/man/man3/diffRunRow.3 docs/man/man3/diffInputSkyfileRow.3 docs/man/man3/diffSkyfileRow.3 docs/man/man3/stackRunRow.3 docs/man/man3/stackInputSkyfileRow.3 docs/man/man3/stackSumSkyfileRow.3 docs/man/man3/detRunRow.3 docs/man/man3/detInputExpRow.3 docs/man/man3/detProcessedImfileRow.3 docs/man/man3/detProcessedExpRow.3 docs/man/man3/detStackedImfileRow.3 docs/man/man3/detNormalizedStatImfileRow.3 docs/man/man3/detNormalizedImfileRow.3 docs/man/man3/detNormalizedExpRow.3 docs/man/man3/detResidImfileRow.3 docs/man/man3/detResidExpRow.3 docs/man/man3/detRunSummaryRow.3 docs/man/man3/detRegisteredImfileRow.3 docs/man/man3/detCorrectedExpRow.3 docs/man/man3/detCorrectedImfileRow.3 docs/man/man3/magicRunRow.3 docs/man/man3/magicInputSkyfileRow.3 docs/man/man3/magicTreeRow.3 docs/man/man3/magicNodeResultRow.3 docs/man/man3/magicMaskRow.3 docs/man/man3/magicSkyfileMaskRow.3 docs/man/man3/calDBRow.3 docs/man/man3/calRunRow.3 docs/man/man3/flatcorrRunRow.3 docs/man/man3/flatcorrExpRow.3 docs/man/man3/pstampDataStoreRow.3 docs/man/man3/pstampRequestRow.3 docs/man/man3/pstampJobRow.3:
    6768        $(DOXYGEN)
    6869
  • trunk/ippdb/src/ippdb.c

    r17142 r17144  
    5050#define WARPSKYCELLMAP_TABLE_NAME "warpSkyCellMap"
    5151#define WARPSKYFILE_TABLE_NAME "warpSkyfile"
     52#define WARPMASK_TABLE_NAME "warpMask"
    5253#define DIFFRUN_TABLE_NAME "diffRun"
    5354#define DIFFINPUTSKYFILE_TABLE_NAME "diffInputSkyfile"
     
    1092210923    return true;
    1092310924}
     10925static void warpMaskRowFree(warpMaskRow *object);
     10926
     10927warpMaskRow *warpMaskRowAlloc(const char *label)
     10928{
     10929    warpMaskRow     *_object;
     10930
     10931    _object = psAlloc(sizeof(warpMaskRow));
     10932    psMemSetDeallocator(_object, (psFreeFunc)warpMaskRowFree);
     10933
     10934    _object->label = psStringCopy(label);
     10935
     10936    return _object;
     10937}
     10938
     10939static void warpMaskRowFree(warpMaskRow *object)
     10940{
     10941    psFree(object->label);
     10942}
     10943
     10944bool warpMaskCreateTable(psDB *dbh)
     10945{
     10946    psMetadata *md = psMetadataAlloc();
     10947    if (!psMetadataAdd(md, PS_LIST_TAIL, "label", PS_DATA_STRING, "Primary Key", "64")) {
     10948        psError(PS_ERR_UNKNOWN, false, "failed to add item label");
     10949        psFree(md);
     10950        return false;
     10951    }
     10952
     10953    bool status = psDBCreateTable(dbh, WARPMASK_TABLE_NAME, md);
     10954
     10955    psFree(md);
     10956
     10957    return status;
     10958}
     10959
     10960bool warpMaskDropTable(psDB *dbh)
     10961{
     10962    return psDBDropTable(dbh, WARPMASK_TABLE_NAME);
     10963}
     10964
     10965bool warpMaskInsert(psDB * dbh, const char *label)
     10966{
     10967    psMetadata *md = psMetadataAlloc();
     10968    if (!psMetadataAdd(md, PS_LIST_TAIL, "label", PS_DATA_STRING, NULL, label)) {
     10969        psError(PS_ERR_UNKNOWN, false, "failed to add item label");
     10970        psFree(md);
     10971        return false;
     10972    }
     10973
     10974    bool status = psDBInsertOneRow(dbh, WARPMASK_TABLE_NAME, md);
     10975    psFree(md);
     10976
     10977    return status;
     10978}
     10979
     10980long long warpMaskDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)
     10981{
     10982    long long       deleted = 0;
     10983
     10984    long long count = psDBDeleteRows(dbh, WARPMASK_TABLE_NAME, where, limit);
     10985    if (count < 0) {
     10986        psError(PS_ERR_UNKNOWN, true, "failed to delete row from warpMask");
     10987        return count;
     10988
     10989        deleted += count;
     10990    }
     10991
     10992    return deleted;
     10993}
     10994bool warpMaskInsertObject(psDB *dbh, warpMaskRow *object)
     10995{
     10996    return warpMaskInsert(dbh, object->label);
     10997}
     10998
     10999bool warpMaskInsertObjects(psDB *dbh, psArray *objects)
     11000{
     11001    for (long i = 0; i < psArrayLength(objects); i++) {
     11002        if (!warpMaskInsertObject(dbh, objects->data[i])) {
     11003            return false;
     11004        }
     11005    }
     11006
     11007    return true;
     11008}
     11009
     11010bool warpMaskInsertFits(psDB *dbh, const psFits *fits)
     11011{
     11012    psArray         *rowSet;
     11013
     11014    // move to (the first?) extension named  WARPMASK_TABLE_NAME
     11015    if (!psFitsMoveExtName(fits, WARPMASK_TABLE_NAME)) {
     11016        psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", WARPMASK_TABLE_NAME);
     11017        return false;
     11018    }
     11019
     11020    // check HDU type
     11021    if (psFitsGetExtType(fits) != PS_FITS_TYPE_BINARY_TABLE)  {
     11022        psError(PS_ERR_UNKNOWN, true, "FITS HDU type is not PS_FITS_TYPE_BINARY_TABLE");
     11023        return false;
     11024    }
     11025
     11026    // read fits table
     11027    rowSet = psFitsReadTable(fits);
     11028    if (!rowSet) {
     11029        psError(PS_ERR_UNKNOWN, true, "FITS read error or FITS table is empty");
     11030        psFree(rowSet);
     11031        return false;
     11032    }
     11033
     11034    if (!psDBInsertRows(dbh, WARPMASK_TABLE_NAME, rowSet)) {
     11035        psError(PS_ERR_UNKNOWN, false, "databse insert failed");
     11036        psFree(rowSet);
     11037        return false;
     11038    }
     11039
     11040    psFree(rowSet);
     11041
     11042    return true;
     11043}
     11044
     11045bool warpMaskSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)
     11046{
     11047    psArray         *rowSet;
     11048
     11049    rowSet = psDBSelectRows(dbh, WARPMASK_TABLE_NAME, where, limit);
     11050    if (!rowSet) {
     11051        return false;
     11052    }
     11053
     11054    // output to fits
     11055    if (!psFitsWriteTable(fits, NULL, rowSet, WARPMASK_TABLE_NAME)) {
     11056        psError(PS_ERR_UNKNOWN, false, "FITS table write failed");
     11057        psFree(rowSet);
     11058        return false;
     11059    }
     11060
     11061    psFree(rowSet);
     11062
     11063    return true;
     11064}
     11065
     11066psMetadata *warpMaskMetadataFromObject(const warpMaskRow *object)
     11067{
     11068    psMetadata *md = psMetadataAlloc();
     11069    if (!psMetadataAdd(md, PS_LIST_TAIL, "label", PS_DATA_STRING, NULL, object->label)) {
     11070        psError(PS_ERR_UNKNOWN, false, "failed to add item label");
     11071        psFree(md);
     11072        return false;
     11073    }
     11074
     11075
     11076    return md;
     11077}
     11078
     11079warpMaskRow *warpMaskObjectFromMetadata(psMetadata *md)
     11080{
     11081
     11082bool status = false;
     11083    char* label = psMetadataLookupPtr(&status, md, "label");
     11084    if (!status) {
     11085        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item label");
     11086        return false;
     11087    }
     11088
     11089    return warpMaskRowAlloc(label);
     11090}
     11091psArray *warpMaskSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
     11092{
     11093    psArray         *rowSet;
     11094    psArray         *returnSet;
     11095    psU64           i;
     11096
     11097    rowSet = psDBSelectRows(dbh, WARPMASK_TABLE_NAME, where, limit);
     11098    if (!rowSet) {
     11099        return NULL;
     11100    }
     11101
     11102    // convert psMetadata rows to row objects
     11103
     11104    returnSet = psArrayAllocEmpty(rowSet->n);
     11105
     11106    for (i = 0; i < rowSet->n; i++) {
     11107        warpMaskRow *object = warpMaskObjectFromMetadata(rowSet->data[i]);
     11108        if (!object) {
     11109            psFree(object);
     11110            psFree(returnSet);
     11111            psError(PS_ERR_UNKNOWN, false, "database error");
     11112            return NULL;
     11113        }
     11114        psArrayAdd(returnSet, 0, object);
     11115        psFree(object);
     11116    }
     11117
     11118    psFree(rowSet);
     11119
     11120    return returnSet;
     11121}
     11122bool warpMaskDeleteObject(psDB *dbh, const warpMaskRow *object)
     11123{
     11124    psMetadata *where = warpMaskMetadataFromObject(object);
     11125    long long count = psDBDeleteRows(dbh, WARPMASK_TABLE_NAME, where, 0);
     11126    psFree(where);
     11127    if (count < 0) {
     11128        psError(PS_ERR_UNKNOWN, true, "failed to delete row from warpMask");
     11129        return false;
     11130    }
     11131    if (count > 1) {
     11132        // XXX should this be a psAbort() instead?  It is possible that
     11133        // having an object match multiple rows was by design.
     11134        psError(PS_ERR_UNKNOWN, true, "warpMaskRow object matched more then one row.  Check your database schema");
     11135        return false;
     11136    }
     11137
     11138    return true;
     11139}
     11140long long warpMaskDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)
     11141{
     11142    long long       deleted = 0;
     11143
     11144    for (long long i = 0; i < objects->n; i++) {
     11145        warpMaskRow *object = objects->data[i];
     11146        psMetadata *where = warpMaskMetadataFromObject(object);
     11147        long long count = psDBDeleteRows(dbh, WARPMASK_TABLE_NAME, where, limit);
     11148        psFree(where);
     11149        if (count < 0) {
     11150            psError(PS_ERR_UNKNOWN, true, "failed to delete row from warpMask");
     11151            return count;
     11152        }
     11153
     11154        deleted += count;
     11155    }
     11156
     11157    return deleted;
     11158}
     11159bool warpMaskPrintObjects(FILE *stream, psArray *objects, bool mdcf)
     11160{
     11161    PS_ASSERT_PTR_NON_NULL(objects, false);
     11162
     11163    psMetadata *output = psMetadataAlloc();
     11164    for (long i = 0; i < psArrayLength(objects); i++) {
     11165        psMetadata *md = warpMaskMetadataFromObject(objects->data[i]);
     11166        if (!psMetadataAddMetadata(
     11167            output,
     11168            PS_LIST_TAIL,
     11169            WARPMASK_TABLE_NAME,
     11170            PS_META_DUPLICATE_OK,
     11171            NULL,
     11172            md
     11173        )) {
     11174            psError(PS_ERR_UNKNOWN, false, "failed to add metadata");
     11175            psFree(md);
     11176            psFree(output);
     11177            return false;
     11178        }
     11179        psFree(md);
     11180    }
     11181
     11182    if (!ippdbPrintMetadataRaw(stream, output, mdcf)) {
     11183        psError(PS_ERR_UNKNOWN, false, "failed to print metadata");
     11184        psFree(output);
     11185    }
     11186    psFree(output);
     11187
     11188    return true;
     11189}
     11190bool warpMaskPrintObject(FILE *stream, warpMaskRow *object, bool mdcf)
     11191{
     11192    PS_ASSERT_PTR_NON_NULL(object, false);
     11193
     11194    psMetadata *md = warpMaskMetadataFromObject(object);
     11195
     11196    if (!ippdbPrintMetadataRaw(stream, md, mdcf)) {
     11197        psError(PS_ERR_UNKNOWN, false, "failed to print metadata");
     11198        psFree(md);
     11199    }
     11200
     11201    psFree(md);
     11202
     11203    return true;
     11204}
    1092411205static void diffRunRowFree(diffRunRow *object);
    1092511206
  • trunk/ippdb/src/ippdb.h

    r17142 r17144  
    45804580    bool            mdcf                ///< format as mdconfig or simple
    45814581);
     4582/** warpMaskRow data structure
     4583 *
     4584 * Structure for representing a single row of warpMask table data.
     4585 */
     4586
     4587typedef struct {
     4588    char            *label;
     4589} warpMaskRow;
     4590
     4591/** Creates a new warpMaskRow object
     4592 *
     4593 *  @return A new warpMaskRow object or NULL on failure.
     4594 */
     4595
     4596warpMaskRow *warpMaskRowAlloc(
     4597    const char      *label
     4598);
     4599
     4600/** Creates a new warpMask table
     4601 *
     4602 * @return true on success
     4603 */
     4604
     4605bool warpMaskCreateTable(
     4606    psDB            *dbh                ///< Database handle
     4607);
     4608
     4609/** Deletes a warpMask table
     4610 *
     4611 * @return true on success
     4612 */
     4613
     4614bool warpMaskDropTable(
     4615    psDB            *dbh                ///< Database handle
     4616);
     4617
     4618/** Insert a single row into a table
     4619 *
     4620 * This function constructs and inserts a single row based on it's parameters.
     4621 *
     4622 * @return true on success
     4623 */
     4624
     4625bool warpMaskInsert(
     4626    psDB            *dbh,               ///< Database handle
     4627    const char      *label
     4628);
     4629
     4630/** Deletes up to limit rows from the database and returns the number of rows actually deleted.
     4631 *
     4632 * @return A The number of rows removed or a negative value on error
     4633 */
     4634
     4635long long warpMaskDelete(
     4636    psDB            *dbh,               ///< Database handle
     4637    const psMetadata *where,            ///< Row match criteria
     4638    unsigned long long limit            ///< Maximum number of elements to delete
     4639);
     4640
     4641/** Insert a single warpMaskRow object into a table
     4642 *
     4643 * This function constructs and inserts a single row based on it's parameters.
     4644 *
     4645 * @return true on success
     4646 */
     4647
     4648bool warpMaskInsertObject(
     4649    psDB            *dbh,               ///< Database handle
     4650    warpMaskRow     *object             ///< warpMaskRow object
     4651);
     4652
     4653/** Insert an array of warpMaskRow object into a table
     4654 *
     4655 * This function constructs and inserts multiple rows based on it's parameters.
     4656 *
     4657 * @return true on success
     4658 */
     4659
     4660bool warpMaskInsertObjects(
     4661    psDB            *dbh,               ///< Database handle
     4662    psArray         *objects            ///< array of warpMaskRow objects
     4663);
     4664
     4665/** Insert data from a binary FITS table warpMaskRow into the database
     4666 *
     4667 * This function expects a psFits object with a FITS table as the first
     4668 * extension.  The table must have at least one row of data in it, that is of
     4669 * the appropriate format (number of columns and their type).  All other
     4670 * extensions are ignored.
     4671 *
     4672 * @return true on success
     4673 */
     4674
     4675bool warpMaskInsertFits(
     4676    psDB            *dbh,               ///< Database handle
     4677    const psFits    *fits               ///< psFits object
     4678);
     4679
     4680/** Selects up to limit from the database and returns them in a binary FITS table
     4681 *
     4682 * This function assumes an empty psFits object and will create a FITS table
     4683 * as the first extension.
     4684 *
     4685 *  See psDBSelectRows() for documentation on the format of where.
     4686 *
     4687 * @return true on success
     4688 */
     4689
     4690bool warpMaskSelectRowsFits(
     4691    psDB            *dbh,               ///< Database handle
     4692    psFits          *fits,              ///< psFits object
     4693    const psMetadata *where,            ///< Row match criteria
     4694    unsigned long long limit            ///< Maximum number of elements to return
     4695);
     4696
     4697/** Convert a warpMaskRow into an equivalent psMetadata
     4698 *
     4699 * @return A psMetadata pointer or NULL on error
     4700 */
     4701
     4702psMetadata *warpMaskMetadataFromObject(
     4703    const warpMaskRow *object             ///< fooRow to convert into a psMetadata
     4704);
     4705
     4706/** Convert a psMetadata into an equivalent fooRow
     4707 *
     4708 * @return A warpMaskRow pointer or NULL on error
     4709 */
     4710
     4711warpMaskRow *warpMaskObjectFromMetadata(
     4712    psMetadata      *md                 ///< psMetadata to convert into a fooRow
     4713);
     4714/** Selects up to limit rows from the database and returns as warpMaskRow objects in a psArray
     4715 *
     4716 *  See psDBSelectRows() for documentation on the format of where.
     4717 *
     4718 * @return A psArray pointer or NULL on error
     4719 */
     4720
     4721psArray *warpMaskSelectRowObjects(
     4722    psDB            *dbh,               ///< Database handle
     4723    const psMetadata *where,            ///< Row match criteria
     4724    unsigned long long limit            ///< Maximum number of elements to return
     4725);
     4726/** Deletes a row from the database coresponding to an warpMask
     4727 *
     4728 *  Note that a 'where' search psMetadata is constructed from each object and
     4729 *  used to find rows to delete.
     4730 *
     4731 * @return A The number of rows removed or a negative value on error
     4732 */
     4733
     4734bool warpMaskDeleteObject(
     4735    psDB            *dbh,               ///< Database handle
     4736    const warpMaskRow *object    ///< Object to delete
     4737);
     4738/** Deletes up to limit rows from the database and returns the number of rows actually deleted.
     4739 *
     4740 *  Note that a 'where' search psMetadata is constructed from each object and
     4741 *  used to find rows to delete.
     4742 *
     4743 * @return A The number of rows removed or a negative value on error
     4744 */
     4745
     4746long long warpMaskDeleteRowObjects(
     4747    psDB            *dbh,               ///< Database handle
     4748    const psArray   *objects,           ///< Array of objects to delete
     4749    unsigned long long limit            ///< Maximum number of elements to delete
     4750);
     4751/** Formats and prints an array of warpMaskRow objects
     4752 *
     4753 * When mdcf is set the formated output is in psMetadataConfig
     4754 * format, otherwise it is in a simple tabular format.
     4755 *
     4756 * @return true on success
     4757 */
     4758
     4759bool warpMaskPrintObjects(
     4760    FILE            *stream,            ///< a stream
     4761    psArray         *objects,           ///< An array of warpMaskRow objects
     4762    bool            mdcf                ///< format as mdconfig or simple
     4763);
     4764/** Formats and prints an warpMaskRow object
     4765 *
     4766 * When mdcf is set the formated output is in psMetadataConfig
     4767 * format, otherwise it is in a simple tabular format.
     4768 *
     4769 * @return true on success
     4770 */
     4771
     4772bool warpMaskPrintObject(
     4773    FILE            *stream,            ///< a stream
     4774    warpMaskRow *object,    ///< an warpMaskRow object
     4775    bool            mdcf                ///< format as mdconfig or simple
     4776);
    45824777/** diffRunRow data structure
    45834778 *
  • trunk/ippdb/tests/alloc.c

    r17142 r17144  
    13281328
    13291329    {
     1330        warpMaskRow     *object;
     1331
     1332        object = warpMaskRowAlloc("a string"    );
     1333
     1334        if (!object) {
     1335            exit(EXIT_FAILURE);
     1336        }
     1337
     1338        if (strncmp(object->label, "a string", MAX_STRING_LENGTH)) {
     1339            psFree(object);
     1340            exit(EXIT_FAILURE);
     1341        }
     1342
     1343        psFree(object);
     1344    }
     1345
     1346    {
    13301347        diffRunRow      *object;
    13311348
  • trunk/ippdb/tests/createtable.c

    r16731 r17144  
    298298        }
    299299
     300        if(!warpMaskCreateTable(dbh)) {
     301            exit(EXIT_FAILURE);
     302        }
     303
     304        psDBCleanup(dbh);
     305    }
     306
     307    {
     308        psDB            *dbh;
     309
     310        dbh = psDBInit("localhost", "test", NULL, "test");
     311        if (!dbh) {
     312            exit(EXIT_FAILURE);
     313        }
     314
    300315        if(!diffRunCreateTable(dbh)) {
    301316            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/dbcleanup.c

    r16731 r17144  
    3030    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS warpSkyCellMap");
    3131    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS warpSkyfile");
     32    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS warpMask");
    3233    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS diffRun");
    3334    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS diffInputSkyfile");
  • trunk/ippdb/tests/dbsetup.c

    r16731 r17144  
    6969    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS warpSkyfile");
    7070    warpSkyfileCreateTable(dbh);
     71
     72    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS warpMask");
     73    warpMaskCreateTable(dbh);
    7174
    7275    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS diffRun");
  • trunk/ippdb/tests/droptable.c

    r16731 r17144  
    298298        }
    299299
     300        if (!warpMaskDropTable(dbh)) {
     301            exit(EXIT_FAILURE);
     302        }
     303
     304        psDBCleanup(dbh);
     305    }
     306
     307    {
     308        psDB            *dbh;
     309
     310        dbh = psDBInit("localhost", "test", NULL, "test");
     311        if (!dbh) {
     312            exit(EXIT_FAILURE);
     313        }
     314
    300315        if (!diffRunDropTable(dbh)) {
    301316            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/insert.c

    r17142 r17144  
    298298        }
    299299
     300        if (!warpMaskInsert(dbh, "a string")) {
     301            exit(EXIT_FAILURE);
     302        }
     303
     304        psDBCleanup(dbh);
     305    }
     306
     307    {
     308        psDB            *dbh;
     309
     310        dbh = psDBInit("localhost", "test", NULL, "test");
     311        if (!dbh) {
     312            exit(EXIT_FAILURE);
     313        }
     314
    300315        if (!diffRunInsert(dbh, -64, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string")) {
    301316            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/insertfits.c

    r16731 r17144  
    518518        }
    519519
     520        if (!warpMaskInsertFits(dbh, fits)) {
     521            exit(EXIT_FAILURE);
     522        }
     523
     524        if (!psFitsClose(fits)) {
     525            exit(EXIT_FAILURE);
     526        }
     527
     528        psDBCleanup(dbh);
     529    }
     530
     531    {
     532        psDB            *dbh;
     533        psFits          *fits;
     534
     535        dbh = psDBInit("localhost", "test", NULL, "test");
     536        if (!dbh) {
     537            exit(EXIT_FAILURE);
     538        }
     539
     540        // open a temp
     541        fits = psFitsOpen(TMP_FILENAME, "r");
     542        if (!fits) {
     543            exit(EXIT_FAILURE);
     544        }
     545
    520546        if (!diffRunInsertFits(dbh, fits)) {
    521547            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/insertobject.c

    r17142 r17144  
    425425    {
    426426        psDB            *dbh;
     427        warpMaskRow     *object;
     428
     429        dbh = psDBInit("localhost", "test", NULL, "test");
     430        if (!dbh) {
     431            exit(EXIT_FAILURE);
     432        }
     433
     434        object = warpMaskRowAlloc("a string");
     435        if (!object) {
     436            exit(EXIT_FAILURE);
     437        }
     438
     439        if (!warpMaskInsertObject(dbh, object)) {
     440            exit(EXIT_FAILURE);
     441        }
     442
     443        psFree(object);
     444        psDBCleanup(dbh);
     445    }
     446
     447    {
     448        psDB            *dbh;
    427449        diffRunRow      *object;
    428450
  • trunk/ippdb/tests/metadatafromobject.c

    r17142 r17144  
    14551455    {
    14561456        psMetadata      *md;
     1457        warpMaskRow     *object;
     1458        bool            status;
     1459
     1460        object = warpMaskRowAlloc("a string");
     1461        if (!object) {
     1462            exit(EXIT_FAILURE);
     1463        }
     1464
     1465        md = warpMaskMetadataFromObject(object);
     1466        if (!md) {
     1467            exit(EXIT_FAILURE);
     1468        }
     1469
     1470        psFree(object);
     1471
     1472        if (strncmp(psMetadataLookupPtr(&status, md, "label"), "a string", MAX_STRING_LENGTH)) {
     1473            psFree(md);
     1474            exit(EXIT_FAILURE);
     1475        }
     1476
     1477        psFree(md);
     1478    }
     1479
     1480    {
     1481        psMetadata      *md;
    14571482        diffRunRow      *object;
    14581483        bool            status;
  • trunk/ippdb/tests/objectfrommetadata.c

    r17142 r17144  
    24442444    {
    24452445        psMetadata      *md;
     2446        warpMaskRow     *object;
     2447
     2448        md = psMetadataAlloc();
     2449        if (!psMetadataAddStr(md, PS_LIST_TAIL, "label", 0, NULL, "a string")) {
     2450            psFree(md);
     2451            exit(EXIT_FAILURE);
     2452        }
     2453
     2454        object = warpMaskObjectFromMetadata(md);
     2455        if (!object) {
     2456            psFree(md);
     2457            exit(EXIT_FAILURE);
     2458        }
     2459
     2460        psFree(md);
     2461
     2462        if (strncmp(object->label, "a string", MAX_STRING_LENGTH)) {
     2463            psFree(object);
     2464            exit(EXIT_FAILURE);
     2465        }
     2466
     2467        psFree(object);
     2468    }
     2469
     2470    {
     2471        psMetadata      *md;
    24462472        diffRunRow      *object;
    24472473
  • trunk/ippdb/tests/selectrowsfits.c

    r16731 r17144  
    439439        }
    440440
     441        if (!warpMaskSelectRowsFits(dbh, fits, NULL, 1)) {
     442            exit(EXIT_FAILURE);
     443        }
     444
     445        psFree(fits);
     446        psDBCleanup(dbh);
     447    }
     448
     449    {
     450        psDB            *dbh;
     451        psFits          *fits;
     452
     453        dbh = psDBInit("localhost", "test", NULL, "test");
     454        if (!dbh) {
     455            exit(EXIT_FAILURE);
     456        }
     457
     458        fits = psFitsOpen(TMP_FILENAME, "w");
     459        if (!fits) {
     460            exit(EXIT_FAILURE);
     461        }
     462
    441463        if (!diffRunSelectRowsFits(dbh, fits, NULL, 1)) {
    442464            exit(EXIT_FAILURE);
Note: See TracChangeset for help on using the changeset viewer.