IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 11820


Ignore:
Timestamp:
Feb 14, 2007, 5:58:26 PM (19 years ago)
Author:
jhoblitt
Message:

VERSION 1.1.7

Location:
trunk
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/dbconfig/config.md

    r11815 r11820  
    22    pkg_name        STR     ippdb
    33    pkg_namespace   STR     ippdb
    4     pkg_version     STR     1.1.7
     4    pkg_version     STR     1.1.8
    55END
  • trunk/ippdb/Makefile.am

    r11809 r11820  
    4747    $(top_builddir)/docs/man/man3/p5RunRow.3 \
    4848    $(top_builddir)/docs/man/man3/p5InputScfileRow.3 \
    49     $(top_builddir)/docs/man/man3/p5DiffScfileRow.3
     49    $(top_builddir)/docs/man/man3/p5DiffScfileRow.3 \
     50    $(top_builddir)/docs/man/man3/p6RunRow.3
    5051
    5152
    52 docs/man/man3/ippdb.3 docs/man/man3/expTagCounterRow.3 docs/man/man3/summitExpRow.3 docs/man/man3/summitImfileRow.3 docs/man/man3/pzPendingExpRow.3 docs/man/man3/pzPendingImfileRow.3 docs/man/man3/pzDoneExpRow.3 docs/man/man3/pzDoneImfileRow.3 docs/man/man3/newExpRow.3 docs/man/man3/newImfileRow.3 docs/man/man3/rawExpRow.3 docs/man/man3/rawImfileRow.3 docs/man/man3/p1PendingExpRow.3 docs/man/man3/p2PendingExpRow.3 docs/man/man3/p2PendingImfileRow.3 docs/man/man3/p2ProcessedExpRow.3 docs/man/man3/p2MaskRow.3 docs/man/man3/p2ProcessedImfileRow.3 docs/man/man3/p3PendingExpRow.3 docs/man/man3/p3ProcessedExpRow.3 docs/man/man3/p3MaskRow.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/p4RunRow.3 docs/man/man3/p4InputExpRow.3 docs/man/man3/p4SkyCellMapRow.3 docs/man/man3/p4ScfileRow.3 docs/man/man3/p5RunRow.3 docs/man/man3/p5InputScfileRow.3 docs/man/man3/p5DiffScfileRow.3:
     53docs/man/man3/ippdb.3 docs/man/man3/expTagCounterRow.3 docs/man/man3/summitExpRow.3 docs/man/man3/summitImfileRow.3 docs/man/man3/pzPendingExpRow.3 docs/man/man3/pzPendingImfileRow.3 docs/man/man3/pzDoneExpRow.3 docs/man/man3/pzDoneImfileRow.3 docs/man/man3/newExpRow.3 docs/man/man3/newImfileRow.3 docs/man/man3/rawExpRow.3 docs/man/man3/rawImfileRow.3 docs/man/man3/p1PendingExpRow.3 docs/man/man3/p2PendingExpRow.3 docs/man/man3/p2PendingImfileRow.3 docs/man/man3/p2ProcessedExpRow.3 docs/man/man3/p2MaskRow.3 docs/man/man3/p2ProcessedImfileRow.3 docs/man/man3/p3PendingExpRow.3 docs/man/man3/p3ProcessedExpRow.3 docs/man/man3/p3MaskRow.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/p4RunRow.3 docs/man/man3/p4InputExpRow.3 docs/man/man3/p4SkyCellMapRow.3 docs/man/man3/p4ScfileRow.3 docs/man/man3/p5RunRow.3 docs/man/man3/p5InputScfileRow.3 docs/man/man3/p5DiffScfileRow.3 docs/man/man3/p6RunRow.3:
    5354        $(DOXYGEN)
    5455
  • trunk/ippdb/configure.ac

    r11809 r11820  
    77AC_PREREQ(2.59)
    88
    9 AC_INIT([ippdb], [1.1.6], [pan-starrs.ifa.hawaii.edu])
     9AC_INIT([ippdb], [1.1.8], [pan-starrs.ifa.hawaii.edu])
    1010AC_CONFIG_SRCDIR([ippdb.pc.in])
    1111
  • trunk/ippdb/src/ippdb.c

    r11809 r11820  
    6969#define P5INPUTSCFILE_TABLE_NAME "p5InputScfile"
    7070#define P5DIFFSCFILE_TABLE_NAME "p5DiffScfile"
     71#define P6RUN_TABLE_NAME "p6Run"
    7172#define MAX_STRING_LENGTH 1024
    7273
     
    35233524static void rawExpRowFree(rawExpRow *object);
    35243525
    3525 rawExpRow *rawExpRowAlloc(const char *exp_tag, const char *exp_id, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, psS32 imfiles, const char *workdir, const char *filter, psF32 airmass, psF64 ra, psF64 decl, psF32 exp_time, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, psF64 alt, psF64 az, psF32 ccd_temp, psF64 posang, const char *object, psS16 fault)
     3526rawExpRow *rawExpRowAlloc(const char *exp_tag, const char *exp_id, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, psS32 imfiles, const char *workdir, const char *filter, psF32 airmass, psF64 ra, psF64 decl, psF32 exp_time, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, psF64 alt, psF64 az, psF32 ccd_temp, psF64 posang, const char *object, psF32 solang, psS16 fault)
    35263527{
    35273528    rawExpRow       *_object;
     
    35513552    _object->posang = posang;
    35523553    _object->object = psStringCopy(object);
     3554    _object->solang = solang;
    35533555    _object->fault = fault;
    35543556
     
    36773679        return false;
    36783680    }
     3681    if (!psMetadataAdd(md, PS_LIST_TAIL, "solang", PS_DATA_F32, NULL, 0.0)) {
     3682        psError(PS_ERR_UNKNOWN, false, "failed to add item solang");
     3683        psFree(md);
     3684        return false;
     3685    }
    36793686    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, "Key NOT NULL", 0)) {
    36803687        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
     
    36953702}
    36963703
    3697 bool rawExpInsert(psDB * dbh, const char *exp_tag, const char *exp_id, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, psS32 imfiles, const char *workdir, const char *filter, psF32 airmass, psF64 ra, psF64 decl, psF32 exp_time, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, psF64 alt, psF64 az, psF32 ccd_temp, psF64 posang, const char *object, psS16 fault)
     3704bool rawExpInsert(psDB * dbh, const char *exp_tag, const char *exp_id, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, psS32 imfiles, const char *workdir, const char *filter, psF32 airmass, psF64 ra, psF64 decl, psF32 exp_time, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, psF64 alt, psF64 az, psF32 ccd_temp, psF64 posang, const char *object, psF32 solang, psS16 fault)
    36983705{
    36993706    psMetadata *md = psMetadataAlloc();
     
    38003807    if (!psMetadataAdd(md, PS_LIST_TAIL, "object", PS_DATA_STRING, NULL, object)) {
    38013808        psError(PS_ERR_UNKNOWN, false, "failed to add item object");
     3809        psFree(md);
     3810        return false;
     3811    }
     3812    if (!psMetadataAdd(md, PS_LIST_TAIL, "solang", PS_DATA_F32, NULL, solang)) {
     3813        psError(PS_ERR_UNKNOWN, false, "failed to add item solang");
    38023814        psFree(md);
    38033815        return false;
     
    38313843bool rawExpInsertObject(psDB *dbh, rawExpRow *object)
    38323844{
    3833     return rawExpInsert(dbh, object->exp_tag, object->exp_id, object->camera, object->telescope, object->dateobs, object->exp_type, object->imfiles, object->workdir, object->filter, object->airmass, object->ra, object->decl, object->exp_time, object->bg, object->bg_stdev, object->bg_mean_stdev, object->alt, object->az, object->ccd_temp, object->posang, object->object, object->fault);
     3845    return rawExpInsert(dbh, object->exp_tag, object->exp_id, object->camera, object->telescope, object->dateobs, object->exp_type, object->imfiles, object->workdir, object->filter, object->airmass, object->ra, object->decl, object->exp_time, object->bg, object->bg_stdev, object->bg_mean_stdev, object->alt, object->az, object->ccd_temp, object->posang, object->object, object->solang, object->fault);
    38343846}
    38353847
     
    40094021        return false;
    40104022    }
     4023    if (!psMetadataAdd(md, PS_LIST_TAIL, "solang", PS_DATA_F32, NULL, object->solang)) {
     4024        psError(PS_ERR_UNKNOWN, false, "failed to add item solang");
     4025        psFree(md);
     4026        return false;
     4027    }
    40114028    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, object->fault)) {
    40124029        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
     
    41284145        return false;
    41294146    }
     4147    psF32 solang = psMetadataLookupF32(&status, md, "solang");
     4148    if (!status) {
     4149        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item solang");
     4150        return false;
     4151    }
    41304152    psS16 fault = psMetadataLookupS16(&status, md, "fault");
    41314153    if (!status) {
     
    41344156    }
    41354157
    4136     return rawExpRowAlloc(exp_tag, exp_id, camera, telescope, dateobs, exp_type, imfiles, workdir, filter, airmass, ra, decl, exp_time, bg, bg_stdev, bg_mean_stdev, alt, az, ccd_temp, posang, object, fault);
     4158    return rawExpRowAlloc(exp_tag, exp_id, camera, telescope, dateobs, exp_type, imfiles, workdir, filter, airmass, ra, decl, exp_time, bg, bg_stdev, bg_mean_stdev, alt, az, ccd_temp, posang, object, solang, fault);
    41374159}
    41384160psArray *rawExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
     
    83348356static void detRunRowFree(detRunRow *object);
    83358357
    8336 detRunRow *detRunRowAlloc(psS32 det_id, psS32 iteration, const char *det_type, const char *mode, const char *state, const char *workdir, const char *camera, const char *telescope, const char *exp_type, const char *filter, psF32 airmass_min, psF32 airmass_max, psF32 exp_time_min, psF32 exp_time_max, psF32 ccd_temp_min, psF32 ccd_temp_max, psF64 posang_min, psF64 posang_max, psTime* registered, psTime* time_begin, psTime* time_end, psTime* use_begin, psTime* use_end)
     8358detRunRow *detRunRowAlloc(psS32 det_id, psS32 iteration, const char *det_type, const char *mode, const char *state, const char *workdir, const char *camera, const char *telescope, const char *exp_type, const char *filter, psF32 airmass_min, psF32 airmass_max, psF32 exp_time_min, psF32 exp_time_max, psF32 ccd_temp_min, psF32 ccd_temp_max, psF64 posang_min, psF64 posang_max, psTime* registered, psTime* time_begin, psTime* time_end, psTime* use_begin, psTime* use_end, psF32 solang_min, psF32 solang_max, const char *label, psS32 parent)
    83378359{
    83388360    detRunRow       *_object;
     
    83648386    _object->use_begin = psTimeCopy(use_begin);
    83658387    _object->use_end = psTimeCopy(use_end);
     8388    _object->solang_min = solang_min;
     8389    _object->solang_max = solang_max;
     8390    _object->label = psStringCopy(label);
     8391    _object->parent = parent;
    83668392
    83678393    return _object;
     
    83838409    psFree(object->use_begin);
    83848410    psFree(object->use_end);
     8411    psFree(object->label);
    83858412}
    83868413
     
    85038530        return false;
    85048531    }
     8532    if (!psMetadataAdd(md, PS_LIST_TAIL, "solang_min", PS_DATA_F32, NULL, 0.0)) {
     8533        psError(PS_ERR_UNKNOWN, false, "failed to add item solang_min");
     8534        psFree(md);
     8535        return false;
     8536    }
     8537    if (!psMetadataAdd(md, PS_LIST_TAIL, "solang_max", PS_DATA_F32, NULL, 0.0)) {
     8538        psError(PS_ERR_UNKNOWN, false, "failed to add item solang_max");
     8539        psFree(md);
     8540        return false;
     8541    }
     8542    if (!psMetadataAdd(md, PS_LIST_TAIL, "label", PS_DATA_STRING, "key", "64")) {
     8543        psError(PS_ERR_UNKNOWN, false, "failed to add item label");
     8544        psFree(md);
     8545        return false;
     8546    }
     8547    if (!psMetadataAdd(md, PS_LIST_TAIL, "parent", PS_DATA_S32, "Key", 0)) {
     8548        psError(PS_ERR_UNKNOWN, false, "failed to add item parent");
     8549        psFree(md);
     8550        return false;
     8551    }
    85058552
    85068553    bool status = psDBCreateTable(dbh, DETRUN_TABLE_NAME, md);
     
    85168563}
    85178564
    8518 bool detRunInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *det_type, const char *mode, const char *state, const char *workdir, const char *camera, const char *telescope, const char *exp_type, const char *filter, psF32 airmass_min, psF32 airmass_max, psF32 exp_time_min, psF32 exp_time_max, psF32 ccd_temp_min, psF32 ccd_temp_max, psF64 posang_min, psF64 posang_max, psTime* registered, psTime* time_begin, psTime* time_end, psTime* use_begin, psTime* use_end)
     8565bool detRunInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *det_type, const char *mode, const char *state, const char *workdir, const char *camera, const char *telescope, const char *exp_type, const char *filter, psF32 airmass_min, psF32 airmass_max, psF32 exp_time_min, psF32 exp_time_max, psF32 ccd_temp_min, psF32 ccd_temp_max, psF64 posang_min, psF64 posang_max, psTime* registered, psTime* time_begin, psTime* time_end, psTime* use_begin, psTime* use_end, psF32 solang_min, psF32 solang_max, const char *label, psS32 parent)
    85198566{
    85208567    psMetadata *md = psMetadataAlloc();
     
    86318678    if (!psMetadataAdd(md, PS_LIST_TAIL, "use_end", PS_DATA_TIME, NULL, use_end)) {
    86328679        psError(PS_ERR_UNKNOWN, false, "failed to add item use_end");
     8680        psFree(md);
     8681        return false;
     8682    }
     8683    if (!psMetadataAdd(md, PS_LIST_TAIL, "solang_min", PS_DATA_F32, NULL, solang_min)) {
     8684        psError(PS_ERR_UNKNOWN, false, "failed to add item solang_min");
     8685        psFree(md);
     8686        return false;
     8687    }
     8688    if (!psMetadataAdd(md, PS_LIST_TAIL, "solang_max", PS_DATA_F32, NULL, solang_max)) {
     8689        psError(PS_ERR_UNKNOWN, false, "failed to add item solang_max");
     8690        psFree(md);
     8691        return false;
     8692    }
     8693    if (!psMetadataAdd(md, PS_LIST_TAIL, "label", PS_DATA_STRING, NULL, label)) {
     8694        psError(PS_ERR_UNKNOWN, false, "failed to add item label");
     8695        psFree(md);
     8696        return false;
     8697    }
     8698    if (!psMetadataAdd(md, PS_LIST_TAIL, "parent", PS_DATA_S32, NULL, parent)) {
     8699        psError(PS_ERR_UNKNOWN, false, "failed to add item parent");
    86338700        psFree(md);
    86348701        return false;
     
    86578724bool detRunInsertObject(psDB *dbh, detRunRow *object)
    86588725{
    8659     return detRunInsert(dbh, object->det_id, object->iteration, object->det_type, object->mode, object->state, object->workdir, object->camera, object->telescope, object->exp_type, object->filter, object->airmass_min, object->airmass_max, object->exp_time_min, object->exp_time_max, object->ccd_temp_min, object->ccd_temp_max, object->posang_min, object->posang_max, object->registered, object->time_begin, object->time_end, object->use_begin, object->use_end);
     8726    return detRunInsert(dbh, object->det_id, object->iteration, object->det_type, object->mode, object->state, object->workdir, object->camera, object->telescope, object->exp_type, object->filter, object->airmass_min, object->airmass_max, object->exp_time_min, object->exp_time_max, object->ccd_temp_min, object->ccd_temp_max, object->posang_min, object->posang_max, object->registered, object->time_begin, object->time_end, object->use_begin, object->use_end, object->solang_min, object->solang_max, object->label, object->parent);
    86608727}
    86618728
     
    88458912        return false;
    88468913    }
     8914    if (!psMetadataAdd(md, PS_LIST_TAIL, "solang_min", PS_DATA_F32, NULL, object->solang_min)) {
     8915        psError(PS_ERR_UNKNOWN, false, "failed to add item solang_min");
     8916        psFree(md);
     8917        return false;
     8918    }
     8919    if (!psMetadataAdd(md, PS_LIST_TAIL, "solang_max", PS_DATA_F32, NULL, object->solang_max)) {
     8920        psError(PS_ERR_UNKNOWN, false, "failed to add item solang_max");
     8921        psFree(md);
     8922        return false;
     8923    }
     8924    if (!psMetadataAdd(md, PS_LIST_TAIL, "label", PS_DATA_STRING, NULL, object->label)) {
     8925        psError(PS_ERR_UNKNOWN, false, "failed to add item label");
     8926        psFree(md);
     8927        return false;
     8928    }
     8929    if (!psMetadataAdd(md, PS_LIST_TAIL, "parent", PS_DATA_S32, NULL, object->parent)) {
     8930        psError(PS_ERR_UNKNOWN, false, "failed to add item parent");
     8931        psFree(md);
     8932        return false;
     8933    }
    88478934
    88488935
     
    89699056        return false;
    89709057    }
    8971 
    8972     return detRunRowAlloc(det_id, iteration, det_type, mode, state, workdir, camera, telescope, exp_type, filter, airmass_min, airmass_max, exp_time_min, exp_time_max, ccd_temp_min, ccd_temp_max, posang_min, posang_max, registered, time_begin, time_end, use_begin, use_end);
     9058    psF32 solang_min = psMetadataLookupF32(&status, md, "solang_min");
     9059    if (!status) {
     9060        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item solang_min");
     9061        return false;
     9062    }
     9063    psF32 solang_max = psMetadataLookupF32(&status, md, "solang_max");
     9064    if (!status) {
     9065        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item solang_max");
     9066        return false;
     9067    }
     9068    char* label = psMetadataLookupPtr(&status, md, "label");
     9069    if (!status) {
     9070        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item label");
     9071        return false;
     9072    }
     9073    psS32 parent = psMetadataLookupS32(&status, md, "parent");
     9074    if (!status) {
     9075        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item parent");
     9076        return false;
     9077    }
     9078
     9079    return detRunRowAlloc(det_id, iteration, det_type, mode, state, workdir, camera, telescope, exp_type, filter, airmass_min, airmass_max, exp_time_min, exp_time_max, ccd_temp_min, ccd_temp_max, posang_min, posang_max, registered, time_begin, time_end, use_begin, use_end, solang_min, solang_max, label, parent);
    89739080}
    89749081psArray *detRunSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
     
    1385513962        return false;
    1385613963    }
    13857     if (!psMetadataAdd(md, PS_LIST_TAIL, "p3_version", PS_DATA_S32, "Primary Key", 0)) {
     13964    if (!psMetadataAdd(md, PS_LIST_TAIL, "p3_version", PS_DATA_S32, "Key", 0)) {
    1385813965        psError(PS_ERR_UNKNOWN, false, "failed to add item p3_version");
    1385913966        psFree(md);
    1386013967        return false;
    1386113968    }
    13862     if (!psMetadataAdd(md, PS_LIST_TAIL, "magiced", PS_DATA_BOOL, "Primary Key", 0)) {
     13969    if (!psMetadataAdd(md, PS_LIST_TAIL, "magiced", PS_DATA_BOOL, "Key", 0)) {
    1386313970        psError(PS_ERR_UNKNOWN, false, "failed to add item magiced");
    1386413971        psFree(md);
     
    1458614693        return false;
    1458714694    }
    14588     if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_tag", PS_DATA_STRING, "Primary Key", "64")) {
     14695    if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_tag", PS_DATA_STRING, "Key", "64")) {
    1458914696        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
    1459014697        psFree(md);
    1459114698        return false;
    1459214699    }
    14593     if (!psMetadataAdd(md, PS_LIST_TAIL, "p3_version", PS_DATA_S32, "Primary Key", 0)) {
     14700    if (!psMetadataAdd(md, PS_LIST_TAIL, "p3_version", PS_DATA_S32, "Key", 0)) {
    1459414701        psError(PS_ERR_UNKNOWN, false, "failed to add item p3_version");
    1459514702        psFree(md);
     
    1530415411static void p5InputScfileRowFree(p5InputScfileRow *object);
    1530515412
    15306 p5InputScfileRow *p5InputScfileRowAlloc(psS32 p5_id, psS32 p4_id, const char *skycell_id, const char *tess_id, const char *exp_tag, psS32 p3_version, const char *kind, bool template)
     15413p5InputScfileRow *p5InputScfileRowAlloc(psS32 p5_id, psS32 p4_id, const char *skycell_id, const char *tess_id, const char *kind, bool template)
    1530715414{
    1530815415    p5InputScfileRow *_object;
     
    1531515422    _object->skycell_id = psStringCopy(skycell_id);
    1531615423    _object->tess_id = psStringCopy(tess_id);
    15317     _object->exp_tag = psStringCopy(exp_tag);
    15318     _object->p3_version = p3_version;
    1531915424    _object->kind = psStringCopy(kind);
    1532015425    _object->template = template;
     
    1532715432    psFree(object->skycell_id);
    1532815433    psFree(object->tess_id);
    15329     psFree(object->exp_tag);
    1533015434    psFree(object->kind);
    1533115435}
     
    1535415458        return false;
    1535515459    }
    15356     if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_tag", PS_DATA_STRING, "Primary Key", "64")) {
    15357         psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
    15358         psFree(md);
    15359         return false;
    15360     }
    15361     if (!psMetadataAdd(md, PS_LIST_TAIL, "p3_version", PS_DATA_S32, "Primary Key", 0)) {
    15362         psError(PS_ERR_UNKNOWN, false, "failed to add item p3_version");
    15363         psFree(md);
    15364         return false;
    15365     }
    1536615460    if (!psMetadataAdd(md, PS_LIST_TAIL, "kind", PS_DATA_STRING, "Key", "64")) {
    1536715461        psError(PS_ERR_UNKNOWN, false, "failed to add item kind");
     
    1538715481}
    1538815482
    15389 bool p5InputScfileInsert(psDB * dbh, psS32 p5_id, psS32 p4_id, const char *skycell_id, const char *tess_id, const char *exp_tag, psS32 p3_version, const char *kind, bool template)
     15483bool p5InputScfileInsert(psDB * dbh, psS32 p5_id, psS32 p4_id, const char *skycell_id, const char *tess_id, const char *kind, bool template)
    1539015484{
    1539115485    psMetadata *md = psMetadataAlloc();
     
    1540715501    if (!psMetadataAdd(md, PS_LIST_TAIL, "tess_id", PS_DATA_STRING, NULL, tess_id)) {
    1540815502        psError(PS_ERR_UNKNOWN, false, "failed to add item tess_id");
    15409         psFree(md);
    15410         return false;
    15411     }
    15412     if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_tag", PS_DATA_STRING, NULL, exp_tag)) {
    15413         psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
    15414         psFree(md);
    15415         return false;
    15416     }
    15417     if (!psMetadataAdd(md, PS_LIST_TAIL, "p3_version", PS_DATA_S32, NULL, p3_version)) {
    15418         psError(PS_ERR_UNKNOWN, false, "failed to add item p3_version");
    1541915503        psFree(md);
    1542015504        return false;
     
    1545315537bool p5InputScfileInsertObject(psDB *dbh, p5InputScfileRow *object)
    1545415538{
    15455     return p5InputScfileInsert(dbh, object->p5_id, object->p4_id, object->skycell_id, object->tess_id, object->exp_tag, object->p3_version, object->kind, object->template);
     15539    return p5InputScfileInsert(dbh, object->p5_id, object->p4_id, object->skycell_id, object->tess_id, object->kind, object->template);
    1545615540}
    1545715541
     
    1554615630        return false;
    1554715631    }
    15548     if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_tag", PS_DATA_STRING, NULL, object->exp_tag)) {
    15549         psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
    15550         psFree(md);
    15551         return false;
    15552     }
    15553     if (!psMetadataAdd(md, PS_LIST_TAIL, "p3_version", PS_DATA_S32, NULL, object->p3_version)) {
    15554         psError(PS_ERR_UNKNOWN, false, "failed to add item p3_version");
    15555         psFree(md);
    15556         return false;
    15557     }
    1555815632    if (!psMetadataAdd(md, PS_LIST_TAIL, "kind", PS_DATA_STRING, NULL, object->kind)) {
    1555915633        psError(PS_ERR_UNKNOWN, false, "failed to add item kind");
     
    1559515669        return false;
    1559615670    }
    15597     char* exp_tag = psMetadataLookupPtr(&status, md, "exp_tag");
    15598     if (!status) {
    15599         psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_tag");
    15600         return false;
    15601     }
    15602     psS32 p3_version = psMetadataLookupS32(&status, md, "p3_version");
    15603     if (!status) {
    15604         psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p3_version");
    15605         return false;
    15606     }
    1560715671    char* kind = psMetadataLookupPtr(&status, md, "kind");
    1560815672    if (!status) {
     
    1561615680    }
    1561715681
    15618     return p5InputScfileRowAlloc(p5_id, p4_id, skycell_id, tess_id, exp_tag, p3_version, kind, template);
     15682    return p5InputScfileRowAlloc(p5_id, p4_id, skycell_id, tess_id, kind, template);
    1561915683}
    1562015684psArray *p5InputScfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
     
    1610716171    return true;
    1610816172}
     16173static void p6RunRowFree(p6RunRow *object);
     16174
     16175p6RunRow *p6RunRowAlloc(psS32 p6_id, const char *state, const char *workdir, psTime* registered)
     16176{
     16177    p6RunRow        *_object;
     16178
     16179    _object = psAlloc(sizeof(p6RunRow));
     16180    psMemSetDeallocator(_object, (psFreeFunc)p6RunRowFree);
     16181
     16182    _object->p6_id = p6_id;
     16183    _object->state = psStringCopy(state);
     16184    _object->workdir = psStringCopy(workdir);
     16185    _object->registered = psTimeCopy(registered);
     16186
     16187    return _object;
     16188}
     16189
     16190static void p6RunRowFree(p6RunRow *object)
     16191{
     16192    psFree(object->state);
     16193    psFree(object->workdir);
     16194    psFree(object->registered);
     16195}
     16196
     16197bool p6RunCreateTable(psDB *dbh)
     16198{
     16199    psMetadata *md = psMetadataAlloc();
     16200    if (!psMetadataAdd(md, PS_LIST_TAIL, "p6_id", PS_DATA_S32, "Primary Key AUTO_INCREMENT", 0)) {
     16201        psError(PS_ERR_UNKNOWN, false, "failed to add item p6_id");
     16202        psFree(md);
     16203        return false;
     16204    }
     16205    if (!psMetadataAdd(md, PS_LIST_TAIL, "state", PS_DATA_STRING, "Key", "64")) {
     16206        psError(PS_ERR_UNKNOWN, false, "failed to add item state");
     16207        psFree(md);
     16208        return false;
     16209    }
     16210    if (!psMetadataAdd(md, PS_LIST_TAIL, "workdir", PS_DATA_STRING, NULL, "255")) {
     16211        psError(PS_ERR_UNKNOWN, false, "failed to add item workdir");
     16212        psFree(md);
     16213        return false;
     16214    }
     16215    if (!psMetadataAdd(md, PS_LIST_TAIL, "registered", PS_DATA_TIME, NULL, NULL)) {
     16216        psError(PS_ERR_UNKNOWN, false, "failed to add item registered");
     16217        psFree(md);
     16218        return false;
     16219    }
     16220
     16221    bool status = psDBCreateTable(dbh, P6RUN_TABLE_NAME, md);
     16222
     16223    psFree(md);
     16224
     16225    return status;
     16226}
     16227
     16228bool p6RunDropTable(psDB *dbh)
     16229{
     16230    return psDBDropTable(dbh, P6RUN_TABLE_NAME);
     16231}
     16232
     16233bool p6RunInsert(psDB * dbh, psS32 p6_id, const char *state, const char *workdir, psTime* registered)
     16234{
     16235    psMetadata *md = psMetadataAlloc();
     16236    if (!psMetadataAdd(md, PS_LIST_TAIL, "p6_id", PS_DATA_S32, NULL, p6_id)) {
     16237        psError(PS_ERR_UNKNOWN, false, "failed to add item p6_id");
     16238        psFree(md);
     16239        return false;
     16240    }
     16241    if (!psMetadataAdd(md, PS_LIST_TAIL, "state", PS_DATA_STRING, NULL, state)) {
     16242        psError(PS_ERR_UNKNOWN, false, "failed to add item state");
     16243        psFree(md);
     16244        return false;
     16245    }
     16246    if (!psMetadataAdd(md, PS_LIST_TAIL, "workdir", PS_DATA_STRING, NULL, workdir)) {
     16247        psError(PS_ERR_UNKNOWN, false, "failed to add item workdir");
     16248        psFree(md);
     16249        return false;
     16250    }
     16251    if (!psMetadataAdd(md, PS_LIST_TAIL, "registered", PS_DATA_TIME, NULL, registered)) {
     16252        psError(PS_ERR_UNKNOWN, false, "failed to add item registered");
     16253        psFree(md);
     16254        return false;
     16255    }
     16256
     16257    bool status = psDBInsertOneRow(dbh, P6RUN_TABLE_NAME, md);
     16258    psFree(md);
     16259
     16260    return status;
     16261}
     16262
     16263long long p6RunDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)
     16264{
     16265    long long       deleted = 0;
     16266
     16267    long long count = psDBDeleteRows(dbh, P6RUN_TABLE_NAME, where, limit);
     16268    if (count < 0) {
     16269        psError(PS_ERR_UNKNOWN, true, "failed to delete row from p6Run");
     16270        return count;
     16271
     16272        deleted += count;
     16273    }
     16274
     16275    return deleted;
     16276}
     16277bool p6RunInsertObject(psDB *dbh, p6RunRow *object)
     16278{
     16279    return p6RunInsert(dbh, object->p6_id, object->state, object->workdir, object->registered);
     16280}
     16281
     16282bool p6RunInsertObjects(psDB *dbh, psArray *objects)
     16283{
     16284    for (long i = 0; i < psArrayLength(objects); i++) {
     16285        if (!p6RunInsertObject(dbh, objects->data[i])) {
     16286            return false;
     16287        }
     16288    }
     16289
     16290    return true;
     16291}
     16292
     16293bool p6RunInsertFits(psDB *dbh, const psFits *fits)
     16294{
     16295    psArray         *rowSet;
     16296
     16297    // move to (the first?) extension named  P6RUN_TABLE_NAME
     16298    if (!psFitsMoveExtName(fits, P6RUN_TABLE_NAME)) {
     16299        psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P6RUN_TABLE_NAME);
     16300        return false;
     16301    }
     16302
     16303    // check HDU type
     16304    if (psFitsGetExtType(fits) != PS_FITS_TYPE_BINARY_TABLE)  {
     16305        psError(PS_ERR_UNKNOWN, true, "FITS HDU type is not PS_FITS_TYPE_BINARY_TABLE");
     16306        return false;
     16307    }
     16308
     16309    // read fits table
     16310    rowSet = psFitsReadTable(fits);
     16311    if (!rowSet) {
     16312        psError(PS_ERR_UNKNOWN, true, "FITS read error or FITS table is empty");
     16313        psFree(rowSet);
     16314        return false;
     16315    }
     16316
     16317    if (!psDBInsertRows(dbh, P6RUN_TABLE_NAME, rowSet)) {
     16318        psError(PS_ERR_UNKNOWN, false, "databse insert failed");
     16319        psFree(rowSet);
     16320        return false;
     16321    }
     16322
     16323    psFree(rowSet);
     16324
     16325    return true;
     16326}
     16327
     16328bool p6RunSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)
     16329{
     16330    psArray         *rowSet;
     16331
     16332    rowSet = psDBSelectRows(dbh, P6RUN_TABLE_NAME, where, limit);
     16333    if (!rowSet) {
     16334        return false;
     16335    }
     16336
     16337    // output to fits
     16338    if (!psFitsWriteTable(fits, NULL, rowSet, P6RUN_TABLE_NAME)) {
     16339        psError(PS_ERR_UNKNOWN, false, "FITS table write failed");
     16340        psFree(rowSet);
     16341        return false;
     16342    }
     16343
     16344    psFree(rowSet);
     16345
     16346    return true;
     16347}
     16348
     16349psMetadata *p6RunMetadataFromObject(const p6RunRow *object)
     16350{
     16351    psMetadata *md = psMetadataAlloc();
     16352    if (!psMetadataAdd(md, PS_LIST_TAIL, "p6_id", PS_DATA_S32, NULL, object->p6_id)) {
     16353        psError(PS_ERR_UNKNOWN, false, "failed to add item p6_id");
     16354        psFree(md);
     16355        return false;
     16356    }
     16357    if (!psMetadataAdd(md, PS_LIST_TAIL, "state", PS_DATA_STRING, NULL, object->state)) {
     16358        psError(PS_ERR_UNKNOWN, false, "failed to add item state");
     16359        psFree(md);
     16360        return false;
     16361    }
     16362    if (!psMetadataAdd(md, PS_LIST_TAIL, "workdir", PS_DATA_STRING, NULL, object->workdir)) {
     16363        psError(PS_ERR_UNKNOWN, false, "failed to add item workdir");
     16364        psFree(md);
     16365        return false;
     16366    }
     16367    if (!psMetadataAdd(md, PS_LIST_TAIL, "registered", PS_DATA_TIME, NULL, object->registered)) {
     16368        psError(PS_ERR_UNKNOWN, false, "failed to add item registered");
     16369        psFree(md);
     16370        return false;
     16371    }
     16372
     16373
     16374    return md;
     16375}
     16376
     16377p6RunRow *p6RunObjectFromMetadata(psMetadata *md)
     16378{
     16379
     16380bool status = false;
     16381    psS32 p6_id = psMetadataLookupS32(&status, md, "p6_id");
     16382    if (!status) {
     16383        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p6_id");
     16384        return false;
     16385    }
     16386    char* state = psMetadataLookupPtr(&status, md, "state");
     16387    if (!status) {
     16388        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item state");
     16389        return false;
     16390    }
     16391    char* workdir = psMetadataLookupPtr(&status, md, "workdir");
     16392    if (!status) {
     16393        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item workdir");
     16394        return false;
     16395    }
     16396    psTime* registered = psMetadataLookupPtr(&status, md, "registered");
     16397    if (!status) {
     16398        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item registered");
     16399        return false;
     16400    }
     16401
     16402    return p6RunRowAlloc(p6_id, state, workdir, registered);
     16403}
     16404psArray *p6RunSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
     16405{
     16406    psArray         *rowSet;
     16407    psArray         *returnSet;
     16408    psU64           i;
     16409
     16410    rowSet = psDBSelectRows(dbh, P6RUN_TABLE_NAME, where, limit);
     16411    if (!rowSet) {
     16412        return NULL;
     16413    }
     16414
     16415    // convert psMetadata rows to row objects
     16416
     16417    returnSet = psArrayAllocEmpty(rowSet->n);
     16418
     16419    for (i = 0; i < rowSet->n; i++) {
     16420        p6RunRow *object = p6RunObjectFromMetadata(rowSet->data[i]);
     16421        psArrayAdd(returnSet, 0, object);
     16422        psFree(object);
     16423    }
     16424
     16425    psFree(rowSet);
     16426
     16427    return returnSet;
     16428}
     16429bool p6RunDeleteObject(psDB *dbh, const p6RunRow *object)
     16430{
     16431    psMetadata *where = p6RunMetadataFromObject(object);
     16432    long long count = psDBDeleteRows(dbh, P6RUN_TABLE_NAME, where, 0);
     16433    psFree(where);
     16434    if (count < 0) {
     16435        psError(PS_ERR_UNKNOWN, true, "failed to delete row from p6Run");
     16436        return false;
     16437    }
     16438    if (count > 1) {
     16439        // XXX should this be a psAbort() instead?  It is possible that
     16440        // having an object match multiple rows was by design.
     16441        psError(PS_ERR_UNKNOWN, true, "p6RunRow object matched more then one row.  Check your database schema");
     16442        return false;
     16443    }
     16444
     16445    return true;
     16446}
     16447long long p6RunDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)
     16448{
     16449    long long       deleted = 0;
     16450
     16451    for (long long i = 0; i < objects->n; i++) {
     16452        p6RunRow *object = objects->data[i];
     16453        psMetadata *where = p6RunMetadataFromObject(object);
     16454        long long count = psDBDeleteRows(dbh, P6RUN_TABLE_NAME, where, limit);
     16455        psFree(where);
     16456        if (count < 0) {
     16457            psError(PS_ERR_UNKNOWN, true, "failed to delete row from p6Run");
     16458            return count;
     16459        }
     16460
     16461        deleted += count;
     16462    }
     16463
     16464    return deleted;
     16465}
     16466bool p6RunPrintObjects(FILE *stream, psArray *objects, bool mdcf)
     16467{
     16468    PS_ASSERT_PTR_NON_NULL(objects, false);
     16469
     16470    psMetadata *output = psMetadataAlloc();
     16471    for (long i = 0; i < psArrayLength(objects); i++) {
     16472        psMetadata *md = p6RunMetadataFromObject(objects->data[i]);
     16473        if (!psMetadataAddMetadata(
     16474            output,
     16475            PS_LIST_TAIL,
     16476            P6RUN_TABLE_NAME,
     16477            PS_META_DUPLICATE_OK,
     16478            NULL,
     16479            md
     16480        )) {
     16481            psError(PS_ERR_UNKNOWN, false, "failed to add metadata");
     16482            psFree(md);
     16483            psFree(output);
     16484            return false;
     16485        }
     16486        psFree(md);
     16487    }
     16488
     16489    if (!ippdbPrintMetadataRaw(stream, output, mdcf)) {
     16490        psError(PS_ERR_UNKNOWN, false, "failed to print metadata");
     16491        psFree(output);
     16492    }
     16493    psFree(output);
     16494
     16495    return true;
     16496}
     16497bool p6RunPrintObject(FILE *stream, p6RunRow *object, bool mdcf)
     16498{
     16499    PS_ASSERT_PTR_NON_NULL(object, false);
     16500
     16501    psMetadata *md = p6RunMetadataFromObject(object);
     16502
     16503    if (!ippdbPrintMetadataRaw(stream, md, mdcf)) {
     16504        psError(PS_ERR_UNKNOWN, false, "failed to print metadata");
     16505        psFree(md);
     16506    }
     16507
     16508    psFree(md);
     16509
     16510    return true;
     16511}
  • trunk/ippdb/src/ippdb.h

    r11809 r11820  
    20182018    psF64           posang;
    20192019    char            *object;
     2020    psF32           solang;
    20202021    psS16           fault;
    20212022} rawExpRow;
     
    20482049    psF64           posang,
    20492050    const char      *object,
     2051    psF32           solang,
    20502052    psS16           fault
    20512053);
     
    20992101    psF64           posang,
    21002102    const char      *object,
     2103    psF32           solang,
    21012104    psS16           fault
    21022105);
     
    44174420    psTime*         use_begin;
    44184421    psTime*         use_end;
     4422    psF32           solang_min;
     4423    psF32           solang_max;
     4424    char            *label;
     4425    psS32           parent;
    44194426} detRunRow;
    44204427
     
    44474454    psTime*         time_end,
    44484455    psTime*         use_begin,
    4449     psTime*         use_end
     4456    psTime*         use_end,
     4457    psF32           solang_min,
     4458    psF32           solang_max,
     4459    const char      *label,
     4460    psS32           parent
    44504461);
    44514462
     
    44994510    psTime*         time_end,
    45004511    psTime*         use_begin,
    4501     psTime*         use_end
     4512    psTime*         use_end,
     4513    psF32           solang_min,
     4514    psF32           solang_max,
     4515    const char      *label,
     4516    psS32           parent
    45024517);
    45034518
     
    78817896    char            *skycell_id;
    78827897    char            *tess_id;
    7883     char            *exp_tag;
    7884     psS32           p3_version;
    78857898    char            *kind;
    78867899    bool            template;
     
    78977910    const char      *skycell_id,
    78987911    const char      *tess_id,
    7899     const char      *exp_tag,
    7900     psS32           p3_version,
    79017912    const char      *kind,
    79027913    bool            template
     
    79347945    const char      *skycell_id,
    79357946    const char      *tess_id,
    7936     const char      *exp_tag,
    7937     psS32           p3_version,
    79387947    const char      *kind,
    79397948    bool            template
     
    82978306    bool            mdcf                ///< format as mdconfig or simple
    82988307);
     8308/** p6RunRow data structure
     8309 *
     8310 * Structure for representing a single row of p6Run table data.
     8311 */
     8312
     8313typedef struct {
     8314    psS32           p6_id;
     8315    char            *state;
     8316    char            *workdir;
     8317    psTime*         registered;
     8318} p6RunRow;
     8319
     8320/** Creates a new p6RunRow object
     8321 *
     8322 *  @return A new p6RunRow object or NULL on failure.
     8323 */
     8324
     8325p6RunRow *p6RunRowAlloc(
     8326    psS32           p6_id,
     8327    const char      *state,
     8328    const char      *workdir,
     8329    psTime*         registered
     8330);
     8331
     8332/** Creates a new p6Run table
     8333 *
     8334 * @return true on success
     8335 */
     8336
     8337bool p6RunCreateTable(
     8338    psDB            *dbh                ///< Database handle
     8339);
     8340
     8341/** Deletes a p6Run table
     8342 *
     8343 * @return true on success
     8344 */
     8345
     8346bool p6RunDropTable(
     8347    psDB            *dbh                ///< Database handle
     8348);
     8349
     8350/** Insert a single row into a table
     8351 *
     8352 * This function constructs and inserts a single row based on it's parameters.
     8353 *
     8354 * @return true on success
     8355 */
     8356
     8357bool p6RunInsert(
     8358    psDB            *dbh,               ///< Database handle
     8359    psS32           p6_id,
     8360    const char      *state,
     8361    const char      *workdir,
     8362    psTime*         registered
     8363);
     8364
     8365/** Deletes up to limit rows from the database and returns the number of rows actually deleted.
     8366 *
     8367 * @return A The number of rows removed or a negative value on error
     8368 */
     8369
     8370long long p6RunDelete(
     8371    psDB            *dbh,               ///< Database handle
     8372    const psMetadata *where,            ///< Row match criteria
     8373    unsigned long long limit            ///< Maximum number of elements to delete
     8374);
     8375
     8376/** Insert a single p6RunRow object into a table
     8377 *
     8378 * This function constructs and inserts a single row based on it's parameters.
     8379 *
     8380 * @return true on success
     8381 */
     8382
     8383bool p6RunInsertObject(
     8384    psDB            *dbh,               ///< Database handle
     8385    p6RunRow        *object             ///< p6RunRow object
     8386);
     8387
     8388/** Insert an array of p6RunRow object into a table
     8389 *
     8390 * This function constructs and inserts multiple rows based on it's parameters.
     8391 *
     8392 * @return true on success
     8393 */
     8394
     8395bool p6RunInsertObjects(
     8396    psDB            *dbh,               ///< Database handle
     8397    psArray         *objects            ///< array of p6RunRow objects
     8398);
     8399
     8400/** Insert data from a binary FITS table p6RunRow into the database
     8401 *
     8402 * This function expects a psFits object with a FITS table as the first
     8403 * extension.  The table must have at least one row of data in it, that is of
     8404 * the appropriate format (number of columns and their type).  All other
     8405 * extensions are ignored.
     8406 *
     8407 * @return true on success
     8408 */
     8409
     8410bool p6RunInsertFits(
     8411    psDB            *dbh,               ///< Database handle
     8412    const psFits    *fits               ///< psFits object
     8413);
     8414
     8415/** Selects up to limit from the database and returns them in a binary FITS table
     8416 *
     8417 * This function assumes an empty psFits object and will create a FITS table
     8418 * as the first extension.
     8419 *
     8420 *  See psDBSelectRows() for documentation on the format of where.
     8421 *
     8422 * @return true on success
     8423 */
     8424
     8425bool p6RunSelectRowsFits(
     8426    psDB            *dbh,               ///< Database handle
     8427    psFits          *fits,              ///< psFits object
     8428    const psMetadata *where,            ///< Row match criteria
     8429    unsigned long long limit            ///< Maximum number of elements to return
     8430);
     8431
     8432/** Convert a p6RunRow into an equivalent psMetadata
     8433 *
     8434 * @return A psMetadata pointer or NULL on error
     8435 */
     8436
     8437psMetadata *p6RunMetadataFromObject(
     8438    const p6RunRow  *object             ///< fooRow to convert into a psMetadata
     8439);
     8440
     8441/** Convert a psMetadata into an equivalent fooRow
     8442 *
     8443 * @return A p6RunRow pointer or NULL on error
     8444 */
     8445
     8446p6RunRow *p6RunObjectFromMetadata(
     8447    psMetadata      *md                 ///< psMetadata to convert into a fooRow
     8448);
     8449/** Selects up to limit rows from the database and returns as p6RunRow objects in a psArray
     8450 *
     8451 *  See psDBSelectRows() for documentation on the format of where.
     8452 *
     8453 * @return A psArray pointer or NULL on error
     8454 */
     8455
     8456psArray *p6RunSelectRowObjects(
     8457    psDB            *dbh,               ///< Database handle
     8458    const psMetadata *where,            ///< Row match criteria
     8459    unsigned long long limit            ///< Maximum number of elements to return
     8460);
     8461/** Deletes a row from the database coresponding to an p6Run
     8462 *
     8463 *  Note that a 'where' search psMetadata is constructed from each object and
     8464 *  used to find rows to delete.
     8465 *
     8466 * @return A The number of rows removed or a negative value on error
     8467 */
     8468
     8469bool p6RunDeleteObject(
     8470    psDB            *dbh,               ///< Database handle
     8471    const p6RunRow *object    ///< Object to delete
     8472);
     8473/** Deletes up to limit rows from the database and returns the number of rows actually deleted.
     8474 *
     8475 *  Note that a 'where' search psMetadata is constructed from each object and
     8476 *  used to find rows to delete.
     8477 *
     8478 * @return A The number of rows removed or a negative value on error
     8479 */
     8480
     8481long long p6RunDeleteRowObjects(
     8482    psDB            *dbh,               ///< Database handle
     8483    const psArray   *objects,           ///< Array of objects to delete
     8484    unsigned long long limit            ///< Maximum number of elements to delete
     8485);
     8486/** Formats and prints an array of p6RunRow objects
     8487 *
     8488 * When mdcf is set the formated output is in psMetadataConfig
     8489 * format, otherwise it is in a simple tabular format.
     8490 *
     8491 * @return true on success
     8492 */
     8493
     8494bool p6RunPrintObjects(
     8495    FILE            *stream,            ///< a stream
     8496    psArray         *objects,           ///< An array of p6RunRow objects
     8497    bool            mdcf                ///< format as mdconfig or simple
     8498);
     8499/** Formats and prints an p6RunRow object
     8500 *
     8501 * When mdcf is set the formated output is in psMetadataConfig
     8502 * format, otherwise it is in a simple tabular format.
     8503 *
     8504 * @return true on success
     8505 */
     8506
     8507bool p6RunPrintObject(
     8508    FILE            *stream,            ///< a stream
     8509    p6RunRow *object,    ///< an p6RunRow object
     8510    bool            mdcf                ///< format as mdconfig or simple
     8511);
    82998512
    83008513/// @}
     
    83048517#endif
    83058518
    8306 #endif // P5DIFFSCFILE_DB_H
     8519#endif // P6RUN_DB_H
  • trunk/ippdb/tests/alloc.c

    r11809 r11820  
    311311        rawExpRow       *object;
    312312
    313         object = rawExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, "a string", "a string", 32.32, 64.64, 64.64, 32.32, 64.64, 64.64, 64.64, 64.64, 64.64, 32.32, 64.64, "a string", -16    );
     313        object = rawExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, "a string", "a string", 32.32, 64.64, 64.64, 32.32, 64.64, 64.64, 64.64, 64.64, 64.64, 32.32, 64.64, "a string", 32.32, -16    );
    314314
    315315        if (!object) {
     
    400400            exit(EXIT_FAILURE);
    401401        }
     402        if (!object->solang == 32.32) {
     403            psFree(object);
     404            exit(EXIT_FAILURE);
     405        }
    402406        if (!object->fault == -16) {
    403407            psFree(object);
     
    832836        detRunRow       *object;
    833837
    834         object = detRunRowAlloc(-32, -32, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 64.64, 64.64, "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z"    );
     838        object = detRunRowAlloc(-32, -32, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 64.64, 64.64, "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", 32.32, 32.32, "a string", -32    );
    835839
    836840        if (!object) {
     
    925929            exit(EXIT_FAILURE);
    926930        }
     931        if (!object->solang_min == 32.32) {
     932            psFree(object);
     933            exit(EXIT_FAILURE);
     934        }
     935        if (!object->solang_max == 32.32) {
     936            psFree(object);
     937            exit(EXIT_FAILURE);
     938        }
     939        if (strncmp(object->label, "a string", MAX_STRING_LENGTH)) {
     940            psFree(object);
     941            exit(EXIT_FAILURE);
     942        }
     943        if (!object->parent == -32) {
     944            psFree(object);
     945            exit(EXIT_FAILURE);
     946        }
    927947
    928948        psFree(object);
     
    15811601        p5InputScfileRow *object;
    15821602
    1583         object = p5InputScfileRowAlloc(-32, -32, "a string", "a string", "a string", -32, "a string", true    );
     1603        object = p5InputScfileRowAlloc(-32, -32, "a string", "a string", "a string", true    );
    15841604
    15851605        if (!object) {
     
    16031623            exit(EXIT_FAILURE);
    16041624        }
    1605         if (strncmp(object->exp_tag, "a string", MAX_STRING_LENGTH)) {
    1606             psFree(object);
    1607             exit(EXIT_FAILURE);
    1608         }
    1609         if (!object->p3_version == -32) {
    1610             psFree(object);
    1611             exit(EXIT_FAILURE);
    1612         }
    16131625        if (strncmp(object->kind, "a string", MAX_STRING_LENGTH)) {
    16141626            psFree(object);
     
    16531665        }
    16541666        if (!object->bg_mean_stdev == 64.64) {
     1667            psFree(object);
     1668            exit(EXIT_FAILURE);
     1669        }
     1670
     1671        psFree(object);
     1672    }
     1673
     1674    {
     1675        p6RunRow        *object;
     1676
     1677        object = p6RunRowAlloc(-32, "a string", "a string", "0001-01-01T00:00:00Z"    );
     1678
     1679        if (!object) {
     1680            exit(EXIT_FAILURE);
     1681        }
     1682
     1683        if (!object->p6_id == -32) {
     1684            psFree(object);
     1685            exit(EXIT_FAILURE);
     1686        }
     1687        if (strncmp(object->state, "a string", MAX_STRING_LENGTH)) {
     1688            psFree(object);
     1689            exit(EXIT_FAILURE);
     1690        }
     1691        if (strncmp(object->workdir, "a string", MAX_STRING_LENGTH)) {
     1692            psFree(object);
     1693            exit(EXIT_FAILURE);
     1694        }
    16551695            psFree(object);
    16561696            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/createtable.c

    r11809 r11820  
    575575    }
    576576
     577    {
     578        psDB            *dbh;
     579
     580        dbh = psDBInit("localhost", "test", NULL, "test");
     581        if (!dbh) {
     582            exit(EXIT_FAILURE);
     583        }
     584
     585        if(!p6RunCreateTable(dbh)) {
     586            exit(EXIT_FAILURE);
     587        }
     588
     589        psDBCleanup(dbh);
     590    }
     591
    577592    exit(EXIT_SUCCESS);
    578593}
  • trunk/ippdb/tests/dbcleanup.c

    r11809 r11820  
    4949    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p5InputScfile");
    5050    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p5DiffScfile");
     51    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p6Run");
    5152
    5253    psDBCleanup(dbh);
  • trunk/ippdb/tests/dbsetup.c

    r11809 r11820  
    127127    p5DiffScfileCreateTable(dbh);
    128128
     129    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p6Run");
     130    p6RunCreateTable(dbh);
     131
    129132    psDBCleanup(dbh);
    130133
  • trunk/ippdb/tests/droptable.c

    r11809 r11820  
    575575    }
    576576
     577    {
     578        psDB            *dbh;
     579
     580        dbh = psDBInit("localhost", "test", NULL, "test");
     581        if (!dbh) {
     582            exit(EXIT_FAILURE);
     583        }
     584
     585        if (!p6RunDropTable(dbh)) {
     586            exit(EXIT_FAILURE);
     587        }
     588
     589        psDBCleanup(dbh);
     590    }
     591
    577592    exit(EXIT_SUCCESS);
    578593}
  • trunk/ippdb/tests/insert.c

    r11809 r11820  
    148148        }
    149149
    150         if (!rawExpInsert(dbh, "a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, "a string", "a string", 32.32, 64.64, 64.64, 32.32, 64.64, 64.64, 64.64, 64.64, 64.64, 32.32, 64.64, "a string", -16)) {
     150        if (!rawExpInsert(dbh, "a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, "a string", "a string", 32.32, 64.64, 64.64, 32.32, 64.64, 64.64, 64.64, 64.64, 64.64, 32.32, 64.64, "a string", 32.32, -16)) {
    151151            exit(EXIT_FAILURE);
    152152        }
     
    313313        }
    314314
    315         if (!detRunInsert(dbh, -32, -32, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 64.64, 64.64, "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z")) {
     315        if (!detRunInsert(dbh, -32, -32, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 64.64, 64.64, "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", 32.32, 32.32, "a string", -32)) {
    316316            exit(EXIT_FAILURE);
    317317        }
     
    553553        }
    554554
    555         if (!p5InputScfileInsert(dbh, -32, -32, "a string", "a string", "a string", -32, "a string", true)) {
     555        if (!p5InputScfileInsert(dbh, -32, -32, "a string", "a string", "a string", true)) {
    556556            exit(EXIT_FAILURE);
    557557        }
     
    569569
    570570        if (!p5DiffScfileInsert(dbh, -32, "a string", "a string", "a string", 64.64, 64.64)) {
     571            exit(EXIT_FAILURE);
     572        }
     573
     574        psDBCleanup(dbh);
     575    }
     576
     577    {
     578        psDB            *dbh;
     579
     580        dbh = psDBInit("localhost", "test", NULL, "test");
     581        if (!dbh) {
     582            exit(EXIT_FAILURE);
     583        }
     584
     585        if (!p6RunInsert(dbh, -32, "a string", "a string", "0001-01-01T00:00:00Z")) {
    571586            exit(EXIT_FAILURE);
    572587        }
  • trunk/ippdb/tests/insertfits.c

    r11809 r11820  
    997997    }
    998998
     999    {
     1000        psDB            *dbh;
     1001        psFits          *fits;
     1002
     1003        dbh = psDBInit("localhost", "test", NULL, "test");
     1004        if (!dbh) {
     1005            exit(EXIT_FAILURE);
     1006        }
     1007
     1008        // open a temp
     1009        fits = psFitsOpen(TMP_FILENAME, "r");
     1010        if (!fits) {
     1011            exit(EXIT_FAILURE);
     1012        }
     1013
     1014        if (!p6RunInsertFits(dbh, fits)) {
     1015            exit(EXIT_FAILURE);
     1016        }
     1017
     1018        if (!psFitsClose(fits)) {
     1019            exit(EXIT_FAILURE);
     1020        }
     1021
     1022        psDBCleanup(dbh);
     1023    }
     1024
    9991025    exit(EXIT_SUCCESS);
    10001026}
  • trunk/ippdb/tests/insertobject.c

    r11809 r11820  
    212212        }
    213213
    214         object = rawExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, "a string", "a string", 32.32, 64.64, 64.64, 32.32, 64.64, 64.64, 64.64, 64.64, 64.64, 32.32, 64.64, "a string", -16);
     214        object = rawExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, "a string", "a string", 32.32, 64.64, 64.64, 32.32, 64.64, 64.64, 64.64, 64.64, 64.64, 32.32, 64.64, "a string", 32.32, -16);
    215215        if (!object) {
    216216            exit(EXIT_FAILURE);
     
    454454        }
    455455
    456         object = detRunRowAlloc(-32, -32, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 64.64, 64.64, "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z");
     456        object = detRunRowAlloc(-32, -32, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 64.64, 64.64, "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", 32.32, 32.32, "a string", -32);
    457457        if (!object) {
    458458            exit(EXIT_FAILURE);
     
    806806        }
    807807
    808         object = p5InputScfileRowAlloc(-32, -32, "a string", "a string", "a string", -32, "a string", true);
     808        object = p5InputScfileRowAlloc(-32, -32, "a string", "a string", "a string", true);
    809809        if (!object) {
    810810            exit(EXIT_FAILURE);
     
    834834
    835835        if (!p5DiffScfileInsertObject(dbh, object)) {
     836            exit(EXIT_FAILURE);
     837        }
     838
     839        psFree(object);
     840        psDBCleanup(dbh);
     841    }
     842
     843    {
     844        psDB            *dbh;
     845        p6RunRow        *object;
     846
     847        dbh = psDBInit("localhost", "test", NULL, "test");
     848        if (!dbh) {
     849            exit(EXIT_FAILURE);
     850        }
     851
     852        object = p6RunRowAlloc(-32, "a string", "a string", "0001-01-01T00:00:00Z");
     853        if (!object) {
     854            exit(EXIT_FAILURE);
     855        }
     856
     857        if (!p6RunInsertObject(dbh, object)) {
    836858            exit(EXIT_FAILURE);
    837859        }
  • trunk/ippdb/tests/metadatafromobject.c

    r11809 r11820  
    384384        bool            status;
    385385
    386         object = rawExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, "a string", "a string", 32.32, 64.64, 64.64, 32.32, 64.64, 64.64, 64.64, 64.64, 64.64, 32.32, 64.64, "a string", -16);
     386        object = rawExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, "a string", "a string", 32.32, 64.64, 64.64, 32.32, 64.64, 64.64, 64.64, 64.64, 64.64, 32.32, 64.64, "a string", 32.32, -16);
    387387        if (!object) {
    388388            exit(EXIT_FAILURE);
     
    479479            exit(EXIT_FAILURE);
    480480        }
     481        if (!psMetadataLookupF32(&status, md, "solang") == 32.32) {
     482            psFree(md);
     483            exit(EXIT_FAILURE);
     484        }
    481485            psFree(md);
    482486            exit(EXIT_FAILURE);
     
    989993        bool            status;
    990994
    991         object = detRunRowAlloc(-32, -32, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 64.64, 64.64, "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z");
     995        object = detRunRowAlloc(-32, -32, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 64.64, 64.64, "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", 32.32, 32.32, "a string", -32);
    992996        if (!object) {
    993997            exit(EXIT_FAILURE);
     
    10881092            exit(EXIT_FAILURE);
    10891093        }
     1094        if (!psMetadataLookupF32(&status, md, "solang_min") == 32.32) {
     1095            psFree(md);
     1096            exit(EXIT_FAILURE);
     1097        }
     1098        if (!psMetadataLookupF32(&status, md, "solang_max") == 32.32) {
     1099            psFree(md);
     1100            exit(EXIT_FAILURE);
     1101        }
     1102        if (strncmp(psMetadataLookupPtr(&status, md, "label"), "a string", MAX_STRING_LENGTH)) {
     1103            psFree(md);
     1104            exit(EXIT_FAILURE);
     1105        }
     1106        if (!psMetadataLookupS32(&status, md, "parent") == -32) {
     1107            psFree(md);
     1108            exit(EXIT_FAILURE);
     1109        }
    10901110
    10911111        psFree(md);
     
    18571877        bool            status;
    18581878
    1859         object = p5InputScfileRowAlloc(-32, -32, "a string", "a string", "a string", -32, "a string", true);
     1879        object = p5InputScfileRowAlloc(-32, -32, "a string", "a string", "a string", true);
    18601880        if (!object) {
    18611881            exit(EXIT_FAILURE);
     
    18851905            exit(EXIT_FAILURE);
    18861906        }
    1887         if (strncmp(psMetadataLookupPtr(&status, md, "exp_tag"), "a string", MAX_STRING_LENGTH)) {
    1888             psFree(md);
    1889             exit(EXIT_FAILURE);
    1890         }
    1891         if (!psMetadataLookupS32(&status, md, "p3_version") == -32) {
    1892             psFree(md);
    1893             exit(EXIT_FAILURE);
    1894         }
    18951907        if (strncmp(psMetadataLookupPtr(&status, md, "kind"), "a string", MAX_STRING_LENGTH)) {
    18961908            psFree(md);
     
    19431955        }
    19441956        if (!psMetadataLookupF64(&status, md, "bg_mean_stdev") == 64.64) {
     1957            psFree(md);
     1958            exit(EXIT_FAILURE);
     1959        }
     1960
     1961        psFree(md);
     1962    }
     1963
     1964    {
     1965        psMetadata      *md;
     1966        p6RunRow        *object;
     1967        bool            status;
     1968
     1969        object = p6RunRowAlloc(-32, "a string", "a string", "0001-01-01T00:00:00Z");
     1970        if (!object) {
     1971            exit(EXIT_FAILURE);
     1972        }
     1973
     1974        md = p6RunMetadataFromObject(object);
     1975        if (!md) {
     1976            exit(EXIT_FAILURE);
     1977        }
     1978
     1979        psFree(object);
     1980
     1981        if (!psMetadataLookupS32(&status, md, "p6_id") == -32) {
     1982            psFree(md);
     1983            exit(EXIT_FAILURE);
     1984        }
     1985        if (strncmp(psMetadataLookupPtr(&status, md, "state"), "a string", MAX_STRING_LENGTH)) {
     1986            psFree(md);
     1987            exit(EXIT_FAILURE);
     1988        }
     1989        if (strncmp(psMetadataLookupPtr(&status, md, "workdir"), "a string", MAX_STRING_LENGTH)) {
     1990            psFree(md);
     1991            exit(EXIT_FAILURE);
     1992        }
    19451993            psFree(md);
    19461994            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/objectfrommetadata.c

    r11809 r11820  
    622622            exit(EXIT_FAILURE);
    623623        }
     624        if (!psMetadataAddF32(md, PS_LIST_TAIL, "solang", 0, NULL, 32.32)) {
     625            psFree(md);
     626            exit(EXIT_FAILURE);
     627        }
    624628            psFree(md);
    625629            exit(EXIT_FAILURE);
     
    717721            exit(EXIT_FAILURE);
    718722        }
     723        if (!object->solang == 32.32) {
     724            psFree(object);
     725            exit(EXIT_FAILURE);
     726        }
    719727            psFree(object);
    720728            exit(EXIT_FAILURE);
     
    15721580            exit(EXIT_FAILURE);
    15731581        }
     1582        if (!psMetadataAddF32(md, PS_LIST_TAIL, "solang_min", 0, NULL, 32.32)) {
     1583            psFree(md);
     1584            exit(EXIT_FAILURE);
     1585        }
     1586        if (!psMetadataAddF32(md, PS_LIST_TAIL, "solang_max", 0, NULL, 32.32)) {
     1587            psFree(md);
     1588            exit(EXIT_FAILURE);
     1589        }
     1590        if (!psMetadataAddStr(md, PS_LIST_TAIL, "label", 0, NULL, "a string")) {
     1591            psFree(md);
     1592            exit(EXIT_FAILURE);
     1593        }
     1594        if (!psMetadataAddS32(md, PS_LIST_TAIL, "parent", 0, NULL, -32)) {
     1595            psFree(md);
     1596            exit(EXIT_FAILURE);
     1597        }
    15741598
    15751599        object = detRunObjectFromMetadata(md);
     
    16681692            exit(EXIT_FAILURE);
    16691693        }
     1694        if (!object->solang_min == 32.32) {
     1695            psFree(object);
     1696            exit(EXIT_FAILURE);
     1697        }
     1698        if (!object->solang_max == 32.32) {
     1699            psFree(object);
     1700            exit(EXIT_FAILURE);
     1701        }
     1702        if (strncmp(object->label, "a string", MAX_STRING_LENGTH)) {
     1703            psFree(object);
     1704            exit(EXIT_FAILURE);
     1705        }
     1706        if (!object->parent == -32) {
     1707            psFree(object);
     1708            exit(EXIT_FAILURE);
     1709        }
    16701710
    16711711        psFree(object);
     
    28532893            exit(EXIT_FAILURE);
    28542894        }
    2855         if (!psMetadataAddStr(md, PS_LIST_TAIL, "exp_tag", 0, NULL, "a string")) {
    2856             psFree(md);
    2857             exit(EXIT_FAILURE);
    2858         }
    2859         if (!psMetadataAddS32(md, PS_LIST_TAIL, "p3_version", 0, NULL, -32)) {
    2860             psFree(md);
    2861             exit(EXIT_FAILURE);
    2862         }
    28632895        if (!psMetadataAddStr(md, PS_LIST_TAIL, "kind", 0, NULL, "a string")) {
    28642896            psFree(md);
     
    28942926            exit(EXIT_FAILURE);
    28952927        }
    2896         if (strncmp(object->exp_tag, "a string", MAX_STRING_LENGTH)) {
    2897             psFree(object);
    2898             exit(EXIT_FAILURE);
    2899         }
    2900         if (!object->p3_version == -32) {
    2901             psFree(object);
    2902             exit(EXIT_FAILURE);
    2903         }
    29042928        if (strncmp(object->kind, "a string", MAX_STRING_LENGTH)) {
    29052929            psFree(object);
     
    29732997        }
    29742998        if (!object->bg_mean_stdev == 64.64) {
     2999            psFree(object);
     3000            exit(EXIT_FAILURE);
     3001        }
     3002
     3003        psFree(object);
     3004    }
     3005
     3006    {
     3007        psMetadata      *md;
     3008        p6RunRow        *object;
     3009
     3010        md = psMetadataAlloc();
     3011        if (!psMetadataAddS32(md, PS_LIST_TAIL, "p6_id", 0, NULL, -32)) {
     3012            psFree(md);
     3013            exit(EXIT_FAILURE);
     3014        }
     3015        if (!psMetadataAddStr(md, PS_LIST_TAIL, "state", 0, NULL, "a string")) {
     3016            psFree(md);
     3017            exit(EXIT_FAILURE);
     3018        }
     3019        if (!psMetadataAddStr(md, PS_LIST_TAIL, "workdir", 0, NULL, "a string")) {
     3020            psFree(md);
     3021            exit(EXIT_FAILURE);
     3022        }
     3023            psFree(md);
     3024            exit(EXIT_FAILURE);
     3025        }
     3026
     3027        object = p6RunObjectFromMetadata(md);
     3028        if (!object) {
     3029            psFree(md);
     3030            exit(EXIT_FAILURE);
     3031        }
     3032
     3033        psFree(md);
     3034
     3035        if (!object->p6_id == -32) {
     3036            psFree(object);
     3037            exit(EXIT_FAILURE);
     3038        }
     3039        if (strncmp(object->state, "a string", MAX_STRING_LENGTH)) {
     3040            psFree(object);
     3041            exit(EXIT_FAILURE);
     3042        }
     3043        if (strncmp(object->workdir, "a string", MAX_STRING_LENGTH)) {
     3044            psFree(object);
     3045            exit(EXIT_FAILURE);
     3046        }
    29753047            psFree(object);
    29763048            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/selectrowsfits.c

    r11809 r11820  
    843843    }
    844844
     845    {
     846        psDB            *dbh;
     847        psFits          *fits;
     848
     849        dbh = psDBInit("localhost", "test", NULL, "test");
     850        if (!dbh) {
     851            exit(EXIT_FAILURE);
     852        }
     853
     854        fits = psFitsOpen(TMP_FILENAME, "w");
     855        if (!fits) {
     856            exit(EXIT_FAILURE);
     857        }
     858
     859        if (!p6RunSelectRowsFits(dbh, fits, NULL, 1)) {
     860            exit(EXIT_FAILURE);
     861        }
     862
     863        psFree(fits);
     864        psDBCleanup(dbh);
     865    }
     866
    845867    exit(EXIT_SUCCESS);
    846868}
Note: See TracChangeset for help on using the changeset viewer.