IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 18595


Ignore:
Timestamp:
Jul 17, 2008, 10:15:51 AM (18 years ago)
Author:
eugene
Message:

updates to magictool and pstamp

Location:
trunk/ippdb
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippdb/Makefile.am

    r18044 r18595  
    5858    $(top_builddir)/docs/man/man3/magicNodeResultRow.3 \
    5959    $(top_builddir)/docs/man/man3/magicMaskRow.3 \
    60     $(top_builddir)/docs/man/man3/magicSkyfileMaskRow.3 \
    6160    $(top_builddir)/docs/man/man3/calDBRow.3 \
    6261    $(top_builddir)/docs/man/man3/calRunRow.3 \
     
    6867
    6968
    70 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/fakeRunRow.3 docs/man/man3/fakeProcessedImfileRow.3 docs/man/man3/fakeMaskRow.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:
     69docs/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/fakeRunRow.3 docs/man/man3/fakeProcessedImfileRow.3 docs/man/man3/fakeMaskRow.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/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:
    7170        $(DOXYGEN)
    7271
  • trunk/ippdb/src/ippdb.c

    r18044 r18595  
    7979#define MAGICNODERESULT_TABLE_NAME "magicNodeResult"
    8080#define MAGICMASK_TABLE_NAME "magicMask"
    81 #define MAGICSKYFILEMASK_TABLE_NAME "magicSkyfileMask"
    8281#define CALDB_TABLE_NAME "calDB"
    8382#define CALRUN_TABLE_NAME "calRun"
     
    1407514074static void stackRunRowFree(stackRunRow *object);
    1407614075
    14077 stackRunRow *stackRunRowAlloc(psS64 stack_id, const char *state, const char *workdir, const char *dvodb, psTime* registered, const char *skycell_id, const char *tess_id)
     14076stackRunRow *stackRunRowAlloc(psS64 stack_id, const char *state, const char *workdir, const char *dvodb, psTime* registered, const char *skycell_id, const char *tess_id, const char *filter)
    1407814077{
    1407914078    stackRunRow     *_object;
     
    1408914088    _object->skycell_id = psStringCopy(skycell_id);
    1409014089    _object->tess_id = psStringCopy(tess_id);
     14090    _object->filter = psStringCopy(filter);
    1409114091
    1409214092    return _object;
     
    1410114101    psFree(object->skycell_id);
    1410214102    psFree(object->tess_id);
     14103    psFree(object->filter);
    1410314104}
    1410414105
     
    1414114142        return false;
    1414214143    }
     14144    if (!psMetadataAdd(md, PS_LIST_TAIL, "filter", PS_DATA_STRING, NULL, "64")) {
     14145        psError(PS_ERR_UNKNOWN, false, "failed to add item filter");
     14146        psFree(md);
     14147        return false;
     14148    }
    1414314149
    1414414150    bool status = psDBCreateTable(dbh, STACKRUN_TABLE_NAME, md);
     
    1415414160}
    1415514161
    14156 bool stackRunInsert(psDB * dbh, psS64 stack_id, const char *state, const char *workdir, const char *dvodb, psTime* registered, const char *skycell_id, const char *tess_id)
     14162bool stackRunInsert(psDB * dbh, psS64 stack_id, const char *state, const char *workdir, const char *dvodb, psTime* registered, const char *skycell_id, const char *tess_id, const char *filter)
    1415714163{
    1415814164    psMetadata *md = psMetadataAlloc();
     
    1418914195    if (!psMetadataAdd(md, PS_LIST_TAIL, "tess_id", PS_DATA_STRING, NULL, tess_id)) {
    1419014196        psError(PS_ERR_UNKNOWN, false, "failed to add item tess_id");
     14197        psFree(md);
     14198        return false;
     14199    }
     14200    if (!psMetadataAdd(md, PS_LIST_TAIL, "filter", PS_DATA_STRING, NULL, filter)) {
     14201        psError(PS_ERR_UNKNOWN, false, "failed to add item filter");
    1419114202        psFree(md);
    1419214203        return false;
     
    1421514226bool stackRunInsertObject(psDB *dbh, stackRunRow *object)
    1421614227{
    14217     return stackRunInsert(dbh, object->stack_id, object->state, object->workdir, object->dvodb, object->registered, object->skycell_id, object->tess_id);
     14228    return stackRunInsert(dbh, object->stack_id, object->state, object->workdir, object->dvodb, object->registered, object->skycell_id, object->tess_id, object->filter);
    1421814229}
    1421914230
     
    1432314334        return false;
    1432414335    }
     14336    if (!psMetadataAdd(md, PS_LIST_TAIL, "filter", PS_DATA_STRING, NULL, object->filter)) {
     14337        psError(PS_ERR_UNKNOWN, false, "failed to add item filter");
     14338        psFree(md);
     14339        return false;
     14340    }
    1432514341
    1432614342
     
    1436714383        return false;
    1436814384    }
    14369 
    14370     return stackRunRowAlloc(stack_id, state, workdir, dvodb, registered, skycell_id, tess_id);
     14385    char* filter = psMetadataLookupPtr(&status, md, "filter");
     14386    if (!status) {
     14387        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item filter");
     14388        return false;
     14389    }
     14390
     14391    return stackRunRowAlloc(stack_id, state, workdir, dvodb, registered, skycell_id, tess_id, filter);
    1437114392}
    1437214393psArray *stackRunSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
     
    2303223053static void magicRunRowFree(magicRunRow *object);
    2303323054
    23034 magicRunRow *magicRunRowAlloc(psS64 magic_id, const char *state, const char *workdir, const char *workdir_state, const char *label, const char *dvodb, psTime* registered)
     23055magicRunRow *magicRunRowAlloc(psS64 magic_id, const char *state, const char *workdir, const char *workdir_state, const char *label, const char *dvodb, psTime* registered, psS16 fault)
    2303523056{
    2303623057    magicRunRow     *_object;
     
    2304623067    _object->dvodb = psStringCopy(dvodb);
    2304723068    _object->registered = psTimeCopy(registered);
     23069    _object->fault = fault;
    2304823070
    2304923071    return _object;
     
    2309823120        return false;
    2309923121    }
     23122    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, "Key", 0)) {
     23123        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
     23124        psFree(md);
     23125        return false;
     23126    }
    2310023127
    2310123128    bool status = psDBCreateTable(dbh, MAGICRUN_TABLE_NAME, md);
     
    2311123138}
    2311223139
    23113 bool magicRunInsert(psDB * dbh, psS64 magic_id, const char *state, const char *workdir, const char *workdir_state, const char *label, const char *dvodb, psTime* registered)
     23140bool magicRunInsert(psDB * dbh, psS64 magic_id, const char *state, const char *workdir, const char *workdir_state, const char *label, const char *dvodb, psTime* registered, psS16 fault)
    2311423141{
    2311523142    psMetadata *md = psMetadataAlloc();
     
    2314623173    if (!psMetadataAdd(md, PS_LIST_TAIL, "registered", PS_DATA_TIME, NULL, registered)) {
    2314723174        psError(PS_ERR_UNKNOWN, false, "failed to add item registered");
     23175        psFree(md);
     23176        return false;
     23177    }
     23178    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, fault)) {
     23179        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
    2314823180        psFree(md);
    2314923181        return false;
     
    2317223204bool magicRunInsertObject(psDB *dbh, magicRunRow *object)
    2317323205{
    23174     return magicRunInsert(dbh, object->magic_id, object->state, object->workdir, object->workdir_state, object->label, object->dvodb, object->registered);
     23206    return magicRunInsert(dbh, object->magic_id, object->state, object->workdir, object->workdir_state, object->label, object->dvodb, object->registered, object->fault);
    2317523207}
    2317623208
     
    2328023312        return false;
    2328123313    }
     23314    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, object->fault)) {
     23315        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
     23316        psFree(md);
     23317        return false;
     23318    }
    2328223319
    2328323320
     
    2332423361        return false;
    2332523362    }
    23326 
    23327     return magicRunRowAlloc(magic_id, state, workdir, workdir_state, label, dvodb, registered);
     23363    psS16 fault = psMetadataLookupS16(&status, md, "fault");
     23364    if (!status) {
     23365        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fault");
     23366        return false;
     23367    }
     23368
     23369    return magicRunRowAlloc(magic_id, state, workdir, workdir_state, label, dvodb, registered, fault);
    2332823370}
    2332923371psArray *magicRunSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
     
    2408824130static void magicNodeResultRowFree(magicNodeResultRow *object);
    2408924131
    24090 magicNodeResultRow *magicNodeResultRowAlloc(psS64 magic_id, const char *node, const char *uri)
     24132magicNodeResultRow *magicNodeResultRowAlloc(psS64 magic_id, const char *node, const char *uri, psS16 fault)
    2409124133{
    2409224134    magicNodeResultRow *_object;
     
    2409824140    _object->node = psStringCopy(node);
    2409924141    _object->uri = psStringCopy(uri);
     24142    _object->fault = fault;
    2410024143
    2410124144    return _object;
     
    2412624169        return false;
    2412724170    }
     24171    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, "Key", 0)) {
     24172        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
     24173        psFree(md);
     24174        return false;
     24175    }
    2412824176
    2412924177    bool status = psDBCreateTable(dbh, MAGICNODERESULT_TABLE_NAME, md);
     
    2413924187}
    2414024188
    24141 bool magicNodeResultInsert(psDB * dbh, psS64 magic_id, const char *node, const char *uri)
     24189bool magicNodeResultInsert(psDB * dbh, psS64 magic_id, const char *node, const char *uri, psS16 fault)
    2414224190{
    2414324191    psMetadata *md = psMetadataAlloc();
     
    2415424202    if (!psMetadataAdd(md, PS_LIST_TAIL, "uri", PS_DATA_STRING, NULL, uri)) {
    2415524203        psError(PS_ERR_UNKNOWN, false, "failed to add item uri");
     24204        psFree(md);
     24205        return false;
     24206    }
     24207    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, fault)) {
     24208        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
    2415624209        psFree(md);
    2415724210        return false;
     
    2418024233bool magicNodeResultInsertObject(psDB *dbh, magicNodeResultRow *object)
    2418124234{
    24182     return magicNodeResultInsert(dbh, object->magic_id, object->node, object->uri);
     24235    return magicNodeResultInsert(dbh, object->magic_id, object->node, object->uri, object->fault);
    2418324236}
    2418424237
     
    2426824321        return false;
    2426924322    }
     24323    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, object->fault)) {
     24324        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
     24325        psFree(md);
     24326        return false;
     24327    }
    2427024328
    2427124329
     
    2429224350        return false;
    2429324351    }
    24294 
    24295     return magicNodeResultRowAlloc(magic_id, node, uri);
     24352    psS16 fault = psMetadataLookupS16(&status, md, "fault");
     24353    if (!status) {
     24354        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fault");
     24355        return false;
     24356    }
     24357
     24358    return magicNodeResultRowAlloc(magic_id, node, uri, fault);
    2429624359}
    2429724360psArray *magicNodeResultSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
     
    2441124474static void magicMaskRowFree(magicMaskRow *object);
    2441224475
    24413 magicMaskRow *magicMaskRowAlloc(psS64 magic_id, const char *uri)
     24476magicMaskRow *magicMaskRowAlloc(psS64 magic_id, const char *uri, psS32 streaks, psS16 fault)
    2441424477{
    2441524478    magicMaskRow    *_object;
     
    2442024483    _object->magic_id = magic_id;
    2442124484    _object->uri = psStringCopy(uri);
     24485    _object->streaks = streaks;
     24486    _object->fault = fault;
    2442224487
    2442324488    return _object;
     
    2444224507        return false;
    2444324508    }
     24509    if (!psMetadataAdd(md, PS_LIST_TAIL, "streaks", PS_DATA_S32, NULL, 0)) {
     24510        psError(PS_ERR_UNKNOWN, false, "failed to add item streaks");
     24511        psFree(md);
     24512        return false;
     24513    }
     24514    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, "Key", 0)) {
     24515        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
     24516        psFree(md);
     24517        return false;
     24518    }
    2444424519
    2444524520    bool status = psDBCreateTable(dbh, MAGICMASK_TABLE_NAME, md);
     
    2445524530}
    2445624531
    24457 bool magicMaskInsert(psDB * dbh, psS64 magic_id, const char *uri)
     24532bool magicMaskInsert(psDB * dbh, psS64 magic_id, const char *uri, psS32 streaks, psS16 fault)
    2445824533{
    2445924534    psMetadata *md = psMetadataAlloc();
     
    2446524540    if (!psMetadataAdd(md, PS_LIST_TAIL, "uri", PS_DATA_STRING, NULL, uri)) {
    2446624541        psError(PS_ERR_UNKNOWN, false, "failed to add item uri");
     24542        psFree(md);
     24543        return false;
     24544    }
     24545    if (!psMetadataAdd(md, PS_LIST_TAIL, "streaks", PS_DATA_S32, NULL, streaks)) {
     24546        psError(PS_ERR_UNKNOWN, false, "failed to add item streaks");
     24547        psFree(md);
     24548        return false;
     24549    }
     24550    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, fault)) {
     24551        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
    2446724552        psFree(md);
    2446824553        return false;
     
    2449124576bool magicMaskInsertObject(psDB *dbh, magicMaskRow *object)
    2449224577{
    24493     return magicMaskInsert(dbh, object->magic_id, object->uri);
     24578    return magicMaskInsert(dbh, object->magic_id, object->uri, object->streaks, object->fault);
    2449424579}
    2449524580
     
    2457424659        return false;
    2457524660    }
     24661    if (!psMetadataAdd(md, PS_LIST_TAIL, "streaks", PS_DATA_S32, NULL, object->streaks)) {
     24662        psError(PS_ERR_UNKNOWN, false, "failed to add item streaks");
     24663        psFree(md);
     24664        return false;
     24665    }
     24666    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, object->fault)) {
     24667        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
     24668        psFree(md);
     24669        return false;
     24670    }
    2457624671
    2457724672
     
    2459324688        return false;
    2459424689    }
    24595 
    24596     return magicMaskRowAlloc(magic_id, uri);
     24690    psS32 streaks = psMetadataLookupS32(&status, md, "streaks");
     24691    if (!status) {
     24692        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item streaks");
     24693        return false;
     24694    }
     24695    psS16 fault = psMetadataLookupS16(&status, md, "fault");
     24696    if (!status) {
     24697        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fault");
     24698        return false;
     24699    }
     24700
     24701    return magicMaskRowAlloc(magic_id, uri, streaks, fault);
    2459724702}
    2459824703psArray *magicMaskSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
     
    2471024815    return true;
    2471124816}
    24712 static void magicSkyfileMaskRowFree(magicSkyfileMaskRow *object);
    24713 
    24714 magicSkyfileMaskRow *magicSkyfileMaskRowAlloc(psS64 magic_id, psS64 diff_id, const char *uri)
    24715 {
    24716     magicSkyfileMaskRow *_object;
    24717 
    24718     _object = psAlloc(sizeof(magicSkyfileMaskRow));
    24719     psMemSetDeallocator(_object, (psFreeFunc)magicSkyfileMaskRowFree);
    24720 
    24721     _object->magic_id = magic_id;
    24722     _object->diff_id = diff_id;
    24723     _object->uri = psStringCopy(uri);
    24724 
    24725     return _object;
    24726 }
    24727 
    24728 static void magicSkyfileMaskRowFree(magicSkyfileMaskRow *object)
    24729 {
    24730     psFree(object->uri);
    24731 }
    24732 
    24733 bool magicSkyfileMaskCreateTable(psDB *dbh)
    24734 {
    24735     psMetadata *md = psMetadataAlloc();
    24736     if (!psMetadataAdd(md, PS_LIST_TAIL, "magic_id", PS_DATA_S64, "Primary Key fkey(magic_id) ref magicRun(magic_id)", 0)) {
    24737         psError(PS_ERR_UNKNOWN, false, "failed to add item magic_id");
    24738         psFree(md);
    24739         return false;
    24740     }
    24741     if (!psMetadataAdd(md, PS_LIST_TAIL, "diff_id", PS_DATA_S64, "Primary Key fkey(magic_id, diff_id) ref magicInputSkyfile(magic_id, diff_id)", 0)) {
    24742         psError(PS_ERR_UNKNOWN, false, "failed to add item diff_id");
    24743         psFree(md);
    24744         return false;
    24745     }
    24746     if (!psMetadataAdd(md, PS_LIST_TAIL, "uri", PS_DATA_STRING, "fkey(magic_id) ref magicMask(magic_id)", "255")) {
    24747         psError(PS_ERR_UNKNOWN, false, "failed to add item uri");
    24748         psFree(md);
    24749         return false;
    24750     }
    24751 
    24752     bool status = psDBCreateTable(dbh, MAGICSKYFILEMASK_TABLE_NAME, md);
    24753 
    24754     psFree(md);
    24755 
    24756     return status;
    24757 }
    24758 
    24759 bool magicSkyfileMaskDropTable(psDB *dbh)
    24760 {
    24761     return psDBDropTable(dbh, MAGICSKYFILEMASK_TABLE_NAME);
    24762 }
    24763 
    24764 bool magicSkyfileMaskInsert(psDB * dbh, psS64 magic_id, psS64 diff_id, const char *uri)
    24765 {
    24766     psMetadata *md = psMetadataAlloc();
    24767     if (!psMetadataAdd(md, PS_LIST_TAIL, "magic_id", PS_DATA_S64, NULL, magic_id)) {
    24768         psError(PS_ERR_UNKNOWN, false, "failed to add item magic_id");
    24769         psFree(md);
    24770         return false;
    24771     }
    24772     if (!psMetadataAdd(md, PS_LIST_TAIL, "diff_id", PS_DATA_S64, NULL, diff_id)) {
    24773         psError(PS_ERR_UNKNOWN, false, "failed to add item diff_id");
    24774         psFree(md);
    24775         return false;
    24776     }
    24777     if (!psMetadataAdd(md, PS_LIST_TAIL, "uri", PS_DATA_STRING, NULL, uri)) {
    24778         psError(PS_ERR_UNKNOWN, false, "failed to add item uri");
    24779         psFree(md);
    24780         return false;
    24781     }
    24782 
    24783     bool status = psDBInsertOneRow(dbh, MAGICSKYFILEMASK_TABLE_NAME, md);
    24784     psFree(md);
    24785 
    24786     return status;
    24787 }
    24788 
    24789 long long magicSkyfileMaskDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)
    24790 {
    24791     long long       deleted = 0;
    24792 
    24793     long long count = psDBDeleteRows(dbh, MAGICSKYFILEMASK_TABLE_NAME, where, limit);
    24794     if (count < 0) {
    24795         psError(PS_ERR_UNKNOWN, true, "failed to delete row from magicSkyfileMask");
    24796         return count;
    24797 
    24798         deleted += count;
    24799     }
    24800 
    24801     return deleted;
    24802 }
    24803 bool magicSkyfileMaskInsertObject(psDB *dbh, magicSkyfileMaskRow *object)
    24804 {
    24805     return magicSkyfileMaskInsert(dbh, object->magic_id, object->diff_id, object->uri);
    24806 }
    24807 
    24808 bool magicSkyfileMaskInsertObjects(psDB *dbh, psArray *objects)
    24809 {
    24810     for (long i = 0; i < psArrayLength(objects); i++) {
    24811         if (!magicSkyfileMaskInsertObject(dbh, objects->data[i])) {
    24812             return false;
    24813         }
    24814     }
    24815 
    24816     return true;
    24817 }
    24818 
    24819 bool magicSkyfileMaskInsertFits(psDB *dbh, const psFits *fits)
    24820 {
    24821     psArray         *rowSet;
    24822 
    24823     // move to (the first?) extension named  MAGICSKYFILEMASK_TABLE_NAME
    24824     if (!psFitsMoveExtName(fits, MAGICSKYFILEMASK_TABLE_NAME)) {
    24825         psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", MAGICSKYFILEMASK_TABLE_NAME);
    24826         return false;
    24827     }
    24828 
    24829     // check HDU type
    24830     if (psFitsGetExtType(fits) != PS_FITS_TYPE_BINARY_TABLE)  {
    24831         psError(PS_ERR_UNKNOWN, true, "FITS HDU type is not PS_FITS_TYPE_BINARY_TABLE");
    24832         return false;
    24833     }
    24834 
    24835     // read fits table
    24836     rowSet = psFitsReadTable(fits);
    24837     if (!rowSet) {
    24838         psError(PS_ERR_UNKNOWN, true, "FITS read error or FITS table is empty");
    24839         psFree(rowSet);
    24840         return false;
    24841     }
    24842 
    24843     if (!psDBInsertRows(dbh, MAGICSKYFILEMASK_TABLE_NAME, rowSet)) {
    24844         psError(PS_ERR_UNKNOWN, false, "databse insert failed");
    24845         psFree(rowSet);
    24846         return false;
    24847     }
    24848 
    24849     psFree(rowSet);
    24850 
    24851     return true;
    24852 }
    24853 
    24854 bool magicSkyfileMaskSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)
    24855 {
    24856     psArray         *rowSet;
    24857 
    24858     rowSet = psDBSelectRows(dbh, MAGICSKYFILEMASK_TABLE_NAME, where, limit);
    24859     if (!rowSet) {
    24860         return false;
    24861     }
    24862 
    24863     // output to fits
    24864     if (!psFitsWriteTable(fits, NULL, rowSet, MAGICSKYFILEMASK_TABLE_NAME)) {
    24865         psError(PS_ERR_UNKNOWN, false, "FITS table write failed");
    24866         psFree(rowSet);
    24867         return false;
    24868     }
    24869 
    24870     psFree(rowSet);
    24871 
    24872     return true;
    24873 }
    24874 
    24875 psMetadata *magicSkyfileMaskMetadataFromObject(const magicSkyfileMaskRow *object)
    24876 {
    24877     psMetadata *md = psMetadataAlloc();
    24878     if (!psMetadataAdd(md, PS_LIST_TAIL, "magic_id", PS_DATA_S64, NULL, object->magic_id)) {
    24879         psError(PS_ERR_UNKNOWN, false, "failed to add item magic_id");
    24880         psFree(md);
    24881         return false;
    24882     }
    24883     if (!psMetadataAdd(md, PS_LIST_TAIL, "diff_id", PS_DATA_S64, NULL, object->diff_id)) {
    24884         psError(PS_ERR_UNKNOWN, false, "failed to add item diff_id");
    24885         psFree(md);
    24886         return false;
    24887     }
    24888     if (!psMetadataAdd(md, PS_LIST_TAIL, "uri", PS_DATA_STRING, NULL, object->uri)) {
    24889         psError(PS_ERR_UNKNOWN, false, "failed to add item uri");
    24890         psFree(md);
    24891         return false;
    24892     }
    24893 
    24894 
    24895     return md;
    24896 }
    24897 
    24898 magicSkyfileMaskRow *magicSkyfileMaskObjectFromMetadata(psMetadata *md)
    24899 {
    24900 
    24901 bool status = false;
    24902     psS64 magic_id = psMetadataLookupS64(&status, md, "magic_id");
    24903     if (!status) {
    24904         psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item magic_id");
    24905         return false;
    24906     }
    24907     psS64 diff_id = psMetadataLookupS64(&status, md, "diff_id");
    24908     if (!status) {
    24909         psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item diff_id");
    24910         return false;
    24911     }
    24912     char* uri = psMetadataLookupPtr(&status, md, "uri");
    24913     if (!status) {
    24914         psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item uri");
    24915         return false;
    24916     }
    24917 
    24918     return magicSkyfileMaskRowAlloc(magic_id, diff_id, uri);
    24919 }
    24920 psArray *magicSkyfileMaskSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
    24921 {
    24922     psArray         *rowSet;
    24923     psArray         *returnSet;
    24924     psU64           i;
    24925 
    24926     rowSet = psDBSelectRows(dbh, MAGICSKYFILEMASK_TABLE_NAME, where, limit);
    24927     if (!rowSet) {
    24928         return NULL;
    24929     }
    24930 
    24931     // convert psMetadata rows to row objects
    24932 
    24933     returnSet = psArrayAllocEmpty(rowSet->n);
    24934 
    24935     for (i = 0; i < rowSet->n; i++) {
    24936         magicSkyfileMaskRow *object = magicSkyfileMaskObjectFromMetadata(rowSet->data[i]);
    24937         if (!object) {
    24938             psFree(object);
    24939             psFree(returnSet);
    24940             psError(PS_ERR_UNKNOWN, false, "database error");
    24941             return NULL;
    24942         }
    24943         psArrayAdd(returnSet, 0, object);
    24944         psFree(object);
    24945     }
    24946 
    24947     psFree(rowSet);
    24948 
    24949     return returnSet;
    24950 }
    24951 bool magicSkyfileMaskDeleteObject(psDB *dbh, const magicSkyfileMaskRow *object)
    24952 {
    24953     psMetadata *where = magicSkyfileMaskMetadataFromObject(object);
    24954     long long count = psDBDeleteRows(dbh, MAGICSKYFILEMASK_TABLE_NAME, where, 0);
    24955     psFree(where);
    24956     if (count < 0) {
    24957         psError(PS_ERR_UNKNOWN, true, "failed to delete row from magicSkyfileMask");
    24958         return false;
    24959     }
    24960     if (count > 1) {
    24961         // XXX should this be a psAbort() instead?  It is possible that
    24962         // having an object match multiple rows was by design.
    24963         psError(PS_ERR_UNKNOWN, true, "magicSkyfileMaskRow object matched more then one row.  Check your database schema");
    24964         return false;
    24965     }
    24966 
    24967     return true;
    24968 }
    24969 long long magicSkyfileMaskDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)
    24970 {
    24971     long long       deleted = 0;
    24972 
    24973     for (long long i = 0; i < objects->n; i++) {
    24974         magicSkyfileMaskRow *object = objects->data[i];
    24975         psMetadata *where = magicSkyfileMaskMetadataFromObject(object);
    24976         long long count = psDBDeleteRows(dbh, MAGICSKYFILEMASK_TABLE_NAME, where, limit);
    24977         psFree(where);
    24978         if (count < 0) {
    24979             psError(PS_ERR_UNKNOWN, true, "failed to delete row from magicSkyfileMask");
    24980             return count;
    24981         }
    24982 
    24983         deleted += count;
    24984     }
    24985 
    24986     return deleted;
    24987 }
    24988 bool magicSkyfileMaskPrintObjects(FILE *stream, psArray *objects, bool mdcf)
    24989 {
    24990     PS_ASSERT_PTR_NON_NULL(objects, false);
    24991 
    24992     psMetadata *output = psMetadataAlloc();
    24993     for (long i = 0; i < psArrayLength(objects); i++) {
    24994         psMetadata *md = magicSkyfileMaskMetadataFromObject(objects->data[i]);
    24995         if (!psMetadataAddMetadata(
    24996             output,
    24997             PS_LIST_TAIL,
    24998             MAGICSKYFILEMASK_TABLE_NAME,
    24999             PS_META_DUPLICATE_OK,
    25000             NULL,
    25001             md
    25002         )) {
    25003             psError(PS_ERR_UNKNOWN, false, "failed to add metadata");
    25004             psFree(md);
    25005             psFree(output);
    25006             return false;
    25007         }
    25008         psFree(md);
    25009     }
    25010 
    25011     if (!ippdbPrintMetadataRaw(stream, output, mdcf)) {
    25012         psError(PS_ERR_UNKNOWN, false, "failed to print metadata");
    25013         psFree(output);
    25014     }
    25015     psFree(output);
    25016 
    25017     return true;
    25018 }
    25019 bool magicSkyfileMaskPrintObject(FILE *stream, magicSkyfileMaskRow *object, bool mdcf)
    25020 {
    25021     PS_ASSERT_PTR_NON_NULL(object, false);
    25022 
    25023     psMetadata *md = magicSkyfileMaskMetadataFromObject(object);
    25024 
    25025     if (!ippdbPrintMetadataRaw(stream, md, mdcf)) {
    25026         psError(PS_ERR_UNKNOWN, false, "failed to print metadata");
    25027         psFree(md);
    25028     }
    25029 
    25030     psFree(md);
    25031 
    25032     return true;
    25033 }
    2503424817static void calDBRowFree(calDBRow *object);
    2503524818
     
    2647726260        return false;
    2647826261    }
    26479     if (!psMetadataAdd(md, PS_LIST_TAIL, "outProduct", PS_DATA_STRING, "UNIQUE", "64")) {
     26262    if (!psMetadataAdd(md, PS_LIST_TAIL, "outProduct", PS_DATA_STRING, NULL, "64")) {
    2648026263        psError(PS_ERR_UNKNOWN, false, "failed to add item outProduct");
    2648126264        psFree(md);
     
    2680226585static void pstampRequestRowFree(pstampRequestRow *object);
    2680326586
    26804 pstampRequestRow *pstampRequestRowAlloc(psS64 req_id, psS64 ds_id, const char *state, const char *outFileset, const char *uri, psS16 resultsFile)
     26587pstampRequestRow *pstampRequestRowAlloc(psS64 req_id, psS64 ds_id, const char *state, const char *name, const char *reqType, const char *outProduct, const char *uri, psS32 fault)
    2680526588{
    2680626589    pstampRequestRow *_object;
     
    2681226595    _object->ds_id = ds_id;
    2681326596    _object->state = psStringCopy(state);
    26814     _object->outFileset = psStringCopy(outFileset);
     26597    _object->name = psStringCopy(name);
     26598    _object->reqType = psStringCopy(reqType);
     26599    _object->outProduct = psStringCopy(outProduct);
    2681526600    _object->uri = psStringCopy(uri);
    26816     _object->resultsFile = resultsFile;
     26601    _object->fault = fault;
    2681726602
    2681826603    return _object;
     
    2682226607{
    2682326608    psFree(object->state);
    26824     psFree(object->outFileset);
     26609    psFree(object->name);
     26610    psFree(object->reqType);
     26611    psFree(object->outProduct);
    2682526612    psFree(object->uri);
    2682626613}
     
    2684426631        return false;
    2684526632    }
    26846     if (!psMetadataAdd(md, PS_LIST_TAIL, "outFileset", PS_DATA_STRING, "UNIQUE", "64")) {
    26847         psError(PS_ERR_UNKNOWN, false, "failed to add item outFileset");
     26633    if (!psMetadataAdd(md, PS_LIST_TAIL, "name", PS_DATA_STRING, "UNIQUE", "64")) {
     26634        psError(PS_ERR_UNKNOWN, false, "failed to add item name");
     26635        psFree(md);
     26636        return false;
     26637    }
     26638    if (!psMetadataAdd(md, PS_LIST_TAIL, "reqType", PS_DATA_STRING, NULL, "16")) {
     26639        psError(PS_ERR_UNKNOWN, false, "failed to add item reqType");
     26640        psFree(md);
     26641        return false;
     26642    }
     26643    if (!psMetadataAdd(md, PS_LIST_TAIL, "outProduct", PS_DATA_STRING, NULL, "64")) {
     26644        psError(PS_ERR_UNKNOWN, false, "failed to add item outProduct");
    2684826645        psFree(md);
    2684926646        return false;
     
    2685426651        return false;
    2685526652    }
    26856     if (!psMetadataAdd(md, PS_LIST_TAIL, "resultsFile", PS_DATA_S16, NULL, 0)) {
    26857         psError(PS_ERR_UNKNOWN, false, "failed to add item resultsFile");
     26653    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S32, NULL, 0)) {
     26654        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
    2685826655        psFree(md);
    2685926656        return false;
     
    2687226669}
    2687326670
    26874 bool pstampRequestInsert(psDB * dbh, psS64 req_id, psS64 ds_id, const char *state, const char *outFileset, const char *uri, psS16 resultsFile)
     26671bool pstampRequestInsert(psDB * dbh, psS64 req_id, psS64 ds_id, const char *state, const char *name, const char *reqType, const char *outProduct, const char *uri, psS32 fault)
    2687526672{
    2687626673    psMetadata *md = psMetadataAlloc();
     
    2689026687        return false;
    2689126688    }
    26892     if (!psMetadataAdd(md, PS_LIST_TAIL, "outFileset", PS_DATA_STRING, NULL, outFileset)) {
    26893         psError(PS_ERR_UNKNOWN, false, "failed to add item outFileset");
     26689    if (!psMetadataAdd(md, PS_LIST_TAIL, "name", PS_DATA_STRING, NULL, name)) {
     26690        psError(PS_ERR_UNKNOWN, false, "failed to add item name");
     26691        psFree(md);
     26692        return false;
     26693    }
     26694    if (!psMetadataAdd(md, PS_LIST_TAIL, "reqType", PS_DATA_STRING, NULL, reqType)) {
     26695        psError(PS_ERR_UNKNOWN, false, "failed to add item reqType");
     26696        psFree(md);
     26697        return false;
     26698    }
     26699    if (!psMetadataAdd(md, PS_LIST_TAIL, "outProduct", PS_DATA_STRING, NULL, outProduct)) {
     26700        psError(PS_ERR_UNKNOWN, false, "failed to add item outProduct");
    2689426701        psFree(md);
    2689526702        return false;
     
    2690026707        return false;
    2690126708    }
    26902     if (!psMetadataAdd(md, PS_LIST_TAIL, "resultsFile", PS_DATA_S16, NULL, resultsFile)) {
    26903         psError(PS_ERR_UNKNOWN, false, "failed to add item resultsFile");
     26709    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S32, NULL, fault)) {
     26710        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
    2690426711        psFree(md);
    2690526712        return false;
     
    2692826735bool pstampRequestInsertObject(psDB *dbh, pstampRequestRow *object)
    2692926736{
    26930     return pstampRequestInsert(dbh, object->req_id, object->ds_id, object->state, object->outFileset, object->uri, object->resultsFile);
     26737    return pstampRequestInsert(dbh, object->req_id, object->ds_id, object->state, object->name, object->reqType, object->outProduct, object->uri, object->fault);
    2693126738}
    2693226739
     
    2701626823        return false;
    2701726824    }
    27018     if (!psMetadataAdd(md, PS_LIST_TAIL, "outFileset", PS_DATA_STRING, NULL, object->outFileset)) {
    27019         psError(PS_ERR_UNKNOWN, false, "failed to add item outFileset");
     26825    if (!psMetadataAdd(md, PS_LIST_TAIL, "name", PS_DATA_STRING, NULL, object->name)) {
     26826        psError(PS_ERR_UNKNOWN, false, "failed to add item name");
     26827        psFree(md);
     26828        return false;
     26829    }
     26830    if (!psMetadataAdd(md, PS_LIST_TAIL, "reqType", PS_DATA_STRING, NULL, object->reqType)) {
     26831        psError(PS_ERR_UNKNOWN, false, "failed to add item reqType");
     26832        psFree(md);
     26833        return false;
     26834    }
     26835    if (!psMetadataAdd(md, PS_LIST_TAIL, "outProduct", PS_DATA_STRING, NULL, object->outProduct)) {
     26836        psError(PS_ERR_UNKNOWN, false, "failed to add item outProduct");
    2702026837        psFree(md);
    2702126838        return false;
     
    2702626843        return false;
    2702726844    }
    27028     if (!psMetadataAdd(md, PS_LIST_TAIL, "resultsFile", PS_DATA_S16, NULL, object->resultsFile)) {
    27029         psError(PS_ERR_UNKNOWN, false, "failed to add item resultsFile");
     26845    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S32, NULL, object->fault)) {
     26846        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
    2703026847        psFree(md);
    2703126848        return false;
     
    2705526872        return false;
    2705626873    }
    27057     char* outFileset = psMetadataLookupPtr(&status, md, "outFileset");
    27058     if (!status) {
    27059         psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item outFileset");
     26874    char* name = psMetadataLookupPtr(&status, md, "name");
     26875    if (!status) {
     26876        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item name");
     26877        return false;
     26878    }
     26879    char* reqType = psMetadataLookupPtr(&status, md, "reqType");
     26880    if (!status) {
     26881        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item reqType");
     26882        return false;
     26883    }
     26884    char* outProduct = psMetadataLookupPtr(&status, md, "outProduct");
     26885    if (!status) {
     26886        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item outProduct");
    2706026887        return false;
    2706126888    }
     
    2706526892        return false;
    2706626893    }
    27067     psS16 resultsFile = psMetadataLookupS16(&status, md, "resultsFile");
    27068     if (!status) {
    27069         psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item resultsFile");
    27070         return false;
    27071     }
    27072 
    27073     return pstampRequestRowAlloc(req_id, ds_id, state, outFileset, uri, resultsFile);
     26894    psS32 fault = psMetadataLookupS32(&status, md, "fault");
     26895    if (!status) {
     26896        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fault");
     26897        return false;
     26898    }
     26899
     26900    return pstampRequestRowAlloc(req_id, ds_id, state, name, reqType, outProduct, uri, fault);
    2707426901}
    2707526902psArray *pstampRequestSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
     
    2718927016static void pstampJobRowFree(pstampJobRow *object);
    2719027017
    27191 pstampJobRow *pstampJobRowAlloc(psS64 job_id, psS64 req_id, const char *state, const char *jobType, psS32 result, const char *uri, const char *outputBase, const char *args)
     27018pstampJobRow *pstampJobRowAlloc(psS64 job_id, psS64 req_id, const char *rownum, const char *state, const char *jobType, psS32 fault, const char *uri, const char *outputBase, const char *args)
    2719227019{
    2719327020    pstampJobRow    *_object;
     
    2719827025    _object->job_id = job_id;
    2719927026    _object->req_id = req_id;
     27027    _object->rownum = psStringCopy(rownum);
    2720027028    _object->state = psStringCopy(state);
    2720127029    _object->jobType = psStringCopy(jobType);
    27202     _object->result = result;
     27030    _object->fault = fault;
    2720327031    _object->uri = psStringCopy(uri);
    2720427032    _object->outputBase = psStringCopy(outputBase);
     
    2721027038static void pstampJobRowFree(pstampJobRow *object)
    2721127039{
     27040    psFree(object->rownum);
    2721227041    psFree(object->state);
    2721327042    psFree(object->jobType);
     
    2723027059        return false;
    2723127060    }
     27061    if (!psMetadataAdd(md, PS_LIST_TAIL, "rownum", PS_DATA_STRING, NULL, "64")) {
     27062        psError(PS_ERR_UNKNOWN, false, "failed to add item rownum");
     27063        psFree(md);
     27064        return false;
     27065    }
    2723227066    if (!psMetadataAdd(md, PS_LIST_TAIL, "state", PS_DATA_STRING, NULL, "64")) {
    2723327067        psError(PS_ERR_UNKNOWN, false, "failed to add item state");
     
    2724027074        return false;
    2724127075    }
    27242     if (!psMetadataAdd(md, PS_LIST_TAIL, "result", PS_DATA_S32, NULL, 0)) {
    27243         psError(PS_ERR_UNKNOWN, false, "failed to add item result");
     27076    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S32, NULL, 0)) {
     27077        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
    2724427078        psFree(md);
    2724527079        return false;
     
    2727327107}
    2727427108
    27275 bool pstampJobInsert(psDB * dbh, psS64 job_id, psS64 req_id, const char *state, const char *jobType, psS32 result, const char *uri, const char *outputBase, const char *args)
     27109bool pstampJobInsert(psDB * dbh, psS64 job_id, psS64 req_id, const char *rownum, const char *state, const char *jobType, psS32 fault, const char *uri, const char *outputBase, const char *args)
    2727627110{
    2727727111    psMetadata *md = psMetadataAlloc();
     
    2728627120        return false;
    2728727121    }
     27122    if (!psMetadataAdd(md, PS_LIST_TAIL, "rownum", PS_DATA_STRING, NULL, rownum)) {
     27123        psError(PS_ERR_UNKNOWN, false, "failed to add item rownum");
     27124        psFree(md);
     27125        return false;
     27126    }
    2728827127    if (!psMetadataAdd(md, PS_LIST_TAIL, "state", PS_DATA_STRING, NULL, state)) {
    2728927128        psError(PS_ERR_UNKNOWN, false, "failed to add item state");
     
    2729627135        return false;
    2729727136    }
    27298     if (!psMetadataAdd(md, PS_LIST_TAIL, "result", PS_DATA_S32, NULL, result)) {
    27299         psError(PS_ERR_UNKNOWN, false, "failed to add item result");
     27137    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S32, NULL, fault)) {
     27138        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
    2730027139        psFree(md);
    2730127140        return false;
     
    2733927178bool pstampJobInsertObject(psDB *dbh, pstampJobRow *object)
    2734027179{
    27341     return pstampJobInsert(dbh, object->job_id, object->req_id, object->state, object->jobType, object->result, object->uri, object->outputBase, object->args);
     27180    return pstampJobInsert(dbh, object->job_id, object->req_id, object->rownum, object->state, object->jobType, object->fault, object->uri, object->outputBase, object->args);
    2734227181}
    2734327182
     
    2742227261        return false;
    2742327262    }
     27263    if (!psMetadataAdd(md, PS_LIST_TAIL, "rownum", PS_DATA_STRING, NULL, object->rownum)) {
     27264        psError(PS_ERR_UNKNOWN, false, "failed to add item rownum");
     27265        psFree(md);
     27266        return false;
     27267    }
    2742427268    if (!psMetadataAdd(md, PS_LIST_TAIL, "state", PS_DATA_STRING, NULL, object->state)) {
    2742527269        psError(PS_ERR_UNKNOWN, false, "failed to add item state");
     
    2743227276        return false;
    2743327277    }
    27434     if (!psMetadataAdd(md, PS_LIST_TAIL, "result", PS_DATA_S32, NULL, object->result)) {
    27435         psError(PS_ERR_UNKNOWN, false, "failed to add item result");
     27278    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S32, NULL, object->fault)) {
     27279        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
    2743627280        psFree(md);
    2743727281        return false;
     
    2747127315        return false;
    2747227316    }
     27317    char* rownum = psMetadataLookupPtr(&status, md, "rownum");
     27318    if (!status) {
     27319        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item rownum");
     27320        return false;
     27321    }
    2747327322    char* state = psMetadataLookupPtr(&status, md, "state");
    2747427323    if (!status) {
     
    2748127330        return false;
    2748227331    }
    27483     psS32 result = psMetadataLookupS32(&status, md, "result");
    27484     if (!status) {
    27485         psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item result");
     27332    psS32 fault = psMetadataLookupS32(&status, md, "fault");
     27333    if (!status) {
     27334        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fault");
    2748627335        return false;
    2748727336    }
     
    2750227351    }
    2750327352
    27504     return pstampJobRowAlloc(job_id, req_id, state, jobType, result, uri, outputBase, args);
     27353    return pstampJobRowAlloc(job_id, req_id, rownum, state, jobType, fault, uri, outputBase, args);
    2750527354}
    2750627355psArray *pstampJobSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
  • trunk/ippdb/src/ippdb.h

    r18044 r18595  
    61236123    char            *skycell_id;
    61246124    char            *tess_id;
     6125    char            *filter;
    61256126} stackRunRow;
    61266127
     
    61376138    psTime*         registered,
    61386139    const char      *skycell_id,
    6139     const char      *tess_id
     6140    const char      *tess_id,
     6141    const char      *filter
    61406142);
    61416143
     
    61736175    psTime*         registered,
    61746176    const char      *skycell_id,
    6175     const char      *tess_id
     6177    const char      *tess_id,
     6178    const char      *filter
    61766179);
    61776180
     
    1003210035    char            *dvodb;
    1003310036    psTime*         registered;
     10037    psS16           fault;
    1003410038} magicRunRow;
    1003510039
     
    1004610050    const char      *label,
    1004710051    const char      *dvodb,
    10048     psTime*         registered
     10052    psTime*         registered,
     10053    psS16           fault
    1004910054);
    1005010055
     
    1008210087    const char      *label,
    1008310088    const char      *dvodb,
    10084     psTime*         registered
     10089    psTime*         registered,
     10090    psS16           fault
    1008510091);
    1008610092
     
    1064310649    char            *node;
    1064410650    char            *uri;
     10651    psS16           fault;
    1064510652} magicNodeResultRow;
    1064610653
     
    1065310660    psS64           magic_id,
    1065410661    const char      *node,
    10655     const char      *uri
     10662    const char      *uri,
     10663    psS16           fault
    1065610664);
    1065710665
     
    1068510693    psS64           magic_id,
    1068610694    const char      *node,
    10687     const char      *uri
     10695    const char      *uri,
     10696    psS16           fault
    1068810697);
    1068910698
     
    1084310852    psS64           magic_id;
    1084410853    char            *uri;
     10854    psS32           streaks;
     10855    psS16           fault;
    1084510856} magicMaskRow;
    1084610857
     
    1085210863magicMaskRow *magicMaskRowAlloc(
    1085310864    psS64           magic_id,
    10854     const char      *uri
     10865    const char      *uri,
     10866    psS32           streaks,
     10867    psS16           fault
    1085510868);
    1085610869
     
    1088310896    psDB            *dbh,               ///< Database handle
    1088410897    psS64           magic_id,
    10885     const char      *uri
     10898    const char      *uri,
     10899    psS32           streaks,
     10900    psS16           fault
    1088610901);
    1088710902
     
    1103111046    FILE            *stream,            ///< a stream
    1103211047    magicMaskRow *object,    ///< an magicMaskRow object
    11033     bool            mdcf                ///< format as mdconfig or simple
    11034 );
    11035 /** magicSkyfileMaskRow data structure
    11036  *
    11037  * Structure for representing a single row of magicSkyfileMask table data.
    11038  */
    11039 
    11040 typedef struct {
    11041     psS64           magic_id;
    11042     psS64           diff_id;
    11043     char            *uri;
    11044 } magicSkyfileMaskRow;
    11045 
    11046 /** Creates a new magicSkyfileMaskRow object
    11047  *
    11048  *  @return A new magicSkyfileMaskRow object or NULL on failure.
    11049  */
    11050 
    11051 magicSkyfileMaskRow *magicSkyfileMaskRowAlloc(
    11052     psS64           magic_id,
    11053     psS64           diff_id,
    11054     const char      *uri
    11055 );
    11056 
    11057 /** Creates a new magicSkyfileMask table
    11058  *
    11059  * @return true on success
    11060  */
    11061 
    11062 bool magicSkyfileMaskCreateTable(
    11063     psDB            *dbh                ///< Database handle
    11064 );
    11065 
    11066 /** Deletes a magicSkyfileMask table
    11067  *
    11068  * @return true on success
    11069  */
    11070 
    11071 bool magicSkyfileMaskDropTable(
    11072     psDB            *dbh                ///< Database handle
    11073 );
    11074 
    11075 /** Insert a single row into a table
    11076  *
    11077  * This function constructs and inserts a single row based on it's parameters.
    11078  *
    11079  * @return true on success
    11080  */
    11081 
    11082 bool magicSkyfileMaskInsert(
    11083     psDB            *dbh,               ///< Database handle
    11084     psS64           magic_id,
    11085     psS64           diff_id,
    11086     const char      *uri
    11087 );
    11088 
    11089 /** Deletes up to limit rows from the database and returns the number of rows actually deleted.
    11090  *
    11091  * @return A The number of rows removed or a negative value on error
    11092  */
    11093 
    11094 long long magicSkyfileMaskDelete(
    11095     psDB            *dbh,               ///< Database handle
    11096     const psMetadata *where,            ///< Row match criteria
    11097     unsigned long long limit            ///< Maximum number of elements to delete
    11098 );
    11099 
    11100 /** Insert a single magicSkyfileMaskRow object into a table
    11101  *
    11102  * This function constructs and inserts a single row based on it's parameters.
    11103  *
    11104  * @return true on success
    11105  */
    11106 
    11107 bool magicSkyfileMaskInsertObject(
    11108     psDB            *dbh,               ///< Database handle
    11109     magicSkyfileMaskRow *object             ///< magicSkyfileMaskRow object
    11110 );
    11111 
    11112 /** Insert an array of magicSkyfileMaskRow object into a table
    11113  *
    11114  * This function constructs and inserts multiple rows based on it's parameters.
    11115  *
    11116  * @return true on success
    11117  */
    11118 
    11119 bool magicSkyfileMaskInsertObjects(
    11120     psDB            *dbh,               ///< Database handle
    11121     psArray         *objects            ///< array of magicSkyfileMaskRow objects
    11122 );
    11123 
    11124 /** Insert data from a binary FITS table magicSkyfileMaskRow into the database
    11125  *
    11126  * This function expects a psFits object with a FITS table as the first
    11127  * extension.  The table must have at least one row of data in it, that is of
    11128  * the appropriate format (number of columns and their type).  All other
    11129  * extensions are ignored.
    11130  *
    11131  * @return true on success
    11132  */
    11133 
    11134 bool magicSkyfileMaskInsertFits(
    11135     psDB            *dbh,               ///< Database handle
    11136     const psFits    *fits               ///< psFits object
    11137 );
    11138 
    11139 /** Selects up to limit from the database and returns them in a binary FITS table
    11140  *
    11141  * This function assumes an empty psFits object and will create a FITS table
    11142  * as the first extension.
    11143  *
    11144  *  See psDBSelectRows() for documentation on the format of where.
    11145  *
    11146  * @return true on success
    11147  */
    11148 
    11149 bool magicSkyfileMaskSelectRowsFits(
    11150     psDB            *dbh,               ///< Database handle
    11151     psFits          *fits,              ///< psFits object
    11152     const psMetadata *where,            ///< Row match criteria
    11153     unsigned long long limit            ///< Maximum number of elements to return
    11154 );
    11155 
    11156 /** Convert a magicSkyfileMaskRow into an equivalent psMetadata
    11157  *
    11158  * @return A psMetadata pointer or NULL on error
    11159  */
    11160 
    11161 psMetadata *magicSkyfileMaskMetadataFromObject(
    11162     const magicSkyfileMaskRow *object             ///< fooRow to convert into a psMetadata
    11163 );
    11164 
    11165 /** Convert a psMetadata into an equivalent fooRow
    11166  *
    11167  * @return A magicSkyfileMaskRow pointer or NULL on error
    11168  */
    11169 
    11170 magicSkyfileMaskRow *magicSkyfileMaskObjectFromMetadata(
    11171     psMetadata      *md                 ///< psMetadata to convert into a fooRow
    11172 );
    11173 /** Selects up to limit rows from the database and returns as magicSkyfileMaskRow objects in a psArray
    11174  *
    11175  *  See psDBSelectRows() for documentation on the format of where.
    11176  *
    11177  * @return A psArray pointer or NULL on error
    11178  */
    11179 
    11180 psArray *magicSkyfileMaskSelectRowObjects(
    11181     psDB            *dbh,               ///< Database handle
    11182     const psMetadata *where,            ///< Row match criteria
    11183     unsigned long long limit            ///< Maximum number of elements to return
    11184 );
    11185 /** Deletes a row from the database coresponding to an magicSkyfileMask
    11186  *
    11187  *  Note that a 'where' search psMetadata is constructed from each object and
    11188  *  used to find rows to delete.
    11189  *
    11190  * @return A The number of rows removed or a negative value on error
    11191  */
    11192 
    11193 bool magicSkyfileMaskDeleteObject(
    11194     psDB            *dbh,               ///< Database handle
    11195     const magicSkyfileMaskRow *object    ///< Object to delete
    11196 );
    11197 /** Deletes up to limit rows from the database and returns the number of rows actually deleted.
    11198  *
    11199  *  Note that a 'where' search psMetadata is constructed from each object and
    11200  *  used to find rows to delete.
    11201  *
    11202  * @return A The number of rows removed or a negative value on error
    11203  */
    11204 
    11205 long long magicSkyfileMaskDeleteRowObjects(
    11206     psDB            *dbh,               ///< Database handle
    11207     const psArray   *objects,           ///< Array of objects to delete
    11208     unsigned long long limit            ///< Maximum number of elements to delete
    11209 );
    11210 /** Formats and prints an array of magicSkyfileMaskRow objects
    11211  *
    11212  * When mdcf is set the formated output is in psMetadataConfig
    11213  * format, otherwise it is in a simple tabular format.
    11214  *
    11215  * @return true on success
    11216  */
    11217 
    11218 bool magicSkyfileMaskPrintObjects(
    11219     FILE            *stream,            ///< a stream
    11220     psArray         *objects,           ///< An array of magicSkyfileMaskRow objects
    11221     bool            mdcf                ///< format as mdconfig or simple
    11222 );
    11223 /** Formats and prints an magicSkyfileMaskRow object
    11224  *
    11225  * When mdcf is set the formated output is in psMetadataConfig
    11226  * format, otherwise it is in a simple tabular format.
    11227  *
    11228  * @return true on success
    11229  */
    11230 
    11231 bool magicSkyfileMaskPrintObject(
    11232     FILE            *stream,            ///< a stream
    11233     magicSkyfileMaskRow *object,    ///< an magicSkyfileMaskRow object
    1123411048    bool            mdcf                ///< format as mdconfig or simple
    1123511049);
     
    1226912083    psS64           ds_id;
    1227012084    char            *state;
    12271     char            *outFileset;
     12085    char            *name;
     12086    char            *reqType;
     12087    char            *outProduct;
    1227212088    char            *uri;
    12273     psS16           resultsFile;
     12089    psS32           fault;
    1227412090} pstampRequestRow;
    1227512091
     
    1228312099    psS64           ds_id,
    1228412100    const char      *state,
    12285     const char      *outFileset,
     12101    const char      *name,
     12102    const char      *reqType,
     12103    const char      *outProduct,
    1228612104    const char      *uri,
    12287     psS16           resultsFile
     12105    psS32           fault
    1228812106);
    1228912107
     
    1231812136    psS64           ds_id,
    1231912137    const char      *state,
    12320     const char      *outFileset,
     12138    const char      *name,
     12139    const char      *reqType,
     12140    const char      *outProduct,
    1232112141    const char      *uri,
    12322     psS16           resultsFile
     12142    psS32           fault
    1232312143);
    1232412144
     
    1247812298    psS64           job_id;
    1247912299    psS64           req_id;
     12300    char            *rownum;
    1248012301    char            *state;
    1248112302    char            *jobType;
    12482     psS32           result;
     12303    psS32           fault;
    1248312304    char            *uri;
    1248412305    char            *outputBase;
     
    1249412315    psS64           job_id,
    1249512316    psS64           req_id,
     12317    const char      *rownum,
    1249612318    const char      *state,
    1249712319    const char      *jobType,
    12498     psS32           result,
     12320    psS32           fault,
    1249912321    const char      *uri,
    1250012322    const char      *outputBase,
     
    1253112353    psS64           job_id,
    1253212354    psS64           req_id,
     12355    const char      *rownum,
    1253312356    const char      *state,
    1253412357    const char      *jobType,
    12535     psS32           result,
     12358    psS32           fault,
    1253612359    const char      *uri,
    1253712360    const char      *outputBase,
  • trunk/ippdb/tests/alloc.c

    r18044 r18595  
    16571657        stackRunRow     *object;
    16581658
    1659         object = stackRunRowAlloc(-64, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string"    );
     1659        object = stackRunRowAlloc(-64, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string", "a string"    );
    16601660
    16611661        if (!object) {
     
    16901690            exit(EXIT_FAILURE);
    16911691        }
     1692        if (strncmp(object->filter, "a string", MAX_STRING_LENGTH)) {
     1693            psFree(object);
     1694            exit(EXIT_FAILURE);
     1695        }
    16921696
    16931697        psFree(object);
     
    27322736        magicRunRow     *object;
    27332737
    2734         object = magicRunRowAlloc(-64, "a string", "a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z"    );
     2738        object = magicRunRowAlloc(-64, "a string", "a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", -16    );
    27352739
    27362740        if (!object) {
     
    27652769            exit(EXIT_FAILURE);
    27662770        }
     2771        if (!object->fault == -16) {
     2772            psFree(object);
     2773            exit(EXIT_FAILURE);
     2774        }
    27672775
    27682776        psFree(object);
     
    28222830        magicNodeResultRow *object;
    28232831
    2824         object = magicNodeResultRowAlloc(-64, "a string", "a string"    );
     2832        object = magicNodeResultRowAlloc(-64, "a string", "a string", -16    );
    28252833
    28262834        if (!object) {
     
    28402848            exit(EXIT_FAILURE);
    28412849        }
     2850        if (!object->fault == -16) {
     2851            psFree(object);
     2852            exit(EXIT_FAILURE);
     2853        }
    28422854
    28432855        psFree(object);
     
    28472859        magicMaskRow    *object;
    28482860
    2849         object = magicMaskRowAlloc(-64, "a string"    );
     2861        object = magicMaskRowAlloc(-64, "a string", -32, -16    );
    28502862
    28512863        if (!object) {
     
    28612873            exit(EXIT_FAILURE);
    28622874        }
    2863 
    2864         psFree(object);
    2865     }
    2866 
    2867     {
    2868         magicSkyfileMaskRow *object;
    2869 
    2870         object = magicSkyfileMaskRowAlloc(-64, -64, "a string"    );
    2871 
    2872         if (!object) {
    2873             exit(EXIT_FAILURE);
    2874         }
    2875 
    2876         if (!object->magic_id == -64) {
    2877             psFree(object);
    2878             exit(EXIT_FAILURE);
    2879         }
    2880         if (!object->diff_id == -64) {
     2875        if (!object->streaks == -32) {
     2876            psFree(object);
     2877            exit(EXIT_FAILURE);
     2878        }
     2879        if (!object->fault == -16) {
     2880            psFree(object);
     2881            exit(EXIT_FAILURE);
     2882        }
     2883
     2884        psFree(object);
     2885    }
     2886
     2887    {
     2888        calDBRow        *object;
     2889
     2890        object = calDBRowAlloc(-64, "a string", "a string"    );
     2891
     2892        if (!object) {
     2893            exit(EXIT_FAILURE);
     2894        }
     2895
     2896        if (!object->cal_id == -64) {
     2897            psFree(object);
     2898            exit(EXIT_FAILURE);
     2899        }
     2900        if (strncmp(object->dvodb, "a string", MAX_STRING_LENGTH)) {
     2901            psFree(object);
     2902            exit(EXIT_FAILURE);
     2903        }
     2904        if (strncmp(object->state, "a string", MAX_STRING_LENGTH)) {
     2905            psFree(object);
     2906            exit(EXIT_FAILURE);
     2907        }
     2908
     2909        psFree(object);
     2910    }
     2911
     2912    {
     2913        calRunRow       *object;
     2914
     2915        object = calRunRowAlloc(-64, "a string", "a string", "a string"    );
     2916
     2917        if (!object) {
     2918            exit(EXIT_FAILURE);
     2919        }
     2920
     2921        if (!object->cal_id == -64) {
     2922            psFree(object);
     2923            exit(EXIT_FAILURE);
     2924        }
     2925        if (strncmp(object->region, "a string", MAX_STRING_LENGTH)) {
     2926            psFree(object);
     2927            exit(EXIT_FAILURE);
     2928        }
     2929        if (strncmp(object->last_step, "a string", MAX_STRING_LENGTH)) {
     2930            psFree(object);
     2931            exit(EXIT_FAILURE);
     2932        }
     2933        if (strncmp(object->state, "a string", MAX_STRING_LENGTH)) {
     2934            psFree(object);
     2935            exit(EXIT_FAILURE);
     2936        }
     2937
     2938        psFree(object);
     2939    }
     2940
     2941    {
     2942        flatcorrRunRow  *object;
     2943
     2944        object = flatcorrRunRowAlloc(-64, "a string", "a string", "a string", "a string", "a string", "a string", "a string"    );
     2945
     2946        if (!object) {
     2947            exit(EXIT_FAILURE);
     2948        }
     2949
     2950        if (!object->corr_id == -64) {
     2951            psFree(object);
     2952            exit(EXIT_FAILURE);
     2953        }
     2954        if (strncmp(object->dvodb, "a string", MAX_STRING_LENGTH)) {
     2955            psFree(object);
     2956            exit(EXIT_FAILURE);
     2957        }
     2958        if (strncmp(object->filter, "a string", MAX_STRING_LENGTH)) {
     2959            psFree(object);
     2960            exit(EXIT_FAILURE);
     2961        }
     2962        if (strncmp(object->state, "a string", MAX_STRING_LENGTH)) {
     2963            psFree(object);
     2964            exit(EXIT_FAILURE);
     2965        }
     2966        if (strncmp(object->workdir, "a string", MAX_STRING_LENGTH)) {
     2967            psFree(object);
     2968            exit(EXIT_FAILURE);
     2969        }
     2970        if (strncmp(object->label, "a string", MAX_STRING_LENGTH)) {
     2971            psFree(object);
     2972            exit(EXIT_FAILURE);
     2973        }
     2974        if (strncmp(object->stats, "a string", MAX_STRING_LENGTH)) {
     2975            psFree(object);
     2976            exit(EXIT_FAILURE);
     2977        }
     2978        if (strncmp(object->region, "a string", MAX_STRING_LENGTH)) {
     2979            psFree(object);
     2980            exit(EXIT_FAILURE);
     2981        }
     2982
     2983        psFree(object);
     2984    }
     2985
     2986    {
     2987        flatcorrExpRow  *object;
     2988
     2989        object = flatcorrExpRowAlloc(-64, -64    );
     2990
     2991        if (!object) {
     2992            exit(EXIT_FAILURE);
     2993        }
     2994
     2995        if (!object->corr_id == -64) {
     2996            psFree(object);
     2997            exit(EXIT_FAILURE);
     2998        }
     2999        if (!object->chip_id == -64) {
     3000            psFree(object);
     3001            exit(EXIT_FAILURE);
     3002        }
     3003
     3004        psFree(object);
     3005    }
     3006
     3007    {
     3008        pstampDataStoreRow *object;
     3009
     3010        object = pstampDataStoreRowAlloc(-64, "a string", "a string", "a string", "a string"    );
     3011
     3012        if (!object) {
     3013            exit(EXIT_FAILURE);
     3014        }
     3015
     3016        if (!object->ds_id == -64) {
     3017            psFree(object);
     3018            exit(EXIT_FAILURE);
     3019        }
     3020        if (strncmp(object->state, "a string", MAX_STRING_LENGTH)) {
     3021            psFree(object);
     3022            exit(EXIT_FAILURE);
     3023        }
     3024        if (strncmp(object->lastFileset, "a string", MAX_STRING_LENGTH)) {
     3025            psFree(object);
     3026            exit(EXIT_FAILURE);
     3027        }
     3028        if (strncmp(object->outProduct, "a string", MAX_STRING_LENGTH)) {
    28813029            psFree(object);
    28823030            exit(EXIT_FAILURE);
     
    28913039
    28923040    {
    2893         calDBRow        *object;
    2894 
    2895         object = calDBRowAlloc(-64, "a string", "a string"    );
    2896 
    2897         if (!object) {
    2898             exit(EXIT_FAILURE);
    2899         }
    2900 
    2901         if (!object->cal_id == -64) {
    2902             psFree(object);
    2903             exit(EXIT_FAILURE);
    2904         }
    2905         if (strncmp(object->dvodb, "a string", MAX_STRING_LENGTH)) {
     3041        pstampRequestRow *object;
     3042
     3043        object = pstampRequestRowAlloc(-64, -64, "a string", "a string", "a string", "a string", "a string", -32    );
     3044
     3045        if (!object) {
     3046            exit(EXIT_FAILURE);
     3047        }
     3048
     3049        if (!object->req_id == -64) {
     3050            psFree(object);
     3051            exit(EXIT_FAILURE);
     3052        }
     3053        if (!object->ds_id == -64) {
    29063054            psFree(object);
    29073055            exit(EXIT_FAILURE);
     
    29113059            exit(EXIT_FAILURE);
    29123060        }
    2913 
    2914         psFree(object);
    2915     }
    2916 
    2917     {
    2918         calRunRow       *object;
    2919 
    2920         object = calRunRowAlloc(-64, "a string", "a string", "a string"    );
    2921 
    2922         if (!object) {
    2923             exit(EXIT_FAILURE);
    2924         }
    2925 
    2926         if (!object->cal_id == -64) {
    2927             psFree(object);
    2928             exit(EXIT_FAILURE);
    2929         }
    2930         if (strncmp(object->region, "a string", MAX_STRING_LENGTH)) {
    2931             psFree(object);
    2932             exit(EXIT_FAILURE);
    2933         }
    2934         if (strncmp(object->last_step, "a string", MAX_STRING_LENGTH)) {
     3061        if (strncmp(object->name, "a string", MAX_STRING_LENGTH)) {
     3062            psFree(object);
     3063            exit(EXIT_FAILURE);
     3064        }
     3065        if (strncmp(object->reqType, "a string", MAX_STRING_LENGTH)) {
     3066            psFree(object);
     3067            exit(EXIT_FAILURE);
     3068        }
     3069        if (strncmp(object->outProduct, "a string", MAX_STRING_LENGTH)) {
     3070            psFree(object);
     3071            exit(EXIT_FAILURE);
     3072        }
     3073        if (strncmp(object->uri, "a string", MAX_STRING_LENGTH)) {
     3074            psFree(object);
     3075            exit(EXIT_FAILURE);
     3076        }
     3077        if (!object->fault == -32) {
     3078            psFree(object);
     3079            exit(EXIT_FAILURE);
     3080        }
     3081
     3082        psFree(object);
     3083    }
     3084
     3085    {
     3086        pstampJobRow    *object;
     3087
     3088        object = pstampJobRowAlloc(-64, -64, "a string", "a string", "a string", -32, "a string", "a string", "a string"    );
     3089
     3090        if (!object) {
     3091            exit(EXIT_FAILURE);
     3092        }
     3093
     3094        if (!object->job_id == -64) {
     3095            psFree(object);
     3096            exit(EXIT_FAILURE);
     3097        }
     3098        if (!object->req_id == -64) {
     3099            psFree(object);
     3100            exit(EXIT_FAILURE);
     3101        }
     3102        if (strncmp(object->rownum, "a string", MAX_STRING_LENGTH)) {
    29353103            psFree(object);
    29363104            exit(EXIT_FAILURE);
     
    29403108            exit(EXIT_FAILURE);
    29413109        }
    2942 
    2943         psFree(object);
    2944     }
    2945 
    2946     {
    2947         flatcorrRunRow  *object;
    2948 
    2949         object = flatcorrRunRowAlloc(-64, "a string", "a string", "a string", "a string", "a string", "a string", "a string"    );
    2950 
    2951         if (!object) {
    2952             exit(EXIT_FAILURE);
    2953         }
    2954 
    2955         if (!object->corr_id == -64) {
    2956             psFree(object);
    2957             exit(EXIT_FAILURE);
    2958         }
    2959         if (strncmp(object->dvodb, "a string", MAX_STRING_LENGTH)) {
    2960             psFree(object);
    2961             exit(EXIT_FAILURE);
    2962         }
    2963         if (strncmp(object->filter, "a string", MAX_STRING_LENGTH)) {
    2964             psFree(object);
    2965             exit(EXIT_FAILURE);
    2966         }
    2967         if (strncmp(object->state, "a string", MAX_STRING_LENGTH)) {
    2968             psFree(object);
    2969             exit(EXIT_FAILURE);
    2970         }
    2971         if (strncmp(object->workdir, "a string", MAX_STRING_LENGTH)) {
    2972             psFree(object);
    2973             exit(EXIT_FAILURE);
    2974         }
    2975         if (strncmp(object->label, "a string", MAX_STRING_LENGTH)) {
    2976             psFree(object);
    2977             exit(EXIT_FAILURE);
    2978         }
    2979         if (strncmp(object->stats, "a string", MAX_STRING_LENGTH)) {
    2980             psFree(object);
    2981             exit(EXIT_FAILURE);
    2982         }
    2983         if (strncmp(object->region, "a string", MAX_STRING_LENGTH)) {
    2984             psFree(object);
    2985             exit(EXIT_FAILURE);
    2986         }
    2987 
    2988         psFree(object);
    2989     }
    2990 
    2991     {
    2992         flatcorrExpRow  *object;
    2993 
    2994         object = flatcorrExpRowAlloc(-64, -64    );
    2995 
    2996         if (!object) {
    2997             exit(EXIT_FAILURE);
    2998         }
    2999 
    3000         if (!object->corr_id == -64) {
    3001             psFree(object);
    3002             exit(EXIT_FAILURE);
    3003         }
    3004         if (!object->chip_id == -64) {
    3005             psFree(object);
    3006             exit(EXIT_FAILURE);
    3007         }
    3008 
    3009         psFree(object);
    3010     }
    3011 
    3012     {
    3013         pstampDataStoreRow *object;
    3014 
    3015         object = pstampDataStoreRowAlloc(-64, "a string", "a string", "a string", "a string"    );
    3016 
    3017         if (!object) {
    3018             exit(EXIT_FAILURE);
    3019         }
    3020 
    3021         if (!object->ds_id == -64) {
    3022             psFree(object);
    3023             exit(EXIT_FAILURE);
    3024         }
    3025         if (strncmp(object->state, "a string", MAX_STRING_LENGTH)) {
    3026             psFree(object);
    3027             exit(EXIT_FAILURE);
    3028         }
    3029         if (strncmp(object->lastFileset, "a string", MAX_STRING_LENGTH)) {
    3030             psFree(object);
    3031             exit(EXIT_FAILURE);
    3032         }
    3033         if (strncmp(object->outProduct, "a string", MAX_STRING_LENGTH)) {
    3034             psFree(object);
    3035             exit(EXIT_FAILURE);
    3036         }
    3037         if (strncmp(object->uri, "a string", MAX_STRING_LENGTH)) {
    3038             psFree(object);
    3039             exit(EXIT_FAILURE);
    3040         }
    3041 
    3042         psFree(object);
    3043     }
    3044 
    3045     {
    3046         pstampRequestRow *object;
    3047 
    3048         object = pstampRequestRowAlloc(-64, -64, "a string", "a string", "a string", -16    );
    3049 
    3050         if (!object) {
    3051             exit(EXIT_FAILURE);
    3052         }
    3053 
    3054         if (!object->req_id == -64) {
    3055             psFree(object);
    3056             exit(EXIT_FAILURE);
    3057         }
    3058         if (!object->ds_id == -64) {
    3059             psFree(object);
    3060             exit(EXIT_FAILURE);
    3061         }
    3062         if (strncmp(object->state, "a string", MAX_STRING_LENGTH)) {
    3063             psFree(object);
    3064             exit(EXIT_FAILURE);
    3065         }
    3066         if (strncmp(object->outFileset, "a string", MAX_STRING_LENGTH)) {
    3067             psFree(object);
    3068             exit(EXIT_FAILURE);
    3069         }
    3070         if (strncmp(object->uri, "a string", MAX_STRING_LENGTH)) {
    3071             psFree(object);
    3072             exit(EXIT_FAILURE);
    3073         }
    3074         if (!object->resultsFile == -16) {
    3075             psFree(object);
    3076             exit(EXIT_FAILURE);
    3077         }
    3078 
    3079         psFree(object);
    3080     }
    3081 
    3082     {
    3083         pstampJobRow    *object;
    3084 
    3085         object = pstampJobRowAlloc(-64, -64, "a string", "a string", -32, "a string", "a string", "a string"    );
    3086 
    3087         if (!object) {
    3088             exit(EXIT_FAILURE);
    3089         }
    3090 
    3091         if (!object->job_id == -64) {
    3092             psFree(object);
    3093             exit(EXIT_FAILURE);
    3094         }
    3095         if (!object->req_id == -64) {
    3096             psFree(object);
    3097             exit(EXIT_FAILURE);
    3098         }
    3099         if (strncmp(object->state, "a string", MAX_STRING_LENGTH)) {
    3100             psFree(object);
    3101             exit(EXIT_FAILURE);
    3102         }
    31033110        if (strncmp(object->jobType, "a string", MAX_STRING_LENGTH)) {
    31043111            psFree(object);
    31053112            exit(EXIT_FAILURE);
    31063113        }
    3107         if (!object->result == -32) {
     3114        if (!object->fault == -32) {
    31083115            psFree(object);
    31093116            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/createtable.c

    r18044 r18595  
    733733        }
    734734
    735         if(!magicSkyfileMaskCreateTable(dbh)) {
    736             exit(EXIT_FAILURE);
    737         }
    738 
    739         psDBCleanup(dbh);
    740     }
    741 
    742     {
    743         psDB            *dbh;
    744 
    745         dbh = psDBInit("localhost", "test", NULL, "test");
    746         if (!dbh) {
    747             exit(EXIT_FAILURE);
    748         }
    749 
    750735        if(!calDBCreateTable(dbh)) {
    751736            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/dbcleanup.c

    r18044 r18595  
    5959    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS magicNodeResult");
    6060    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS magicMask");
    61     p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS magicSkyfileMask");
    6261    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS calDB");
    6362    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS calRun");
  • trunk/ippdb/tests/dbsetup.c

    r18044 r18595  
    157157    magicMaskCreateTable(dbh);
    158158
    159     p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS magicSkyfileMask");
    160     magicSkyfileMaskCreateTable(dbh);
    161 
    162159    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS calDB");
    163160    calDBCreateTable(dbh);
  • trunk/ippdb/tests/droptable.c

    r18044 r18595  
    733733        }
    734734
    735         if (!magicSkyfileMaskDropTable(dbh)) {
    736             exit(EXIT_FAILURE);
    737         }
    738 
    739         psDBCleanup(dbh);
    740     }
    741 
    742     {
    743         psDB            *dbh;
    744 
    745         dbh = psDBInit("localhost", "test", NULL, "test");
    746         if (!dbh) {
    747             exit(EXIT_FAILURE);
    748         }
    749 
    750735        if (!calDBDropTable(dbh)) {
    751736            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/insert.c

    r18044 r18595  
    403403        }
    404404
    405         if (!stackRunInsert(dbh, -64, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string")) {
     405        if (!stackRunInsert(dbh, -64, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string", "a string")) {
    406406            exit(EXIT_FAILURE);
    407407        }
     
    658658        }
    659659
    660         if (!magicRunInsert(dbh, -64, "a string", "a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z")) {
     660        if (!magicRunInsert(dbh, -64, "a string", "a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", -16)) {
    661661            exit(EXIT_FAILURE);
    662662        }
     
    703703        }
    704704
    705         if (!magicNodeResultInsert(dbh, -64, "a string", "a string")) {
    706             exit(EXIT_FAILURE);
    707         }
    708 
    709         psDBCleanup(dbh);
    710     }
    711 
    712     {
    713         psDB            *dbh;
    714 
    715         dbh = psDBInit("localhost", "test", NULL, "test");
    716         if (!dbh) {
    717             exit(EXIT_FAILURE);
    718         }
    719 
    720         if (!magicMaskInsert(dbh, -64, "a string")) {
    721             exit(EXIT_FAILURE);
    722         }
    723 
    724         psDBCleanup(dbh);
    725     }
    726 
    727     {
    728         psDB            *dbh;
    729 
    730         dbh = psDBInit("localhost", "test", NULL, "test");
    731         if (!dbh) {
    732             exit(EXIT_FAILURE);
    733         }
    734 
    735         if (!magicSkyfileMaskInsert(dbh, -64, -64, "a string")) {
     705        if (!magicNodeResultInsert(dbh, -64, "a string", "a string", -16)) {
     706            exit(EXIT_FAILURE);
     707        }
     708
     709        psDBCleanup(dbh);
     710    }
     711
     712    {
     713        psDB            *dbh;
     714
     715        dbh = psDBInit("localhost", "test", NULL, "test");
     716        if (!dbh) {
     717            exit(EXIT_FAILURE);
     718        }
     719
     720        if (!magicMaskInsert(dbh, -64, "a string", -32, -16)) {
    736721            exit(EXIT_FAILURE);
    737722        }
     
    823808        }
    824809
    825         if (!pstampRequestInsert(dbh, -64, -64, "a string", "a string", "a string", -16)) {
    826             exit(EXIT_FAILURE);
    827         }
    828 
    829         psDBCleanup(dbh);
    830     }
    831 
    832     {
    833         psDB            *dbh;
    834 
    835         dbh = psDBInit("localhost", "test", NULL, "test");
    836         if (!dbh) {
    837             exit(EXIT_FAILURE);
    838         }
    839 
    840         if (!pstampJobInsert(dbh, -64, -64, "a string", "a string", -32, "a string", "a string", "a string")) {
     810        if (!pstampRequestInsert(dbh, -64, -64, "a string", "a string", "a string", "a string", "a string", -32)) {
     811            exit(EXIT_FAILURE);
     812        }
     813
     814        psDBCleanup(dbh);
     815    }
     816
     817    {
     818        psDB            *dbh;
     819
     820        dbh = psDBInit("localhost", "test", NULL, "test");
     821        if (!dbh) {
     822            exit(EXIT_FAILURE);
     823        }
     824
     825        if (!pstampJobInsert(dbh, -64, -64, "a string", "a string", "a string", -32, "a string", "a string", "a string")) {
    841826            exit(EXIT_FAILURE);
    842827        }
  • trunk/ippdb/tests/insertfits.c

    r18044 r18595  
    12721272        }
    12731273
    1274         if (!magicSkyfileMaskInsertFits(dbh, fits)) {
    1275             exit(EXIT_FAILURE);
    1276         }
    1277 
    1278         if (!psFitsClose(fits)) {
    1279             exit(EXIT_FAILURE);
    1280         }
    1281 
    1282         psDBCleanup(dbh);
    1283     }
    1284 
    1285     {
    1286         psDB            *dbh;
    1287         psFits          *fits;
    1288 
    1289         dbh = psDBInit("localhost", "test", NULL, "test");
    1290         if (!dbh) {
    1291             exit(EXIT_FAILURE);
    1292         }
    1293 
    1294         // open a temp
    1295         fits = psFitsOpen(TMP_FILENAME, "r");
    1296         if (!fits) {
    1297             exit(EXIT_FAILURE);
    1298         }
    1299 
    13001274        if (!calDBInsertFits(dbh, fits)) {
    13011275            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/insertobject.c

    r18044 r18595  
    586586        }
    587587
    588         object = stackRunRowAlloc(-64, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string");
     588        object = stackRunRowAlloc(-64, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string", "a string");
    589589        if (!object) {
    590590            exit(EXIT_FAILURE);
     
    960960        }
    961961
    962         object = magicRunRowAlloc(-64, "a string", "a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z");
     962        object = magicRunRowAlloc(-64, "a string", "a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", -16);
    963963        if (!object) {
    964964            exit(EXIT_FAILURE);
     
    10261026        }
    10271027
    1028         object = magicNodeResultRowAlloc(-64, "a string", "a string");
     1028        object = magicNodeResultRowAlloc(-64, "a string", "a string", -16);
    10291029        if (!object) {
    10301030            exit(EXIT_FAILURE);
     
    10481048        }
    10491049
    1050         object = magicMaskRowAlloc(-64, "a string");
     1050        object = magicMaskRowAlloc(-64, "a string", -32, -16);
    10511051        if (!object) {
    10521052            exit(EXIT_FAILURE);
     
    10631063    {
    10641064        psDB            *dbh;
    1065         magicSkyfileMaskRow *object;
    1066 
    1067         dbh = psDBInit("localhost", "test", NULL, "test");
    1068         if (!dbh) {
    1069             exit(EXIT_FAILURE);
    1070         }
    1071 
    1072         object = magicSkyfileMaskRowAlloc(-64, -64, "a string");
    1073         if (!object) {
    1074             exit(EXIT_FAILURE);
    1075         }
    1076 
    1077         if (!magicSkyfileMaskInsertObject(dbh, object)) {
    1078             exit(EXIT_FAILURE);
    1079         }
    1080 
    1081         psFree(object);
    1082         psDBCleanup(dbh);
    1083     }
    1084 
    1085     {
    1086         psDB            *dbh;
    10871065        calDBRow        *object;
    10881066
     
    12021180        }
    12031181
    1204         object = pstampRequestRowAlloc(-64, -64, "a string", "a string", "a string", -16);
     1182        object = pstampRequestRowAlloc(-64, -64, "a string", "a string", "a string", "a string", "a string", -32);
    12051183        if (!object) {
    12061184            exit(EXIT_FAILURE);
     
    12241202        }
    12251203
    1226         object = pstampJobRowAlloc(-64, -64, "a string", "a string", -32, "a string", "a string", "a string");
     1204        object = pstampJobRowAlloc(-64, -64, "a string", "a string", "a string", -32, "a string", "a string", "a string");
    12271205        if (!object) {
    12281206            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/metadatafromobject.c

    r18044 r18595  
    18311831        bool            status;
    18321832
    1833         object = stackRunRowAlloc(-64, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string");
     1833        object = stackRunRowAlloc(-64, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string", "a string");
    18341834        if (!object) {
    18351835            exit(EXIT_FAILURE);
     
    18691869            exit(EXIT_FAILURE);
    18701870        }
     1871        if (strncmp(psMetadataLookupPtr(&status, md, "filter"), "a string", MAX_STRING_LENGTH)) {
     1872            psFree(md);
     1873            exit(EXIT_FAILURE);
     1874        }
    18711875
    18721876        psFree(md);
     
    30033007        bool            status;
    30043008
    3005         object = magicRunRowAlloc(-64, "a string", "a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z");
     3009        object = magicRunRowAlloc(-64, "a string", "a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", -16);
    30063010        if (!object) {
    30073011            exit(EXIT_FAILURE);
     
    30413045            exit(EXIT_FAILURE);
    30423046        }
     3047            psFree(md);
     3048            exit(EXIT_FAILURE);
     3049        }
    30433050
    30443051        psFree(md);
     
    31133120        bool            status;
    31143121
    3115         object = magicNodeResultRowAlloc(-64, "a string", "a string");
     3122        object = magicNodeResultRowAlloc(-64, "a string", "a string", -16);
    31163123        if (!object) {
    31173124            exit(EXIT_FAILURE);
     
    31363143            exit(EXIT_FAILURE);
    31373144        }
     3145            psFree(md);
     3146            exit(EXIT_FAILURE);
     3147        }
    31383148
    31393149        psFree(md);
     
    31453155        bool            status;
    31463156
    3147         object = magicMaskRowAlloc(-64, "a string");
     3157        object = magicMaskRowAlloc(-64, "a string", -32, -16);
    31483158        if (!object) {
    31493159            exit(EXIT_FAILURE);
     
    31643174            exit(EXIT_FAILURE);
    31653175        }
    3166 
    3167         psFree(md);
    3168     }
    3169 
    3170     {
    3171         psMetadata      *md;
    3172         magicSkyfileMaskRow *object;
    3173         bool            status;
    3174 
    3175         object = magicSkyfileMaskRowAlloc(-64, -64, "a string");
    3176         if (!object) {
    3177             exit(EXIT_FAILURE);
    3178         }
    3179 
    3180         md = magicSkyfileMaskMetadataFromObject(object);
    3181         if (!md) {
    3182             exit(EXIT_FAILURE);
    3183         }
    3184 
    3185         psFree(object);
    3186 
    3187             psFree(md);
    3188             exit(EXIT_FAILURE);
    3189         }
     3176        if (!psMetadataLookupS32(&status, md, "streaks") == -32) {
     3177            psFree(md);
     3178            exit(EXIT_FAILURE);
     3179        }
     3180            psFree(md);
     3181            exit(EXIT_FAILURE);
     3182        }
     3183
     3184        psFree(md);
     3185    }
     3186
     3187    {
     3188        psMetadata      *md;
     3189        calDBRow        *object;
     3190        bool            status;
     3191
     3192        object = calDBRowAlloc(-64, "a string", "a string");
     3193        if (!object) {
     3194            exit(EXIT_FAILURE);
     3195        }
     3196
     3197        md = calDBMetadataFromObject(object);
     3198        if (!md) {
     3199            exit(EXIT_FAILURE);
     3200        }
     3201
     3202        psFree(object);
     3203
     3204            psFree(md);
     3205            exit(EXIT_FAILURE);
     3206        }
     3207        if (strncmp(psMetadataLookupPtr(&status, md, "dvodb"), "a string", MAX_STRING_LENGTH)) {
     3208            psFree(md);
     3209            exit(EXIT_FAILURE);
     3210        }
     3211        if (strncmp(psMetadataLookupPtr(&status, md, "state"), "a string", MAX_STRING_LENGTH)) {
     3212            psFree(md);
     3213            exit(EXIT_FAILURE);
     3214        }
     3215
     3216        psFree(md);
     3217    }
     3218
     3219    {
     3220        psMetadata      *md;
     3221        calRunRow       *object;
     3222        bool            status;
     3223
     3224        object = calRunRowAlloc(-64, "a string", "a string", "a string");
     3225        if (!object) {
     3226            exit(EXIT_FAILURE);
     3227        }
     3228
     3229        md = calRunMetadataFromObject(object);
     3230        if (!md) {
     3231            exit(EXIT_FAILURE);
     3232        }
     3233
     3234        psFree(object);
     3235
     3236            psFree(md);
     3237            exit(EXIT_FAILURE);
     3238        }
     3239        if (strncmp(psMetadataLookupPtr(&status, md, "region"), "a string", MAX_STRING_LENGTH)) {
     3240            psFree(md);
     3241            exit(EXIT_FAILURE);
     3242        }
     3243        if (strncmp(psMetadataLookupPtr(&status, md, "last_step"), "a string", MAX_STRING_LENGTH)) {
     3244            psFree(md);
     3245            exit(EXIT_FAILURE);
     3246        }
     3247        if (strncmp(psMetadataLookupPtr(&status, md, "state"), "a string", MAX_STRING_LENGTH)) {
     3248            psFree(md);
     3249            exit(EXIT_FAILURE);
     3250        }
     3251
     3252        psFree(md);
     3253    }
     3254
     3255    {
     3256        psMetadata      *md;
     3257        flatcorrRunRow  *object;
     3258        bool            status;
     3259
     3260        object = flatcorrRunRowAlloc(-64, "a string", "a string", "a string", "a string", "a string", "a string", "a string");
     3261        if (!object) {
     3262            exit(EXIT_FAILURE);
     3263        }
     3264
     3265        md = flatcorrRunMetadataFromObject(object);
     3266        if (!md) {
     3267            exit(EXIT_FAILURE);
     3268        }
     3269
     3270        psFree(object);
     3271
     3272            psFree(md);
     3273            exit(EXIT_FAILURE);
     3274        }
     3275        if (strncmp(psMetadataLookupPtr(&status, md, "dvodb"), "a string", MAX_STRING_LENGTH)) {
     3276            psFree(md);
     3277            exit(EXIT_FAILURE);
     3278        }
     3279        if (strncmp(psMetadataLookupPtr(&status, md, "filter"), "a string", MAX_STRING_LENGTH)) {
     3280            psFree(md);
     3281            exit(EXIT_FAILURE);
     3282        }
     3283        if (strncmp(psMetadataLookupPtr(&status, md, "state"), "a string", MAX_STRING_LENGTH)) {
     3284            psFree(md);
     3285            exit(EXIT_FAILURE);
     3286        }
     3287        if (strncmp(psMetadataLookupPtr(&status, md, "workdir"), "a string", MAX_STRING_LENGTH)) {
     3288            psFree(md);
     3289            exit(EXIT_FAILURE);
     3290        }
     3291        if (strncmp(psMetadataLookupPtr(&status, md, "label"), "a string", MAX_STRING_LENGTH)) {
     3292            psFree(md);
     3293            exit(EXIT_FAILURE);
     3294        }
     3295        if (strncmp(psMetadataLookupPtr(&status, md, "stats"), "a string", MAX_STRING_LENGTH)) {
     3296            psFree(md);
     3297            exit(EXIT_FAILURE);
     3298        }
     3299        if (strncmp(psMetadataLookupPtr(&status, md, "region"), "a string", MAX_STRING_LENGTH)) {
     3300            psFree(md);
     3301            exit(EXIT_FAILURE);
     3302        }
     3303
     3304        psFree(md);
     3305    }
     3306
     3307    {
     3308        psMetadata      *md;
     3309        flatcorrExpRow  *object;
     3310        bool            status;
     3311
     3312        object = flatcorrExpRowAlloc(-64, -64);
     3313        if (!object) {
     3314            exit(EXIT_FAILURE);
     3315        }
     3316
     3317        md = flatcorrExpMetadataFromObject(object);
     3318        if (!md) {
     3319            exit(EXIT_FAILURE);
     3320        }
     3321
     3322        psFree(object);
     3323
     3324            psFree(md);
     3325            exit(EXIT_FAILURE);
     3326        }
     3327            psFree(md);
     3328            exit(EXIT_FAILURE);
     3329        }
     3330
     3331        psFree(md);
     3332    }
     3333
     3334    {
     3335        psMetadata      *md;
     3336        pstampDataStoreRow *object;
     3337        bool            status;
     3338
     3339        object = pstampDataStoreRowAlloc(-64, "a string", "a string", "a string", "a string");
     3340        if (!object) {
     3341            exit(EXIT_FAILURE);
     3342        }
     3343
     3344        md = pstampDataStoreMetadataFromObject(object);
     3345        if (!md) {
     3346            exit(EXIT_FAILURE);
     3347        }
     3348
     3349        psFree(object);
     3350
     3351            psFree(md);
     3352            exit(EXIT_FAILURE);
     3353        }
     3354        if (strncmp(psMetadataLookupPtr(&status, md, "state"), "a string", MAX_STRING_LENGTH)) {
     3355            psFree(md);
     3356            exit(EXIT_FAILURE);
     3357        }
     3358        if (strncmp(psMetadataLookupPtr(&status, md, "lastFileset"), "a string", MAX_STRING_LENGTH)) {
     3359            psFree(md);
     3360            exit(EXIT_FAILURE);
     3361        }
     3362        if (strncmp(psMetadataLookupPtr(&status, md, "outProduct"), "a string", MAX_STRING_LENGTH)) {
    31903363            psFree(md);
    31913364            exit(EXIT_FAILURE);
     
    32013374    {
    32023375        psMetadata      *md;
    3203         calDBRow        *object;
    3204         bool            status;
    3205 
    3206         object = calDBRowAlloc(-64, "a string", "a string");
    3207         if (!object) {
    3208             exit(EXIT_FAILURE);
    3209         }
    3210 
    3211         md = calDBMetadataFromObject(object);
    3212         if (!md) {
    3213             exit(EXIT_FAILURE);
    3214         }
    3215 
    3216         psFree(object);
    3217 
    3218             psFree(md);
    3219             exit(EXIT_FAILURE);
    3220         }
    3221         if (strncmp(psMetadataLookupPtr(&status, md, "dvodb"), "a string", MAX_STRING_LENGTH)) {
     3376        pstampRequestRow *object;
     3377        bool            status;
     3378
     3379        object = pstampRequestRowAlloc(-64, -64, "a string", "a string", "a string", "a string", "a string", -32);
     3380        if (!object) {
     3381            exit(EXIT_FAILURE);
     3382        }
     3383
     3384        md = pstampRequestMetadataFromObject(object);
     3385        if (!md) {
     3386            exit(EXIT_FAILURE);
     3387        }
     3388
     3389        psFree(object);
     3390
     3391            psFree(md);
     3392            exit(EXIT_FAILURE);
     3393        }
    32223394            psFree(md);
    32233395            exit(EXIT_FAILURE);
     
    32273399            exit(EXIT_FAILURE);
    32283400        }
    3229 
    3230         psFree(md);
    3231     }
    3232 
    3233     {
    3234         psMetadata      *md;
    3235         calRunRow       *object;
    3236         bool            status;
    3237 
    3238         object = calRunRowAlloc(-64, "a string", "a string", "a string");
    3239         if (!object) {
    3240             exit(EXIT_FAILURE);
    3241         }
    3242 
    3243         md = calRunMetadataFromObject(object);
    3244         if (!md) {
    3245             exit(EXIT_FAILURE);
    3246         }
    3247 
    3248         psFree(object);
    3249 
    3250             psFree(md);
    3251             exit(EXIT_FAILURE);
    3252         }
    3253         if (strncmp(psMetadataLookupPtr(&status, md, "region"), "a string", MAX_STRING_LENGTH)) {
    3254             psFree(md);
    3255             exit(EXIT_FAILURE);
    3256         }
    3257         if (strncmp(psMetadataLookupPtr(&status, md, "last_step"), "a string", MAX_STRING_LENGTH)) {
     3401        if (strncmp(psMetadataLookupPtr(&status, md, "name"), "a string", MAX_STRING_LENGTH)) {
     3402            psFree(md);
     3403            exit(EXIT_FAILURE);
     3404        }
     3405        if (strncmp(psMetadataLookupPtr(&status, md, "reqType"), "a string", MAX_STRING_LENGTH)) {
     3406            psFree(md);
     3407            exit(EXIT_FAILURE);
     3408        }
     3409        if (strncmp(psMetadataLookupPtr(&status, md, "outProduct"), "a string", MAX_STRING_LENGTH)) {
     3410            psFree(md);
     3411            exit(EXIT_FAILURE);
     3412        }
     3413        if (strncmp(psMetadataLookupPtr(&status, md, "uri"), "a string", MAX_STRING_LENGTH)) {
     3414            psFree(md);
     3415            exit(EXIT_FAILURE);
     3416        }
     3417        if (!psMetadataLookupS32(&status, md, "fault") == -32) {
     3418            psFree(md);
     3419            exit(EXIT_FAILURE);
     3420        }
     3421
     3422        psFree(md);
     3423    }
     3424
     3425    {
     3426        psMetadata      *md;
     3427        pstampJobRow    *object;
     3428        bool            status;
     3429
     3430        object = pstampJobRowAlloc(-64, -64, "a string", "a string", "a string", -32, "a string", "a string", "a string");
     3431        if (!object) {
     3432            exit(EXIT_FAILURE);
     3433        }
     3434
     3435        md = pstampJobMetadataFromObject(object);
     3436        if (!md) {
     3437            exit(EXIT_FAILURE);
     3438        }
     3439
     3440        psFree(object);
     3441
     3442            psFree(md);
     3443            exit(EXIT_FAILURE);
     3444        }
     3445            psFree(md);
     3446            exit(EXIT_FAILURE);
     3447        }
     3448        if (strncmp(psMetadataLookupPtr(&status, md, "rownum"), "a string", MAX_STRING_LENGTH)) {
    32583449            psFree(md);
    32593450            exit(EXIT_FAILURE);
     
    32633454            exit(EXIT_FAILURE);
    32643455        }
    3265 
    3266         psFree(md);
    3267     }
    3268 
    3269     {
    3270         psMetadata      *md;
    3271         flatcorrRunRow  *object;
    3272         bool            status;
    3273 
    3274         object = flatcorrRunRowAlloc(-64, "a string", "a string", "a string", "a string", "a string", "a string", "a string");
    3275         if (!object) {
    3276             exit(EXIT_FAILURE);
    3277         }
    3278 
    3279         md = flatcorrRunMetadataFromObject(object);
    3280         if (!md) {
    3281             exit(EXIT_FAILURE);
    3282         }
    3283 
    3284         psFree(object);
    3285 
    3286             psFree(md);
    3287             exit(EXIT_FAILURE);
    3288         }
    3289         if (strncmp(psMetadataLookupPtr(&status, md, "dvodb"), "a string", MAX_STRING_LENGTH)) {
    3290             psFree(md);
    3291             exit(EXIT_FAILURE);
    3292         }
    3293         if (strncmp(psMetadataLookupPtr(&status, md, "filter"), "a string", MAX_STRING_LENGTH)) {
    3294             psFree(md);
    3295             exit(EXIT_FAILURE);
    3296         }
    3297         if (strncmp(psMetadataLookupPtr(&status, md, "state"), "a string", MAX_STRING_LENGTH)) {
    3298             psFree(md);
    3299             exit(EXIT_FAILURE);
    3300         }
    3301         if (strncmp(psMetadataLookupPtr(&status, md, "workdir"), "a string", MAX_STRING_LENGTH)) {
    3302             psFree(md);
    3303             exit(EXIT_FAILURE);
    3304         }
    3305         if (strncmp(psMetadataLookupPtr(&status, md, "label"), "a string", MAX_STRING_LENGTH)) {
    3306             psFree(md);
    3307             exit(EXIT_FAILURE);
    3308         }
    3309         if (strncmp(psMetadataLookupPtr(&status, md, "stats"), "a string", MAX_STRING_LENGTH)) {
    3310             psFree(md);
    3311             exit(EXIT_FAILURE);
    3312         }
    3313         if (strncmp(psMetadataLookupPtr(&status, md, "region"), "a string", MAX_STRING_LENGTH)) {
    3314             psFree(md);
    3315             exit(EXIT_FAILURE);
    3316         }
    3317 
    3318         psFree(md);
    3319     }
    3320 
    3321     {
    3322         psMetadata      *md;
    3323         flatcorrExpRow  *object;
    3324         bool            status;
    3325 
    3326         object = flatcorrExpRowAlloc(-64, -64);
    3327         if (!object) {
    3328             exit(EXIT_FAILURE);
    3329         }
    3330 
    3331         md = flatcorrExpMetadataFromObject(object);
    3332         if (!md) {
    3333             exit(EXIT_FAILURE);
    3334         }
    3335 
    3336         psFree(object);
    3337 
    3338             psFree(md);
    3339             exit(EXIT_FAILURE);
    3340         }
    3341             psFree(md);
    3342             exit(EXIT_FAILURE);
    3343         }
    3344 
    3345         psFree(md);
    3346     }
    3347 
    3348     {
    3349         psMetadata      *md;
    3350         pstampDataStoreRow *object;
    3351         bool            status;
    3352 
    3353         object = pstampDataStoreRowAlloc(-64, "a string", "a string", "a string", "a string");
    3354         if (!object) {
    3355             exit(EXIT_FAILURE);
    3356         }
    3357 
    3358         md = pstampDataStoreMetadataFromObject(object);
    3359         if (!md) {
    3360             exit(EXIT_FAILURE);
    3361         }
    3362 
    3363         psFree(object);
    3364 
    3365             psFree(md);
    3366             exit(EXIT_FAILURE);
    3367         }
    3368         if (strncmp(psMetadataLookupPtr(&status, md, "state"), "a string", MAX_STRING_LENGTH)) {
    3369             psFree(md);
    3370             exit(EXIT_FAILURE);
    3371         }
    3372         if (strncmp(psMetadataLookupPtr(&status, md, "lastFileset"), "a string", MAX_STRING_LENGTH)) {
    3373             psFree(md);
    3374             exit(EXIT_FAILURE);
    3375         }
    3376         if (strncmp(psMetadataLookupPtr(&status, md, "outProduct"), "a string", MAX_STRING_LENGTH)) {
    3377             psFree(md);
    3378             exit(EXIT_FAILURE);
    3379         }
    3380         if (strncmp(psMetadataLookupPtr(&status, md, "uri"), "a string", MAX_STRING_LENGTH)) {
    3381             psFree(md);
    3382             exit(EXIT_FAILURE);
    3383         }
    3384 
    3385         psFree(md);
    3386     }
    3387 
    3388     {
    3389         psMetadata      *md;
    3390         pstampRequestRow *object;
    3391         bool            status;
    3392 
    3393         object = pstampRequestRowAlloc(-64, -64, "a string", "a string", "a string", -16);
    3394         if (!object) {
    3395             exit(EXIT_FAILURE);
    3396         }
    3397 
    3398         md = pstampRequestMetadataFromObject(object);
    3399         if (!md) {
    3400             exit(EXIT_FAILURE);
    3401         }
    3402 
    3403         psFree(object);
    3404 
    3405             psFree(md);
    3406             exit(EXIT_FAILURE);
    3407         }
    3408             psFree(md);
    3409             exit(EXIT_FAILURE);
    3410         }
    3411         if (strncmp(psMetadataLookupPtr(&status, md, "state"), "a string", MAX_STRING_LENGTH)) {
    3412             psFree(md);
    3413             exit(EXIT_FAILURE);
    3414         }
    3415         if (strncmp(psMetadataLookupPtr(&status, md, "outFileset"), "a string", MAX_STRING_LENGTH)) {
    3416             psFree(md);
    3417             exit(EXIT_FAILURE);
    3418         }
    3419         if (strncmp(psMetadataLookupPtr(&status, md, "uri"), "a string", MAX_STRING_LENGTH)) {
    3420             psFree(md);
    3421             exit(EXIT_FAILURE);
    3422         }
    3423             psFree(md);
    3424             exit(EXIT_FAILURE);
    3425         }
    3426 
    3427         psFree(md);
    3428     }
    3429 
    3430     {
    3431         psMetadata      *md;
    3432         pstampJobRow    *object;
    3433         bool            status;
    3434 
    3435         object = pstampJobRowAlloc(-64, -64, "a string", "a string", -32, "a string", "a string", "a string");
    3436         if (!object) {
    3437             exit(EXIT_FAILURE);
    3438         }
    3439 
    3440         md = pstampJobMetadataFromObject(object);
    3441         if (!md) {
    3442             exit(EXIT_FAILURE);
    3443         }
    3444 
    3445         psFree(object);
    3446 
    3447             psFree(md);
    3448             exit(EXIT_FAILURE);
    3449         }
    3450             psFree(md);
    3451             exit(EXIT_FAILURE);
    3452         }
    3453         if (strncmp(psMetadataLookupPtr(&status, md, "state"), "a string", MAX_STRING_LENGTH)) {
    3454             psFree(md);
    3455             exit(EXIT_FAILURE);
    3456         }
    34573456        if (strncmp(psMetadataLookupPtr(&status, md, "jobType"), "a string", MAX_STRING_LENGTH)) {
    34583457            psFree(md);
    34593458            exit(EXIT_FAILURE);
    34603459        }
    3461         if (!psMetadataLookupS32(&status, md, "result") == -32) {
     3460        if (!psMetadataLookupS32(&status, md, "fault") == -32) {
    34623461            psFree(md);
    34633462            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/objectfrommetadata.c

    r18044 r18595  
    30513051            exit(EXIT_FAILURE);
    30523052        }
     3053        if (!psMetadataAddStr(md, PS_LIST_TAIL, "filter", 0, NULL, "a string")) {
     3054            psFree(md);
     3055            exit(EXIT_FAILURE);
     3056        }
    30533057
    30543058        object = stackRunObjectFromMetadata(md);
     
    30833087        }
    30843088        if (strncmp(object->tess_id, "a string", MAX_STRING_LENGTH)) {
     3089            psFree(object);
     3090            exit(EXIT_FAILURE);
     3091        }
     3092        if (strncmp(object->filter, "a string", MAX_STRING_LENGTH)) {
    30853093            psFree(object);
    30863094            exit(EXIT_FAILURE);
     
    49874995            exit(EXIT_FAILURE);
    49884996        }
     4997            psFree(md);
     4998            exit(EXIT_FAILURE);
     4999        }
    49895000
    49905001        object = magicRunObjectFromMetadata(md);
     
    50165027        }
    50175028        if (strncmp(object->dvodb, "a string", MAX_STRING_LENGTH)) {
     5029            psFree(object);
     5030            exit(EXIT_FAILURE);
     5031        }
    50185032            psFree(object);
    50195033            exit(EXIT_FAILURE);
     
    51205134            exit(EXIT_FAILURE);
    51215135        }
     5136            psFree(md);
     5137            exit(EXIT_FAILURE);
     5138        }
    51225139
    51235140        object = magicNodeResultObjectFromMetadata(md);
     
    51375154        }
    51385155        if (strncmp(object->uri, "a string", MAX_STRING_LENGTH)) {
     5156            psFree(object);
     5157            exit(EXIT_FAILURE);
     5158        }
    51395159            psFree(object);
    51405160            exit(EXIT_FAILURE);
     
    51565176            exit(EXIT_FAILURE);
    51575177        }
     5178        if (!psMetadataAddS32(md, PS_LIST_TAIL, "streaks", 0, NULL, -32)) {
     5179            psFree(md);
     5180            exit(EXIT_FAILURE);
     5181        }
     5182            psFree(md);
     5183            exit(EXIT_FAILURE);
     5184        }
    51585185
    51595186        object = magicMaskObjectFromMetadata(md);
     
    51725199            exit(EXIT_FAILURE);
    51735200        }
    5174 
    5175         psFree(object);
    5176     }
    5177 
    5178     {
    5179         psMetadata      *md;
    5180         magicSkyfileMaskRow *object;
    5181 
    5182         md = psMetadataAlloc();
    5183             psFree(md);
    5184             exit(EXIT_FAILURE);
    5185         }
    5186             psFree(md);
    5187             exit(EXIT_FAILURE);
    5188         }
    5189         if (!psMetadataAddStr(md, PS_LIST_TAIL, "uri", 0, NULL, "a string")) {
    5190             psFree(md);
    5191             exit(EXIT_FAILURE);
    5192         }
    5193 
    5194         object = magicSkyfileMaskObjectFromMetadata(md);
    5195         if (!object) {
    5196             psFree(md);
    5197             exit(EXIT_FAILURE);
    5198         }
    5199 
    5200         psFree(md);
    5201 
    5202             psFree(object);
    5203             exit(EXIT_FAILURE);
    5204         }
    5205             psFree(object);
    5206             exit(EXIT_FAILURE);
    5207         }
    5208         if (strncmp(object->uri, "a string", MAX_STRING_LENGTH)) {
     5201        if (!object->streaks == -32) {
     5202            psFree(object);
     5203            exit(EXIT_FAILURE);
     5204        }
    52095205            psFree(object);
    52105206            exit(EXIT_FAILURE);
     
    54835479            exit(EXIT_FAILURE);
    54845480        }
    5485         if (!psMetadataAddStr(md, PS_LIST_TAIL, "outFileset", 0, NULL, "a string")) {
     5481        if (!psMetadataAddStr(md, PS_LIST_TAIL, "name", 0, NULL, "a string")) {
     5482            psFree(md);
     5483            exit(EXIT_FAILURE);
     5484        }
     5485        if (!psMetadataAddStr(md, PS_LIST_TAIL, "reqType", 0, NULL, "a string")) {
     5486            psFree(md);
     5487            exit(EXIT_FAILURE);
     5488        }
     5489        if (!psMetadataAddStr(md, PS_LIST_TAIL, "outProduct", 0, NULL, "a string")) {
    54865490            psFree(md);
    54875491            exit(EXIT_FAILURE);
     
    54915495            exit(EXIT_FAILURE);
    54925496        }
     5497        if (!psMetadataAddS32(md, PS_LIST_TAIL, "fault", 0, NULL, -32)) {
    54935498            psFree(md);
    54945499            exit(EXIT_FAILURE);
     
    55135518            exit(EXIT_FAILURE);
    55145519        }
    5515         if (strncmp(object->outFileset, "a string", MAX_STRING_LENGTH)) {
     5520        if (strncmp(object->name, "a string", MAX_STRING_LENGTH)) {
     5521            psFree(object);
     5522            exit(EXIT_FAILURE);
     5523        }
     5524        if (strncmp(object->reqType, "a string", MAX_STRING_LENGTH)) {
     5525            psFree(object);
     5526            exit(EXIT_FAILURE);
     5527        }
     5528        if (strncmp(object->outProduct, "a string", MAX_STRING_LENGTH)) {
    55165529            psFree(object);
    55175530            exit(EXIT_FAILURE);
     
    55215534            exit(EXIT_FAILURE);
    55225535        }
     5536        if (!object->fault == -32) {
    55235537            psFree(object);
    55245538            exit(EXIT_FAILURE);
     
    55395553            exit(EXIT_FAILURE);
    55405554        }
     5555        if (!psMetadataAddStr(md, PS_LIST_TAIL, "rownum", 0, NULL, "a string")) {
     5556            psFree(md);
     5557            exit(EXIT_FAILURE);
     5558        }
    55415559        if (!psMetadataAddStr(md, PS_LIST_TAIL, "state", 0, NULL, "a string")) {
    55425560            psFree(md);
     
    55475565            exit(EXIT_FAILURE);
    55485566        }
    5549         if (!psMetadataAddS32(md, PS_LIST_TAIL, "result", 0, NULL, -32)) {
     5567        if (!psMetadataAddS32(md, PS_LIST_TAIL, "fault", 0, NULL, -32)) {
    55505568            psFree(md);
    55515569            exit(EXIT_FAILURE);
     
    55785596            exit(EXIT_FAILURE);
    55795597        }
     5598        if (strncmp(object->rownum, "a string", MAX_STRING_LENGTH)) {
     5599            psFree(object);
     5600            exit(EXIT_FAILURE);
     5601        }
    55805602        if (strncmp(object->state, "a string", MAX_STRING_LENGTH)) {
    55815603            psFree(object);
     
    55865608            exit(EXIT_FAILURE);
    55875609        }
    5588         if (!object->result == -32) {
     5610        if (!object->fault == -32) {
    55895611            psFree(object);
    55905612            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/selectrowsfits.c

    r18044 r18595  
    10771077        }
    10781078
    1079         if (!magicSkyfileMaskSelectRowsFits(dbh, fits, NULL, 1)) {
    1080             exit(EXIT_FAILURE);
    1081         }
    1082 
    1083         psFree(fits);
    1084         psDBCleanup(dbh);
    1085     }
    1086 
    1087     {
    1088         psDB            *dbh;
    1089         psFits          *fits;
    1090 
    1091         dbh = psDBInit("localhost", "test", NULL, "test");
    1092         if (!dbh) {
    1093             exit(EXIT_FAILURE);
    1094         }
    1095 
    1096         fits = psFitsOpen(TMP_FILENAME, "w");
    1097         if (!fits) {
    1098             exit(EXIT_FAILURE);
    1099         }
    1100 
    11011079        if (!calDBSelectRowsFits(dbh, fits, NULL, 1)) {
    11021080            exit(EXIT_FAILURE);
Note: See TracChangeset for help on using the changeset viewer.