Changeset 18595
- Timestamp:
- Jul 17, 2008, 10:15:51 AM (18 years ago)
- Location:
- trunk/ippdb
- Files:
-
- 14 edited
-
Makefile.am (modified) (2 diffs)
-
src/ippdb.c (modified) (63 diffs)
-
src/ippdb.h (modified) (19 diffs)
-
tests/alloc.c (modified) (11 diffs)
-
tests/createtable.c (modified) (1 diff)
-
tests/dbcleanup.c (modified) (1 diff)
-
tests/dbsetup.c (modified) (1 diff)
-
tests/droptable.c (modified) (1 diff)
-
tests/insert.c (modified) (4 diffs)
-
tests/insertfits.c (modified) (1 diff)
-
tests/insertobject.c (modified) (7 diffs)
-
tests/metadatafromobject.c (modified) (11 diffs)
-
tests/objectfrommetadata.c (modified) (16 diffs)
-
tests/selectrowsfits.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippdb/Makefile.am
r18044 r18595 58 58 $(top_builddir)/docs/man/man3/magicNodeResultRow.3 \ 59 59 $(top_builddir)/docs/man/man3/magicMaskRow.3 \ 60 $(top_builddir)/docs/man/man3/magicSkyfileMaskRow.3 \61 60 $(top_builddir)/docs/man/man3/calDBRow.3 \ 62 61 $(top_builddir)/docs/man/man3/calRunRow.3 \ … … 68 67 69 68 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:69 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/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: 71 70 $(DOXYGEN) 72 71 -
trunk/ippdb/src/ippdb.c
r18044 r18595 79 79 #define MAGICNODERESULT_TABLE_NAME "magicNodeResult" 80 80 #define MAGICMASK_TABLE_NAME "magicMask" 81 #define MAGICSKYFILEMASK_TABLE_NAME "magicSkyfileMask"82 81 #define CALDB_TABLE_NAME "calDB" 83 82 #define CALRUN_TABLE_NAME "calRun" … … 14075 14074 static void stackRunRowFree(stackRunRow *object); 14076 14075 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 )14076 stackRunRow *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) 14078 14077 { 14079 14078 stackRunRow *_object; … … 14089 14088 _object->skycell_id = psStringCopy(skycell_id); 14090 14089 _object->tess_id = psStringCopy(tess_id); 14090 _object->filter = psStringCopy(filter); 14091 14091 14092 14092 return _object; … … 14101 14101 psFree(object->skycell_id); 14102 14102 psFree(object->tess_id); 14103 psFree(object->filter); 14103 14104 } 14104 14105 … … 14141 14142 return false; 14142 14143 } 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 } 14143 14149 14144 14150 bool status = psDBCreateTable(dbh, STACKRUN_TABLE_NAME, md); … … 14154 14160 } 14155 14161 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 )14162 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, const char *filter) 14157 14163 { 14158 14164 psMetadata *md = psMetadataAlloc(); … … 14189 14195 if (!psMetadataAdd(md, PS_LIST_TAIL, "tess_id", PS_DATA_STRING, NULL, tess_id)) { 14190 14196 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"); 14191 14202 psFree(md); 14192 14203 return false; … … 14215 14226 bool stackRunInsertObject(psDB *dbh, stackRunRow *object) 14216 14227 { 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); 14218 14229 } 14219 14230 … … 14323 14334 return false; 14324 14335 } 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 } 14325 14341 14326 14342 … … 14367 14383 return false; 14368 14384 } 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); 14371 14392 } 14372 14393 psArray *stackRunSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 23032 23053 static void magicRunRowFree(magicRunRow *object); 23033 23054 23034 magicRunRow *magicRunRowAlloc(psS64 magic_id, const char *state, const char *workdir, const char *workdir_state, const char *label, const char *dvodb, psTime* registered )23055 magicRunRow *magicRunRowAlloc(psS64 magic_id, const char *state, const char *workdir, const char *workdir_state, const char *label, const char *dvodb, psTime* registered, psS16 fault) 23035 23056 { 23036 23057 magicRunRow *_object; … … 23046 23067 _object->dvodb = psStringCopy(dvodb); 23047 23068 _object->registered = psTimeCopy(registered); 23069 _object->fault = fault; 23048 23070 23049 23071 return _object; … … 23098 23120 return false; 23099 23121 } 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 } 23100 23127 23101 23128 bool status = psDBCreateTable(dbh, MAGICRUN_TABLE_NAME, md); … … 23111 23138 } 23112 23139 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 )23140 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, psS16 fault) 23114 23141 { 23115 23142 psMetadata *md = psMetadataAlloc(); … … 23146 23173 if (!psMetadataAdd(md, PS_LIST_TAIL, "registered", PS_DATA_TIME, NULL, registered)) { 23147 23174 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"); 23148 23180 psFree(md); 23149 23181 return false; … … 23172 23204 bool magicRunInsertObject(psDB *dbh, magicRunRow *object) 23173 23205 { 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); 23175 23207 } 23176 23208 … … 23280 23312 return false; 23281 23313 } 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 } 23282 23319 23283 23320 … … 23324 23361 return false; 23325 23362 } 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); 23328 23370 } 23329 23371 psArray *magicRunSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 24088 24130 static void magicNodeResultRowFree(magicNodeResultRow *object); 24089 24131 24090 magicNodeResultRow *magicNodeResultRowAlloc(psS64 magic_id, const char *node, const char *uri )24132 magicNodeResultRow *magicNodeResultRowAlloc(psS64 magic_id, const char *node, const char *uri, psS16 fault) 24091 24133 { 24092 24134 magicNodeResultRow *_object; … … 24098 24140 _object->node = psStringCopy(node); 24099 24141 _object->uri = psStringCopy(uri); 24142 _object->fault = fault; 24100 24143 24101 24144 return _object; … … 24126 24169 return false; 24127 24170 } 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 } 24128 24176 24129 24177 bool status = psDBCreateTable(dbh, MAGICNODERESULT_TABLE_NAME, md); … … 24139 24187 } 24140 24188 24141 bool magicNodeResultInsert(psDB * dbh, psS64 magic_id, const char *node, const char *uri )24189 bool magicNodeResultInsert(psDB * dbh, psS64 magic_id, const char *node, const char *uri, psS16 fault) 24142 24190 { 24143 24191 psMetadata *md = psMetadataAlloc(); … … 24154 24202 if (!psMetadataAdd(md, PS_LIST_TAIL, "uri", PS_DATA_STRING, NULL, uri)) { 24155 24203 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"); 24156 24209 psFree(md); 24157 24210 return false; … … 24180 24233 bool magicNodeResultInsertObject(psDB *dbh, magicNodeResultRow *object) 24181 24234 { 24182 return magicNodeResultInsert(dbh, object->magic_id, object->node, object->uri );24235 return magicNodeResultInsert(dbh, object->magic_id, object->node, object->uri, object->fault); 24183 24236 } 24184 24237 … … 24268 24321 return false; 24269 24322 } 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 } 24270 24328 24271 24329 … … 24292 24350 return false; 24293 24351 } 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); 24296 24359 } 24297 24360 psArray *magicNodeResultSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 24411 24474 static void magicMaskRowFree(magicMaskRow *object); 24412 24475 24413 magicMaskRow *magicMaskRowAlloc(psS64 magic_id, const char *uri )24476 magicMaskRow *magicMaskRowAlloc(psS64 magic_id, const char *uri, psS32 streaks, psS16 fault) 24414 24477 { 24415 24478 magicMaskRow *_object; … … 24420 24483 _object->magic_id = magic_id; 24421 24484 _object->uri = psStringCopy(uri); 24485 _object->streaks = streaks; 24486 _object->fault = fault; 24422 24487 24423 24488 return _object; … … 24442 24507 return false; 24443 24508 } 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 } 24444 24519 24445 24520 bool status = psDBCreateTable(dbh, MAGICMASK_TABLE_NAME, md); … … 24455 24530 } 24456 24531 24457 bool magicMaskInsert(psDB * dbh, psS64 magic_id, const char *uri )24532 bool magicMaskInsert(psDB * dbh, psS64 magic_id, const char *uri, psS32 streaks, psS16 fault) 24458 24533 { 24459 24534 psMetadata *md = psMetadataAlloc(); … … 24465 24540 if (!psMetadataAdd(md, PS_LIST_TAIL, "uri", PS_DATA_STRING, NULL, uri)) { 24466 24541 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"); 24467 24552 psFree(md); 24468 24553 return false; … … 24491 24576 bool magicMaskInsertObject(psDB *dbh, magicMaskRow *object) 24492 24577 { 24493 return magicMaskInsert(dbh, object->magic_id, object->uri );24578 return magicMaskInsert(dbh, object->magic_id, object->uri, object->streaks, object->fault); 24494 24579 } 24495 24580 … … 24574 24659 return false; 24575 24660 } 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 } 24576 24671 24577 24672 … … 24593 24688 return false; 24594 24689 } 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); 24597 24702 } 24598 24703 psArray *magicMaskSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 24710 24815 return true; 24711 24816 } 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_NAME24824 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 type24830 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 table24836 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 fits24864 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 objects24932 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 that24962 // 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 md25002 )) {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 }25034 24817 static void calDBRowFree(calDBRow *object); 25035 24818 … … 26477 26260 return false; 26478 26261 } 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")) { 26480 26263 psError(PS_ERR_UNKNOWN, false, "failed to add item outProduct"); 26481 26264 psFree(md); … … 26802 26585 static void pstampRequestRowFree(pstampRequestRow *object); 26803 26586 26804 pstampRequestRow *pstampRequestRowAlloc(psS64 req_id, psS64 ds_id, const char *state, const char * outFileset, const char *uri, psS16 resultsFile)26587 pstampRequestRow *pstampRequestRowAlloc(psS64 req_id, psS64 ds_id, const char *state, const char *name, const char *reqType, const char *outProduct, const char *uri, psS32 fault) 26805 26588 { 26806 26589 pstampRequestRow *_object; … … 26812 26595 _object->ds_id = ds_id; 26813 26596 _object->state = psStringCopy(state); 26814 _object->outFileset = psStringCopy(outFileset); 26597 _object->name = psStringCopy(name); 26598 _object->reqType = psStringCopy(reqType); 26599 _object->outProduct = psStringCopy(outProduct); 26815 26600 _object->uri = psStringCopy(uri); 26816 _object-> resultsFile = resultsFile;26601 _object->fault = fault; 26817 26602 26818 26603 return _object; … … 26822 26607 { 26823 26608 psFree(object->state); 26824 psFree(object->outFileset); 26609 psFree(object->name); 26610 psFree(object->reqType); 26611 psFree(object->outProduct); 26825 26612 psFree(object->uri); 26826 26613 } … … 26844 26631 return false; 26845 26632 } 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"); 26848 26645 psFree(md); 26849 26646 return false; … … 26854 26651 return false; 26855 26652 } 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"); 26858 26655 psFree(md); 26859 26656 return false; … … 26872 26669 } 26873 26670 26874 bool pstampRequestInsert(psDB * dbh, psS64 req_id, psS64 ds_id, const char *state, const char * outFileset, const char *uri, psS16 resultsFile)26671 bool 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) 26875 26672 { 26876 26673 psMetadata *md = psMetadataAlloc(); … … 26890 26687 return false; 26891 26688 } 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"); 26894 26701 psFree(md); 26895 26702 return false; … … 26900 26707 return false; 26901 26708 } 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"); 26904 26711 psFree(md); 26905 26712 return false; … … 26928 26735 bool pstampRequestInsertObject(psDB *dbh, pstampRequestRow *object) 26929 26736 { 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); 26931 26738 } 26932 26739 … … 27016 26823 return false; 27017 26824 } 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"); 27020 26837 psFree(md); 27021 26838 return false; … … 27026 26843 return false; 27027 26844 } 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"); 27030 26847 psFree(md); 27031 26848 return false; … … 27055 26872 return false; 27056 26873 } 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"); 27060 26887 return false; 27061 26888 } … … 27065 26892 return false; 27066 26893 } 27067 psS 16 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); 27074 26901 } 27075 26902 psArray *pstampRequestSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 27189 27016 static void pstampJobRowFree(pstampJobRow *object); 27190 27017 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)27018 pstampJobRow *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) 27192 27019 { 27193 27020 pstampJobRow *_object; … … 27198 27025 _object->job_id = job_id; 27199 27026 _object->req_id = req_id; 27027 _object->rownum = psStringCopy(rownum); 27200 27028 _object->state = psStringCopy(state); 27201 27029 _object->jobType = psStringCopy(jobType); 27202 _object-> result = result;27030 _object->fault = fault; 27203 27031 _object->uri = psStringCopy(uri); 27204 27032 _object->outputBase = psStringCopy(outputBase); … … 27210 27038 static void pstampJobRowFree(pstampJobRow *object) 27211 27039 { 27040 psFree(object->rownum); 27212 27041 psFree(object->state); 27213 27042 psFree(object->jobType); … … 27230 27059 return false; 27231 27060 } 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 } 27232 27066 if (!psMetadataAdd(md, PS_LIST_TAIL, "state", PS_DATA_STRING, NULL, "64")) { 27233 27067 psError(PS_ERR_UNKNOWN, false, "failed to add item state"); … … 27240 27074 return false; 27241 27075 } 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"); 27244 27078 psFree(md); 27245 27079 return false; … … 27273 27107 } 27274 27108 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)27109 bool 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) 27276 27110 { 27277 27111 psMetadata *md = psMetadataAlloc(); … … 27286 27120 return false; 27287 27121 } 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 } 27288 27127 if (!psMetadataAdd(md, PS_LIST_TAIL, "state", PS_DATA_STRING, NULL, state)) { 27289 27128 psError(PS_ERR_UNKNOWN, false, "failed to add item state"); … … 27296 27135 return false; 27297 27136 } 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"); 27300 27139 psFree(md); 27301 27140 return false; … … 27339 27178 bool pstampJobInsertObject(psDB *dbh, pstampJobRow *object) 27340 27179 { 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); 27342 27181 } 27343 27182 … … 27422 27261 return false; 27423 27262 } 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 } 27424 27268 if (!psMetadataAdd(md, PS_LIST_TAIL, "state", PS_DATA_STRING, NULL, object->state)) { 27425 27269 psError(PS_ERR_UNKNOWN, false, "failed to add item state"); … … 27432 27276 return false; 27433 27277 } 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"); 27436 27280 psFree(md); 27437 27281 return false; … … 27471 27315 return false; 27472 27316 } 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 } 27473 27322 char* state = psMetadataLookupPtr(&status, md, "state"); 27474 27323 if (!status) { … … 27481 27330 return false; 27482 27331 } 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"); 27486 27335 return false; 27487 27336 } … … 27502 27351 } 27503 27352 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); 27505 27354 } 27506 27355 psArray *pstampJobSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) -
trunk/ippdb/src/ippdb.h
r18044 r18595 6123 6123 char *skycell_id; 6124 6124 char *tess_id; 6125 char *filter; 6125 6126 } stackRunRow; 6126 6127 … … 6137 6138 psTime* registered, 6138 6139 const char *skycell_id, 6139 const char *tess_id 6140 const char *tess_id, 6141 const char *filter 6140 6142 ); 6141 6143 … … 6173 6175 psTime* registered, 6174 6176 const char *skycell_id, 6175 const char *tess_id 6177 const char *tess_id, 6178 const char *filter 6176 6179 ); 6177 6180 … … 10032 10035 char *dvodb; 10033 10036 psTime* registered; 10037 psS16 fault; 10034 10038 } magicRunRow; 10035 10039 … … 10046 10050 const char *label, 10047 10051 const char *dvodb, 10048 psTime* registered 10052 psTime* registered, 10053 psS16 fault 10049 10054 ); 10050 10055 … … 10082 10087 const char *label, 10083 10088 const char *dvodb, 10084 psTime* registered 10089 psTime* registered, 10090 psS16 fault 10085 10091 ); 10086 10092 … … 10643 10649 char *node; 10644 10650 char *uri; 10651 psS16 fault; 10645 10652 } magicNodeResultRow; 10646 10653 … … 10653 10660 psS64 magic_id, 10654 10661 const char *node, 10655 const char *uri 10662 const char *uri, 10663 psS16 fault 10656 10664 ); 10657 10665 … … 10685 10693 psS64 magic_id, 10686 10694 const char *node, 10687 const char *uri 10695 const char *uri, 10696 psS16 fault 10688 10697 ); 10689 10698 … … 10843 10852 psS64 magic_id; 10844 10853 char *uri; 10854 psS32 streaks; 10855 psS16 fault; 10845 10856 } magicMaskRow; 10846 10857 … … 10852 10863 magicMaskRow *magicMaskRowAlloc( 10853 10864 psS64 magic_id, 10854 const char *uri 10865 const char *uri, 10866 psS32 streaks, 10867 psS16 fault 10855 10868 ); 10856 10869 … … 10883 10896 psDB *dbh, ///< Database handle 10884 10897 psS64 magic_id, 10885 const char *uri 10898 const char *uri, 10899 psS32 streaks, 10900 psS16 fault 10886 10901 ); 10887 10902 … … 11031 11046 FILE *stream, ///< a stream 11032 11047 magicMaskRow *object, ///< an magicMaskRow object 11033 bool mdcf ///< format as mdconfig or simple11034 );11035 /** magicSkyfileMaskRow data structure11036 *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 object11047 *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 *uri11055 );11056 11057 /** Creates a new magicSkyfileMask table11058 *11059 * @return true on success11060 */11061 11062 bool magicSkyfileMaskCreateTable(11063 psDB *dbh ///< Database handle11064 );11065 11066 /** Deletes a magicSkyfileMask table11067 *11068 * @return true on success11069 */11070 11071 bool magicSkyfileMaskDropTable(11072 psDB *dbh ///< Database handle11073 );11074 11075 /** Insert a single row into a table11076 *11077 * This function constructs and inserts a single row based on it's parameters.11078 *11079 * @return true on success11080 */11081 11082 bool magicSkyfileMaskInsert(11083 psDB *dbh, ///< Database handle11084 psS64 magic_id,11085 psS64 diff_id,11086 const char *uri11087 );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 error11092 */11093 11094 long long magicSkyfileMaskDelete(11095 psDB *dbh, ///< Database handle11096 const psMetadata *where, ///< Row match criteria11097 unsigned long long limit ///< Maximum number of elements to delete11098 );11099 11100 /** Insert a single magicSkyfileMaskRow object into a table11101 *11102 * This function constructs and inserts a single row based on it's parameters.11103 *11104 * @return true on success11105 */11106 11107 bool magicSkyfileMaskInsertObject(11108 psDB *dbh, ///< Database handle11109 magicSkyfileMaskRow *object ///< magicSkyfileMaskRow object11110 );11111 11112 /** Insert an array of magicSkyfileMaskRow object into a table11113 *11114 * This function constructs and inserts multiple rows based on it's parameters.11115 *11116 * @return true on success11117 */11118 11119 bool magicSkyfileMaskInsertObjects(11120 psDB *dbh, ///< Database handle11121 psArray *objects ///< array of magicSkyfileMaskRow objects11122 );11123 11124 /** Insert data from a binary FITS table magicSkyfileMaskRow into the database11125 *11126 * This function expects a psFits object with a FITS table as the first11127 * extension. The table must have at least one row of data in it, that is of11128 * the appropriate format (number of columns and their type). All other11129 * extensions are ignored.11130 *11131 * @return true on success11132 */11133 11134 bool magicSkyfileMaskInsertFits(11135 psDB *dbh, ///< Database handle11136 const psFits *fits ///< psFits object11137 );11138 11139 /** Selects up to limit from the database and returns them in a binary FITS table11140 *11141 * This function assumes an empty psFits object and will create a FITS table11142 * as the first extension.11143 *11144 * See psDBSelectRows() for documentation on the format of where.11145 *11146 * @return true on success11147 */11148 11149 bool magicSkyfileMaskSelectRowsFits(11150 psDB *dbh, ///< Database handle11151 psFits *fits, ///< psFits object11152 const psMetadata *where, ///< Row match criteria11153 unsigned long long limit ///< Maximum number of elements to return11154 );11155 11156 /** Convert a magicSkyfileMaskRow into an equivalent psMetadata11157 *11158 * @return A psMetadata pointer or NULL on error11159 */11160 11161 psMetadata *magicSkyfileMaskMetadataFromObject(11162 const magicSkyfileMaskRow *object ///< fooRow to convert into a psMetadata11163 );11164 11165 /** Convert a psMetadata into an equivalent fooRow11166 *11167 * @return A magicSkyfileMaskRow pointer or NULL on error11168 */11169 11170 magicSkyfileMaskRow *magicSkyfileMaskObjectFromMetadata(11171 psMetadata *md ///< psMetadata to convert into a fooRow11172 );11173 /** Selects up to limit rows from the database and returns as magicSkyfileMaskRow objects in a psArray11174 *11175 * See psDBSelectRows() for documentation on the format of where.11176 *11177 * @return A psArray pointer or NULL on error11178 */11179 11180 psArray *magicSkyfileMaskSelectRowObjects(11181 psDB *dbh, ///< Database handle11182 const psMetadata *where, ///< Row match criteria11183 unsigned long long limit ///< Maximum number of elements to return11184 );11185 /** Deletes a row from the database coresponding to an magicSkyfileMask11186 *11187 * Note that a 'where' search psMetadata is constructed from each object and11188 * used to find rows to delete.11189 *11190 * @return A The number of rows removed or a negative value on error11191 */11192 11193 bool magicSkyfileMaskDeleteObject(11194 psDB *dbh, ///< Database handle11195 const magicSkyfileMaskRow *object ///< Object to delete11196 );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 and11200 * used to find rows to delete.11201 *11202 * @return A The number of rows removed or a negative value on error11203 */11204 11205 long long magicSkyfileMaskDeleteRowObjects(11206 psDB *dbh, ///< Database handle11207 const psArray *objects, ///< Array of objects to delete11208 unsigned long long limit ///< Maximum number of elements to delete11209 );11210 /** Formats and prints an array of magicSkyfileMaskRow objects11211 *11212 * When mdcf is set the formated output is in psMetadataConfig11213 * format, otherwise it is in a simple tabular format.11214 *11215 * @return true on success11216 */11217 11218 bool magicSkyfileMaskPrintObjects(11219 FILE *stream, ///< a stream11220 psArray *objects, ///< An array of magicSkyfileMaskRow objects11221 bool mdcf ///< format as mdconfig or simple11222 );11223 /** Formats and prints an magicSkyfileMaskRow object11224 *11225 * When mdcf is set the formated output is in psMetadataConfig11226 * format, otherwise it is in a simple tabular format.11227 *11228 * @return true on success11229 */11230 11231 bool magicSkyfileMaskPrintObject(11232 FILE *stream, ///< a stream11233 magicSkyfileMaskRow *object, ///< an magicSkyfileMaskRow object11234 11048 bool mdcf ///< format as mdconfig or simple 11235 11049 ); … … 12269 12083 psS64 ds_id; 12270 12084 char *state; 12271 char *outFileset; 12085 char *name; 12086 char *reqType; 12087 char *outProduct; 12272 12088 char *uri; 12273 psS 16 resultsFile;12089 psS32 fault; 12274 12090 } pstampRequestRow; 12275 12091 … … 12283 12099 psS64 ds_id, 12284 12100 const char *state, 12285 const char *outFileset, 12101 const char *name, 12102 const char *reqType, 12103 const char *outProduct, 12286 12104 const char *uri, 12287 psS 16 resultsFile12105 psS32 fault 12288 12106 ); 12289 12107 … … 12318 12136 psS64 ds_id, 12319 12137 const char *state, 12320 const char *outFileset, 12138 const char *name, 12139 const char *reqType, 12140 const char *outProduct, 12321 12141 const char *uri, 12322 psS 16 resultsFile12142 psS32 fault 12323 12143 ); 12324 12144 … … 12478 12298 psS64 job_id; 12479 12299 psS64 req_id; 12300 char *rownum; 12480 12301 char *state; 12481 12302 char *jobType; 12482 psS32 result;12303 psS32 fault; 12483 12304 char *uri; 12484 12305 char *outputBase; … … 12494 12315 psS64 job_id, 12495 12316 psS64 req_id, 12317 const char *rownum, 12496 12318 const char *state, 12497 12319 const char *jobType, 12498 psS32 result,12320 psS32 fault, 12499 12321 const char *uri, 12500 12322 const char *outputBase, … … 12531 12353 psS64 job_id, 12532 12354 psS64 req_id, 12355 const char *rownum, 12533 12356 const char *state, 12534 12357 const char *jobType, 12535 psS32 result,12358 psS32 fault, 12536 12359 const char *uri, 12537 12360 const char *outputBase, -
trunk/ippdb/tests/alloc.c
r18044 r18595 1657 1657 stackRunRow *object; 1658 1658 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" ); 1660 1660 1661 1661 if (!object) { … … 1690 1690 exit(EXIT_FAILURE); 1691 1691 } 1692 if (strncmp(object->filter, "a string", MAX_STRING_LENGTH)) { 1693 psFree(object); 1694 exit(EXIT_FAILURE); 1695 } 1692 1696 1693 1697 psFree(object); … … 2732 2736 magicRunRow *object; 2733 2737 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 ); 2735 2739 2736 2740 if (!object) { … … 2765 2769 exit(EXIT_FAILURE); 2766 2770 } 2771 if (!object->fault == -16) { 2772 psFree(object); 2773 exit(EXIT_FAILURE); 2774 } 2767 2775 2768 2776 psFree(object); … … 2822 2830 magicNodeResultRow *object; 2823 2831 2824 object = magicNodeResultRowAlloc(-64, "a string", "a string" );2832 object = magicNodeResultRowAlloc(-64, "a string", "a string", -16 ); 2825 2833 2826 2834 if (!object) { … … 2840 2848 exit(EXIT_FAILURE); 2841 2849 } 2850 if (!object->fault == -16) { 2851 psFree(object); 2852 exit(EXIT_FAILURE); 2853 } 2842 2854 2843 2855 psFree(object); … … 2847 2859 magicMaskRow *object; 2848 2860 2849 object = magicMaskRowAlloc(-64, "a string" );2861 object = magicMaskRowAlloc(-64, "a string", -32, -16 ); 2850 2862 2851 2863 if (!object) { … … 2861 2873 exit(EXIT_FAILURE); 2862 2874 } 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)) { 2881 3029 psFree(object); 2882 3030 exit(EXIT_FAILURE); … … 2891 3039 2892 3040 { 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) { 2906 3054 psFree(object); 2907 3055 exit(EXIT_FAILURE); … … 2911 3059 exit(EXIT_FAILURE); 2912 3060 } 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)) { 2935 3103 psFree(object); 2936 3104 exit(EXIT_FAILURE); … … 2940 3108 exit(EXIT_FAILURE); 2941 3109 } 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 }3103 3110 if (strncmp(object->jobType, "a string", MAX_STRING_LENGTH)) { 3104 3111 psFree(object); 3105 3112 exit(EXIT_FAILURE); 3106 3113 } 3107 if (!object-> result == -32) {3114 if (!object->fault == -32) { 3108 3115 psFree(object); 3109 3116 exit(EXIT_FAILURE); -
trunk/ippdb/tests/createtable.c
r18044 r18595 733 733 } 734 734 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 750 735 if(!calDBCreateTable(dbh)) { 751 736 exit(EXIT_FAILURE); -
trunk/ippdb/tests/dbcleanup.c
r18044 r18595 59 59 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS magicNodeResult"); 60 60 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS magicMask"); 61 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS magicSkyfileMask");62 61 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS calDB"); 63 62 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS calRun"); -
trunk/ippdb/tests/dbsetup.c
r18044 r18595 157 157 magicMaskCreateTable(dbh); 158 158 159 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS magicSkyfileMask");160 magicSkyfileMaskCreateTable(dbh);161 162 159 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS calDB"); 163 160 calDBCreateTable(dbh); -
trunk/ippdb/tests/droptable.c
r18044 r18595 733 733 } 734 734 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 750 735 if (!calDBDropTable(dbh)) { 751 736 exit(EXIT_FAILURE); -
trunk/ippdb/tests/insert.c
r18044 r18595 403 403 } 404 404 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")) { 406 406 exit(EXIT_FAILURE); 407 407 } … … 658 658 } 659 659 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)) { 661 661 exit(EXIT_FAILURE); 662 662 } … … 703 703 } 704 704 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)) { 736 721 exit(EXIT_FAILURE); 737 722 } … … 823 808 } 824 809 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")) { 841 826 exit(EXIT_FAILURE); 842 827 } -
trunk/ippdb/tests/insertfits.c
r18044 r18595 1272 1272 } 1273 1273 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 temp1295 fits = psFitsOpen(TMP_FILENAME, "r");1296 if (!fits) {1297 exit(EXIT_FAILURE);1298 }1299 1300 1274 if (!calDBInsertFits(dbh, fits)) { 1301 1275 exit(EXIT_FAILURE); -
trunk/ippdb/tests/insertobject.c
r18044 r18595 586 586 } 587 587 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"); 589 589 if (!object) { 590 590 exit(EXIT_FAILURE); … … 960 960 } 961 961 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); 963 963 if (!object) { 964 964 exit(EXIT_FAILURE); … … 1026 1026 } 1027 1027 1028 object = magicNodeResultRowAlloc(-64, "a string", "a string" );1028 object = magicNodeResultRowAlloc(-64, "a string", "a string", -16); 1029 1029 if (!object) { 1030 1030 exit(EXIT_FAILURE); … … 1048 1048 } 1049 1049 1050 object = magicMaskRowAlloc(-64, "a string" );1050 object = magicMaskRowAlloc(-64, "a string", -32, -16); 1051 1051 if (!object) { 1052 1052 exit(EXIT_FAILURE); … … 1063 1063 { 1064 1064 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;1087 1065 calDBRow *object; 1088 1066 … … 1202 1180 } 1203 1181 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); 1205 1183 if (!object) { 1206 1184 exit(EXIT_FAILURE); … … 1224 1202 } 1225 1203 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"); 1227 1205 if (!object) { 1228 1206 exit(EXIT_FAILURE); -
trunk/ippdb/tests/metadatafromobject.c
r18044 r18595 1831 1831 bool status; 1832 1832 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"); 1834 1834 if (!object) { 1835 1835 exit(EXIT_FAILURE); … … 1869 1869 exit(EXIT_FAILURE); 1870 1870 } 1871 if (strncmp(psMetadataLookupPtr(&status, md, "filter"), "a string", MAX_STRING_LENGTH)) { 1872 psFree(md); 1873 exit(EXIT_FAILURE); 1874 } 1871 1875 1872 1876 psFree(md); … … 3003 3007 bool status; 3004 3008 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); 3006 3010 if (!object) { 3007 3011 exit(EXIT_FAILURE); … … 3041 3045 exit(EXIT_FAILURE); 3042 3046 } 3047 psFree(md); 3048 exit(EXIT_FAILURE); 3049 } 3043 3050 3044 3051 psFree(md); … … 3113 3120 bool status; 3114 3121 3115 object = magicNodeResultRowAlloc(-64, "a string", "a string" );3122 object = magicNodeResultRowAlloc(-64, "a string", "a string", -16); 3116 3123 if (!object) { 3117 3124 exit(EXIT_FAILURE); … … 3136 3143 exit(EXIT_FAILURE); 3137 3144 } 3145 psFree(md); 3146 exit(EXIT_FAILURE); 3147 } 3138 3148 3139 3149 psFree(md); … … 3145 3155 bool status; 3146 3156 3147 object = magicMaskRowAlloc(-64, "a string" );3157 object = magicMaskRowAlloc(-64, "a string", -32, -16); 3148 3158 if (!object) { 3149 3159 exit(EXIT_FAILURE); … … 3164 3174 exit(EXIT_FAILURE); 3165 3175 } 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)) { 3190 3363 psFree(md); 3191 3364 exit(EXIT_FAILURE); … … 3201 3374 { 3202 3375 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 } 3222 3394 psFree(md); 3223 3395 exit(EXIT_FAILURE); … … 3227 3399 exit(EXIT_FAILURE); 3228 3400 } 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)) { 3258 3449 psFree(md); 3259 3450 exit(EXIT_FAILURE); … … 3263 3454 exit(EXIT_FAILURE); 3264 3455 } 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 }3457 3456 if (strncmp(psMetadataLookupPtr(&status, md, "jobType"), "a string", MAX_STRING_LENGTH)) { 3458 3457 psFree(md); 3459 3458 exit(EXIT_FAILURE); 3460 3459 } 3461 if (!psMetadataLookupS32(&status, md, " result") == -32) {3460 if (!psMetadataLookupS32(&status, md, "fault") == -32) { 3462 3461 psFree(md); 3463 3462 exit(EXIT_FAILURE); -
trunk/ippdb/tests/objectfrommetadata.c
r18044 r18595 3051 3051 exit(EXIT_FAILURE); 3052 3052 } 3053 if (!psMetadataAddStr(md, PS_LIST_TAIL, "filter", 0, NULL, "a string")) { 3054 psFree(md); 3055 exit(EXIT_FAILURE); 3056 } 3053 3057 3054 3058 object = stackRunObjectFromMetadata(md); … … 3083 3087 } 3084 3088 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)) { 3085 3093 psFree(object); 3086 3094 exit(EXIT_FAILURE); … … 4987 4995 exit(EXIT_FAILURE); 4988 4996 } 4997 psFree(md); 4998 exit(EXIT_FAILURE); 4999 } 4989 5000 4990 5001 object = magicRunObjectFromMetadata(md); … … 5016 5027 } 5017 5028 if (strncmp(object->dvodb, "a string", MAX_STRING_LENGTH)) { 5029 psFree(object); 5030 exit(EXIT_FAILURE); 5031 } 5018 5032 psFree(object); 5019 5033 exit(EXIT_FAILURE); … … 5120 5134 exit(EXIT_FAILURE); 5121 5135 } 5136 psFree(md); 5137 exit(EXIT_FAILURE); 5138 } 5122 5139 5123 5140 object = magicNodeResultObjectFromMetadata(md); … … 5137 5154 } 5138 5155 if (strncmp(object->uri, "a string", MAX_STRING_LENGTH)) { 5156 psFree(object); 5157 exit(EXIT_FAILURE); 5158 } 5139 5159 psFree(object); 5140 5160 exit(EXIT_FAILURE); … … 5156 5176 exit(EXIT_FAILURE); 5157 5177 } 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 } 5158 5185 5159 5186 object = magicMaskObjectFromMetadata(md); … … 5172 5199 exit(EXIT_FAILURE); 5173 5200 } 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 } 5209 5205 psFree(object); 5210 5206 exit(EXIT_FAILURE); … … 5483 5479 exit(EXIT_FAILURE); 5484 5480 } 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")) { 5486 5490 psFree(md); 5487 5491 exit(EXIT_FAILURE); … … 5491 5495 exit(EXIT_FAILURE); 5492 5496 } 5497 if (!psMetadataAddS32(md, PS_LIST_TAIL, "fault", 0, NULL, -32)) { 5493 5498 psFree(md); 5494 5499 exit(EXIT_FAILURE); … … 5513 5518 exit(EXIT_FAILURE); 5514 5519 } 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)) { 5516 5529 psFree(object); 5517 5530 exit(EXIT_FAILURE); … … 5521 5534 exit(EXIT_FAILURE); 5522 5535 } 5536 if (!object->fault == -32) { 5523 5537 psFree(object); 5524 5538 exit(EXIT_FAILURE); … … 5539 5553 exit(EXIT_FAILURE); 5540 5554 } 5555 if (!psMetadataAddStr(md, PS_LIST_TAIL, "rownum", 0, NULL, "a string")) { 5556 psFree(md); 5557 exit(EXIT_FAILURE); 5558 } 5541 5559 if (!psMetadataAddStr(md, PS_LIST_TAIL, "state", 0, NULL, "a string")) { 5542 5560 psFree(md); … … 5547 5565 exit(EXIT_FAILURE); 5548 5566 } 5549 if (!psMetadataAddS32(md, PS_LIST_TAIL, " result", 0, NULL, -32)) {5567 if (!psMetadataAddS32(md, PS_LIST_TAIL, "fault", 0, NULL, -32)) { 5550 5568 psFree(md); 5551 5569 exit(EXIT_FAILURE); … … 5578 5596 exit(EXIT_FAILURE); 5579 5597 } 5598 if (strncmp(object->rownum, "a string", MAX_STRING_LENGTH)) { 5599 psFree(object); 5600 exit(EXIT_FAILURE); 5601 } 5580 5602 if (strncmp(object->state, "a string", MAX_STRING_LENGTH)) { 5581 5603 psFree(object); … … 5586 5608 exit(EXIT_FAILURE); 5587 5609 } 5588 if (!object-> result == -32) {5610 if (!object->fault == -32) { 5589 5611 psFree(object); 5590 5612 exit(EXIT_FAILURE); -
trunk/ippdb/tests/selectrowsfits.c
r18044 r18595 1077 1077 } 1078 1078 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 1101 1079 if (!calDBSelectRowsFits(dbh, fits, NULL, 1)) { 1102 1080 exit(EXIT_FAILURE);
Note:
See TracChangeset
for help on using the changeset viewer.
