Changeset 11820
- Timestamp:
- Feb 14, 2007, 5:58:26 PM (19 years ago)
- Location:
- trunk
- Files:
-
- 16 edited
-
dbconfig/config.md (modified) (1 diff)
-
ippdb/Makefile.am (modified) (1 diff)
-
ippdb/configure.ac (modified) (1 diff)
-
ippdb/src/ippdb.c (modified) (32 diffs)
-
ippdb/src/ippdb.h (modified) (11 diffs)
-
ippdb/tests/alloc.c (modified) (7 diffs)
-
ippdb/tests/createtable.c (modified) (1 diff)
-
ippdb/tests/dbcleanup.c (modified) (1 diff)
-
ippdb/tests/dbsetup.c (modified) (1 diff)
-
ippdb/tests/droptable.c (modified) (1 diff)
-
ippdb/tests/insert.c (modified) (4 diffs)
-
ippdb/tests/insertfits.c (modified) (1 diff)
-
ippdb/tests/insertobject.c (modified) (4 diffs)
-
ippdb/tests/metadatafromobject.c (modified) (7 diffs)
-
ippdb/tests/objectfrommetadata.c (modified) (7 diffs)
-
ippdb/tests/selectrowsfits.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/dbconfig/config.md
r11815 r11820 2 2 pkg_name STR ippdb 3 3 pkg_namespace STR ippdb 4 pkg_version STR 1.1. 74 pkg_version STR 1.1.8 5 5 END -
trunk/ippdb/Makefile.am
r11809 r11820 47 47 $(top_builddir)/docs/man/man3/p5RunRow.3 \ 48 48 $(top_builddir)/docs/man/man3/p5InputScfileRow.3 \ 49 $(top_builddir)/docs/man/man3/p5DiffScfileRow.3 49 $(top_builddir)/docs/man/man3/p5DiffScfileRow.3 \ 50 $(top_builddir)/docs/man/man3/p6RunRow.3 50 51 51 52 52 docs/man/man3/ippdb.3 docs/man/man3/expTagCounterRow.3 docs/man/man3/summitExpRow.3 docs/man/man3/summitImfileRow.3 docs/man/man3/pzPendingExpRow.3 docs/man/man3/pzPendingImfileRow.3 docs/man/man3/pzDoneExpRow.3 docs/man/man3/pzDoneImfileRow.3 docs/man/man3/newExpRow.3 docs/man/man3/newImfileRow.3 docs/man/man3/rawExpRow.3 docs/man/man3/rawImfileRow.3 docs/man/man3/p1PendingExpRow.3 docs/man/man3/p2PendingExpRow.3 docs/man/man3/p2PendingImfileRow.3 docs/man/man3/p2ProcessedExpRow.3 docs/man/man3/p2MaskRow.3 docs/man/man3/p2ProcessedImfileRow.3 docs/man/man3/p3PendingExpRow.3 docs/man/man3/p3ProcessedExpRow.3 docs/man/man3/p3MaskRow.3 docs/man/man3/detRunRow.3 docs/man/man3/detInputExpRow.3 docs/man/man3/detProcessedImfileRow.3 docs/man/man3/detProcessedExpRow.3 docs/man/man3/detStackedImfileRow.3 docs/man/man3/detNormalizedStatImfileRow.3 docs/man/man3/detNormalizedImfileRow.3 docs/man/man3/detNormalizedExpRow.3 docs/man/man3/detResidImfileRow.3 docs/man/man3/detResidExpRow.3 docs/man/man3/detRunSummaryRow.3 docs/man/man3/p4RunRow.3 docs/man/man3/p4InputExpRow.3 docs/man/man3/p4SkyCellMapRow.3 docs/man/man3/p4ScfileRow.3 docs/man/man3/p5RunRow.3 docs/man/man3/p5InputScfileRow.3 docs/man/man3/p5DiffScfileRow.3 :53 docs/man/man3/ippdb.3 docs/man/man3/expTagCounterRow.3 docs/man/man3/summitExpRow.3 docs/man/man3/summitImfileRow.3 docs/man/man3/pzPendingExpRow.3 docs/man/man3/pzPendingImfileRow.3 docs/man/man3/pzDoneExpRow.3 docs/man/man3/pzDoneImfileRow.3 docs/man/man3/newExpRow.3 docs/man/man3/newImfileRow.3 docs/man/man3/rawExpRow.3 docs/man/man3/rawImfileRow.3 docs/man/man3/p1PendingExpRow.3 docs/man/man3/p2PendingExpRow.3 docs/man/man3/p2PendingImfileRow.3 docs/man/man3/p2ProcessedExpRow.3 docs/man/man3/p2MaskRow.3 docs/man/man3/p2ProcessedImfileRow.3 docs/man/man3/p3PendingExpRow.3 docs/man/man3/p3ProcessedExpRow.3 docs/man/man3/p3MaskRow.3 docs/man/man3/detRunRow.3 docs/man/man3/detInputExpRow.3 docs/man/man3/detProcessedImfileRow.3 docs/man/man3/detProcessedExpRow.3 docs/man/man3/detStackedImfileRow.3 docs/man/man3/detNormalizedStatImfileRow.3 docs/man/man3/detNormalizedImfileRow.3 docs/man/man3/detNormalizedExpRow.3 docs/man/man3/detResidImfileRow.3 docs/man/man3/detResidExpRow.3 docs/man/man3/detRunSummaryRow.3 docs/man/man3/p4RunRow.3 docs/man/man3/p4InputExpRow.3 docs/man/man3/p4SkyCellMapRow.3 docs/man/man3/p4ScfileRow.3 docs/man/man3/p5RunRow.3 docs/man/man3/p5InputScfileRow.3 docs/man/man3/p5DiffScfileRow.3 docs/man/man3/p6RunRow.3: 53 54 $(DOXYGEN) 54 55 -
trunk/ippdb/configure.ac
r11809 r11820 7 7 AC_PREREQ(2.59) 8 8 9 AC_INIT([ippdb], [1.1. 6], [pan-starrs.ifa.hawaii.edu])9 AC_INIT([ippdb], [1.1.8], [pan-starrs.ifa.hawaii.edu]) 10 10 AC_CONFIG_SRCDIR([ippdb.pc.in]) 11 11 -
trunk/ippdb/src/ippdb.c
r11809 r11820 69 69 #define P5INPUTSCFILE_TABLE_NAME "p5InputScfile" 70 70 #define P5DIFFSCFILE_TABLE_NAME "p5DiffScfile" 71 #define P6RUN_TABLE_NAME "p6Run" 71 72 #define MAX_STRING_LENGTH 1024 72 73 … … 3523 3524 static void rawExpRowFree(rawExpRow *object); 3524 3525 3525 rawExpRow *rawExpRowAlloc(const char *exp_tag, const char *exp_id, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, psS32 imfiles, const char *workdir, const char *filter, psF32 airmass, psF64 ra, psF64 decl, psF32 exp_time, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, psF64 alt, psF64 az, psF32 ccd_temp, psF64 posang, const char *object, ps S16 fault)3526 rawExpRow *rawExpRowAlloc(const char *exp_tag, const char *exp_id, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, psS32 imfiles, const char *workdir, const char *filter, psF32 airmass, psF64 ra, psF64 decl, psF32 exp_time, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, psF64 alt, psF64 az, psF32 ccd_temp, psF64 posang, const char *object, psF32 solang, psS16 fault) 3526 3527 { 3527 3528 rawExpRow *_object; … … 3551 3552 _object->posang = posang; 3552 3553 _object->object = psStringCopy(object); 3554 _object->solang = solang; 3553 3555 _object->fault = fault; 3554 3556 … … 3677 3679 return false; 3678 3680 } 3681 if (!psMetadataAdd(md, PS_LIST_TAIL, "solang", PS_DATA_F32, NULL, 0.0)) { 3682 psError(PS_ERR_UNKNOWN, false, "failed to add item solang"); 3683 psFree(md); 3684 return false; 3685 } 3679 3686 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, "Key NOT NULL", 0)) { 3680 3687 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); … … 3695 3702 } 3696 3703 3697 bool rawExpInsert(psDB * dbh, const char *exp_tag, const char *exp_id, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, psS32 imfiles, const char *workdir, const char *filter, psF32 airmass, psF64 ra, psF64 decl, psF32 exp_time, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, psF64 alt, psF64 az, psF32 ccd_temp, psF64 posang, const char *object, ps S16 fault)3704 bool rawExpInsert(psDB * dbh, const char *exp_tag, const char *exp_id, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, psS32 imfiles, const char *workdir, const char *filter, psF32 airmass, psF64 ra, psF64 decl, psF32 exp_time, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, psF64 alt, psF64 az, psF32 ccd_temp, psF64 posang, const char *object, psF32 solang, psS16 fault) 3698 3705 { 3699 3706 psMetadata *md = psMetadataAlloc(); … … 3800 3807 if (!psMetadataAdd(md, PS_LIST_TAIL, "object", PS_DATA_STRING, NULL, object)) { 3801 3808 psError(PS_ERR_UNKNOWN, false, "failed to add item object"); 3809 psFree(md); 3810 return false; 3811 } 3812 if (!psMetadataAdd(md, PS_LIST_TAIL, "solang", PS_DATA_F32, NULL, solang)) { 3813 psError(PS_ERR_UNKNOWN, false, "failed to add item solang"); 3802 3814 psFree(md); 3803 3815 return false; … … 3831 3843 bool rawExpInsertObject(psDB *dbh, rawExpRow *object) 3832 3844 { 3833 return rawExpInsert(dbh, object->exp_tag, object->exp_id, object->camera, object->telescope, object->dateobs, object->exp_type, object->imfiles, object->workdir, object->filter, object->airmass, object->ra, object->decl, object->exp_time, object->bg, object->bg_stdev, object->bg_mean_stdev, object->alt, object->az, object->ccd_temp, object->posang, object->object, object-> fault);3845 return rawExpInsert(dbh, object->exp_tag, object->exp_id, object->camera, object->telescope, object->dateobs, object->exp_type, object->imfiles, object->workdir, object->filter, object->airmass, object->ra, object->decl, object->exp_time, object->bg, object->bg_stdev, object->bg_mean_stdev, object->alt, object->az, object->ccd_temp, object->posang, object->object, object->solang, object->fault); 3834 3846 } 3835 3847 … … 4009 4021 return false; 4010 4022 } 4023 if (!psMetadataAdd(md, PS_LIST_TAIL, "solang", PS_DATA_F32, NULL, object->solang)) { 4024 psError(PS_ERR_UNKNOWN, false, "failed to add item solang"); 4025 psFree(md); 4026 return false; 4027 } 4011 4028 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, object->fault)) { 4012 4029 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); … … 4128 4145 return false; 4129 4146 } 4147 psF32 solang = psMetadataLookupF32(&status, md, "solang"); 4148 if (!status) { 4149 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item solang"); 4150 return false; 4151 } 4130 4152 psS16 fault = psMetadataLookupS16(&status, md, "fault"); 4131 4153 if (!status) { … … 4134 4156 } 4135 4157 4136 return rawExpRowAlloc(exp_tag, exp_id, camera, telescope, dateobs, exp_type, imfiles, workdir, filter, airmass, ra, decl, exp_time, bg, bg_stdev, bg_mean_stdev, alt, az, ccd_temp, posang, object, fault);4158 return rawExpRowAlloc(exp_tag, exp_id, camera, telescope, dateobs, exp_type, imfiles, workdir, filter, airmass, ra, decl, exp_time, bg, bg_stdev, bg_mean_stdev, alt, az, ccd_temp, posang, object, solang, fault); 4137 4159 } 4138 4160 psArray *rawExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 8334 8356 static void detRunRowFree(detRunRow *object); 8335 8357 8336 detRunRow *detRunRowAlloc(psS32 det_id, psS32 iteration, const char *det_type, const char *mode, const char *state, const char *workdir, const char *camera, const char *telescope, const char *exp_type, const char *filter, psF32 airmass_min, psF32 airmass_max, psF32 exp_time_min, psF32 exp_time_max, psF32 ccd_temp_min, psF32 ccd_temp_max, psF64 posang_min, psF64 posang_max, psTime* registered, psTime* time_begin, psTime* time_end, psTime* use_begin, psTime* use_end )8358 detRunRow *detRunRowAlloc(psS32 det_id, psS32 iteration, const char *det_type, const char *mode, const char *state, const char *workdir, const char *camera, const char *telescope, const char *exp_type, const char *filter, psF32 airmass_min, psF32 airmass_max, psF32 exp_time_min, psF32 exp_time_max, psF32 ccd_temp_min, psF32 ccd_temp_max, psF64 posang_min, psF64 posang_max, psTime* registered, psTime* time_begin, psTime* time_end, psTime* use_begin, psTime* use_end, psF32 solang_min, psF32 solang_max, const char *label, psS32 parent) 8337 8359 { 8338 8360 detRunRow *_object; … … 8364 8386 _object->use_begin = psTimeCopy(use_begin); 8365 8387 _object->use_end = psTimeCopy(use_end); 8388 _object->solang_min = solang_min; 8389 _object->solang_max = solang_max; 8390 _object->label = psStringCopy(label); 8391 _object->parent = parent; 8366 8392 8367 8393 return _object; … … 8383 8409 psFree(object->use_begin); 8384 8410 psFree(object->use_end); 8411 psFree(object->label); 8385 8412 } 8386 8413 … … 8503 8530 return false; 8504 8531 } 8532 if (!psMetadataAdd(md, PS_LIST_TAIL, "solang_min", PS_DATA_F32, NULL, 0.0)) { 8533 psError(PS_ERR_UNKNOWN, false, "failed to add item solang_min"); 8534 psFree(md); 8535 return false; 8536 } 8537 if (!psMetadataAdd(md, PS_LIST_TAIL, "solang_max", PS_DATA_F32, NULL, 0.0)) { 8538 psError(PS_ERR_UNKNOWN, false, "failed to add item solang_max"); 8539 psFree(md); 8540 return false; 8541 } 8542 if (!psMetadataAdd(md, PS_LIST_TAIL, "label", PS_DATA_STRING, "key", "64")) { 8543 psError(PS_ERR_UNKNOWN, false, "failed to add item label"); 8544 psFree(md); 8545 return false; 8546 } 8547 if (!psMetadataAdd(md, PS_LIST_TAIL, "parent", PS_DATA_S32, "Key", 0)) { 8548 psError(PS_ERR_UNKNOWN, false, "failed to add item parent"); 8549 psFree(md); 8550 return false; 8551 } 8505 8552 8506 8553 bool status = psDBCreateTable(dbh, DETRUN_TABLE_NAME, md); … … 8516 8563 } 8517 8564 8518 bool detRunInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *det_type, const char *mode, const char *state, const char *workdir, const char *camera, const char *telescope, const char *exp_type, const char *filter, psF32 airmass_min, psF32 airmass_max, psF32 exp_time_min, psF32 exp_time_max, psF32 ccd_temp_min, psF32 ccd_temp_max, psF64 posang_min, psF64 posang_max, psTime* registered, psTime* time_begin, psTime* time_end, psTime* use_begin, psTime* use_end )8565 bool detRunInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *det_type, const char *mode, const char *state, const char *workdir, const char *camera, const char *telescope, const char *exp_type, const char *filter, psF32 airmass_min, psF32 airmass_max, psF32 exp_time_min, psF32 exp_time_max, psF32 ccd_temp_min, psF32 ccd_temp_max, psF64 posang_min, psF64 posang_max, psTime* registered, psTime* time_begin, psTime* time_end, psTime* use_begin, psTime* use_end, psF32 solang_min, psF32 solang_max, const char *label, psS32 parent) 8519 8566 { 8520 8567 psMetadata *md = psMetadataAlloc(); … … 8631 8678 if (!psMetadataAdd(md, PS_LIST_TAIL, "use_end", PS_DATA_TIME, NULL, use_end)) { 8632 8679 psError(PS_ERR_UNKNOWN, false, "failed to add item use_end"); 8680 psFree(md); 8681 return false; 8682 } 8683 if (!psMetadataAdd(md, PS_LIST_TAIL, "solang_min", PS_DATA_F32, NULL, solang_min)) { 8684 psError(PS_ERR_UNKNOWN, false, "failed to add item solang_min"); 8685 psFree(md); 8686 return false; 8687 } 8688 if (!psMetadataAdd(md, PS_LIST_TAIL, "solang_max", PS_DATA_F32, NULL, solang_max)) { 8689 psError(PS_ERR_UNKNOWN, false, "failed to add item solang_max"); 8690 psFree(md); 8691 return false; 8692 } 8693 if (!psMetadataAdd(md, PS_LIST_TAIL, "label", PS_DATA_STRING, NULL, label)) { 8694 psError(PS_ERR_UNKNOWN, false, "failed to add item label"); 8695 psFree(md); 8696 return false; 8697 } 8698 if (!psMetadataAdd(md, PS_LIST_TAIL, "parent", PS_DATA_S32, NULL, parent)) { 8699 psError(PS_ERR_UNKNOWN, false, "failed to add item parent"); 8633 8700 psFree(md); 8634 8701 return false; … … 8657 8724 bool detRunInsertObject(psDB *dbh, detRunRow *object) 8658 8725 { 8659 return detRunInsert(dbh, object->det_id, object->iteration, object->det_type, object->mode, object->state, object->workdir, object->camera, object->telescope, object->exp_type, object->filter, object->airmass_min, object->airmass_max, object->exp_time_min, object->exp_time_max, object->ccd_temp_min, object->ccd_temp_max, object->posang_min, object->posang_max, object->registered, object->time_begin, object->time_end, object->use_begin, object->use_end );8726 return detRunInsert(dbh, object->det_id, object->iteration, object->det_type, object->mode, object->state, object->workdir, object->camera, object->telescope, object->exp_type, object->filter, object->airmass_min, object->airmass_max, object->exp_time_min, object->exp_time_max, object->ccd_temp_min, object->ccd_temp_max, object->posang_min, object->posang_max, object->registered, object->time_begin, object->time_end, object->use_begin, object->use_end, object->solang_min, object->solang_max, object->label, object->parent); 8660 8727 } 8661 8728 … … 8845 8912 return false; 8846 8913 } 8914 if (!psMetadataAdd(md, PS_LIST_TAIL, "solang_min", PS_DATA_F32, NULL, object->solang_min)) { 8915 psError(PS_ERR_UNKNOWN, false, "failed to add item solang_min"); 8916 psFree(md); 8917 return false; 8918 } 8919 if (!psMetadataAdd(md, PS_LIST_TAIL, "solang_max", PS_DATA_F32, NULL, object->solang_max)) { 8920 psError(PS_ERR_UNKNOWN, false, "failed to add item solang_max"); 8921 psFree(md); 8922 return false; 8923 } 8924 if (!psMetadataAdd(md, PS_LIST_TAIL, "label", PS_DATA_STRING, NULL, object->label)) { 8925 psError(PS_ERR_UNKNOWN, false, "failed to add item label"); 8926 psFree(md); 8927 return false; 8928 } 8929 if (!psMetadataAdd(md, PS_LIST_TAIL, "parent", PS_DATA_S32, NULL, object->parent)) { 8930 psError(PS_ERR_UNKNOWN, false, "failed to add item parent"); 8931 psFree(md); 8932 return false; 8933 } 8847 8934 8848 8935 … … 8969 9056 return false; 8970 9057 } 8971 8972 return detRunRowAlloc(det_id, iteration, det_type, mode, state, workdir, camera, telescope, exp_type, filter, airmass_min, airmass_max, exp_time_min, exp_time_max, ccd_temp_min, ccd_temp_max, posang_min, posang_max, registered, time_begin, time_end, use_begin, use_end); 9058 psF32 solang_min = psMetadataLookupF32(&status, md, "solang_min"); 9059 if (!status) { 9060 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item solang_min"); 9061 return false; 9062 } 9063 psF32 solang_max = psMetadataLookupF32(&status, md, "solang_max"); 9064 if (!status) { 9065 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item solang_max"); 9066 return false; 9067 } 9068 char* label = psMetadataLookupPtr(&status, md, "label"); 9069 if (!status) { 9070 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item label"); 9071 return false; 9072 } 9073 psS32 parent = psMetadataLookupS32(&status, md, "parent"); 9074 if (!status) { 9075 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item parent"); 9076 return false; 9077 } 9078 9079 return detRunRowAlloc(det_id, iteration, det_type, mode, state, workdir, camera, telescope, exp_type, filter, airmass_min, airmass_max, exp_time_min, exp_time_max, ccd_temp_min, ccd_temp_max, posang_min, posang_max, registered, time_begin, time_end, use_begin, use_end, solang_min, solang_max, label, parent); 8973 9080 } 8974 9081 psArray *detRunSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 13855 13962 return false; 13856 13963 } 13857 if (!psMetadataAdd(md, PS_LIST_TAIL, "p3_version", PS_DATA_S32, " PrimaryKey", 0)) {13964 if (!psMetadataAdd(md, PS_LIST_TAIL, "p3_version", PS_DATA_S32, "Key", 0)) { 13858 13965 psError(PS_ERR_UNKNOWN, false, "failed to add item p3_version"); 13859 13966 psFree(md); 13860 13967 return false; 13861 13968 } 13862 if (!psMetadataAdd(md, PS_LIST_TAIL, "magiced", PS_DATA_BOOL, " PrimaryKey", 0)) {13969 if (!psMetadataAdd(md, PS_LIST_TAIL, "magiced", PS_DATA_BOOL, "Key", 0)) { 13863 13970 psError(PS_ERR_UNKNOWN, false, "failed to add item magiced"); 13864 13971 psFree(md); … … 14586 14693 return false; 14587 14694 } 14588 if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_tag", PS_DATA_STRING, " PrimaryKey", "64")) {14695 if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_tag", PS_DATA_STRING, "Key", "64")) { 14589 14696 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag"); 14590 14697 psFree(md); 14591 14698 return false; 14592 14699 } 14593 if (!psMetadataAdd(md, PS_LIST_TAIL, "p3_version", PS_DATA_S32, " PrimaryKey", 0)) {14700 if (!psMetadataAdd(md, PS_LIST_TAIL, "p3_version", PS_DATA_S32, "Key", 0)) { 14594 14701 psError(PS_ERR_UNKNOWN, false, "failed to add item p3_version"); 14595 14702 psFree(md); … … 15304 15411 static void p5InputScfileRowFree(p5InputScfileRow *object); 15305 15412 15306 p5InputScfileRow *p5InputScfileRowAlloc(psS32 p5_id, psS32 p4_id, const char *skycell_id, const char *tess_id, const char * exp_tag, psS32 p3_version, const char *kind, bool template)15413 p5InputScfileRow *p5InputScfileRowAlloc(psS32 p5_id, psS32 p4_id, const char *skycell_id, const char *tess_id, const char *kind, bool template) 15307 15414 { 15308 15415 p5InputScfileRow *_object; … … 15315 15422 _object->skycell_id = psStringCopy(skycell_id); 15316 15423 _object->tess_id = psStringCopy(tess_id); 15317 _object->exp_tag = psStringCopy(exp_tag);15318 _object->p3_version = p3_version;15319 15424 _object->kind = psStringCopy(kind); 15320 15425 _object->template = template; … … 15327 15432 psFree(object->skycell_id); 15328 15433 psFree(object->tess_id); 15329 psFree(object->exp_tag);15330 15434 psFree(object->kind); 15331 15435 } … … 15354 15458 return false; 15355 15459 } 15356 if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_tag", PS_DATA_STRING, "Primary Key", "64")) {15357 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");15358 psFree(md);15359 return false;15360 }15361 if (!psMetadataAdd(md, PS_LIST_TAIL, "p3_version", PS_DATA_S32, "Primary Key", 0)) {15362 psError(PS_ERR_UNKNOWN, false, "failed to add item p3_version");15363 psFree(md);15364 return false;15365 }15366 15460 if (!psMetadataAdd(md, PS_LIST_TAIL, "kind", PS_DATA_STRING, "Key", "64")) { 15367 15461 psError(PS_ERR_UNKNOWN, false, "failed to add item kind"); … … 15387 15481 } 15388 15482 15389 bool p5InputScfileInsert(psDB * dbh, psS32 p5_id, psS32 p4_id, const char *skycell_id, const char *tess_id, const char * exp_tag, psS32 p3_version, const char *kind, bool template)15483 bool p5InputScfileInsert(psDB * dbh, psS32 p5_id, psS32 p4_id, const char *skycell_id, const char *tess_id, const char *kind, bool template) 15390 15484 { 15391 15485 psMetadata *md = psMetadataAlloc(); … … 15407 15501 if (!psMetadataAdd(md, PS_LIST_TAIL, "tess_id", PS_DATA_STRING, NULL, tess_id)) { 15408 15502 psError(PS_ERR_UNKNOWN, false, "failed to add item tess_id"); 15409 psFree(md);15410 return false;15411 }15412 if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_tag", PS_DATA_STRING, NULL, exp_tag)) {15413 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");15414 psFree(md);15415 return false;15416 }15417 if (!psMetadataAdd(md, PS_LIST_TAIL, "p3_version", PS_DATA_S32, NULL, p3_version)) {15418 psError(PS_ERR_UNKNOWN, false, "failed to add item p3_version");15419 15503 psFree(md); 15420 15504 return false; … … 15453 15537 bool p5InputScfileInsertObject(psDB *dbh, p5InputScfileRow *object) 15454 15538 { 15455 return p5InputScfileInsert(dbh, object->p5_id, object->p4_id, object->skycell_id, object->tess_id, object-> exp_tag, object->p3_version, object->kind, object->template);15539 return p5InputScfileInsert(dbh, object->p5_id, object->p4_id, object->skycell_id, object->tess_id, object->kind, object->template); 15456 15540 } 15457 15541 … … 15546 15630 return false; 15547 15631 } 15548 if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_tag", PS_DATA_STRING, NULL, object->exp_tag)) {15549 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");15550 psFree(md);15551 return false;15552 }15553 if (!psMetadataAdd(md, PS_LIST_TAIL, "p3_version", PS_DATA_S32, NULL, object->p3_version)) {15554 psError(PS_ERR_UNKNOWN, false, "failed to add item p3_version");15555 psFree(md);15556 return false;15557 }15558 15632 if (!psMetadataAdd(md, PS_LIST_TAIL, "kind", PS_DATA_STRING, NULL, object->kind)) { 15559 15633 psError(PS_ERR_UNKNOWN, false, "failed to add item kind"); … … 15595 15669 return false; 15596 15670 } 15597 char* exp_tag = psMetadataLookupPtr(&status, md, "exp_tag");15598 if (!status) {15599 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_tag");15600 return false;15601 }15602 psS32 p3_version = psMetadataLookupS32(&status, md, "p3_version");15603 if (!status) {15604 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p3_version");15605 return false;15606 }15607 15671 char* kind = psMetadataLookupPtr(&status, md, "kind"); 15608 15672 if (!status) { … … 15616 15680 } 15617 15681 15618 return p5InputScfileRowAlloc(p5_id, p4_id, skycell_id, tess_id, exp_tag, p3_version,kind, template);15682 return p5InputScfileRowAlloc(p5_id, p4_id, skycell_id, tess_id, kind, template); 15619 15683 } 15620 15684 psArray *p5InputScfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 16107 16171 return true; 16108 16172 } 16173 static void p6RunRowFree(p6RunRow *object); 16174 16175 p6RunRow *p6RunRowAlloc(psS32 p6_id, const char *state, const char *workdir, psTime* registered) 16176 { 16177 p6RunRow *_object; 16178 16179 _object = psAlloc(sizeof(p6RunRow)); 16180 psMemSetDeallocator(_object, (psFreeFunc)p6RunRowFree); 16181 16182 _object->p6_id = p6_id; 16183 _object->state = psStringCopy(state); 16184 _object->workdir = psStringCopy(workdir); 16185 _object->registered = psTimeCopy(registered); 16186 16187 return _object; 16188 } 16189 16190 static void p6RunRowFree(p6RunRow *object) 16191 { 16192 psFree(object->state); 16193 psFree(object->workdir); 16194 psFree(object->registered); 16195 } 16196 16197 bool p6RunCreateTable(psDB *dbh) 16198 { 16199 psMetadata *md = psMetadataAlloc(); 16200 if (!psMetadataAdd(md, PS_LIST_TAIL, "p6_id", PS_DATA_S32, "Primary Key AUTO_INCREMENT", 0)) { 16201 psError(PS_ERR_UNKNOWN, false, "failed to add item p6_id"); 16202 psFree(md); 16203 return false; 16204 } 16205 if (!psMetadataAdd(md, PS_LIST_TAIL, "state", PS_DATA_STRING, "Key", "64")) { 16206 psError(PS_ERR_UNKNOWN, false, "failed to add item state"); 16207 psFree(md); 16208 return false; 16209 } 16210 if (!psMetadataAdd(md, PS_LIST_TAIL, "workdir", PS_DATA_STRING, NULL, "255")) { 16211 psError(PS_ERR_UNKNOWN, false, "failed to add item workdir"); 16212 psFree(md); 16213 return false; 16214 } 16215 if (!psMetadataAdd(md, PS_LIST_TAIL, "registered", PS_DATA_TIME, NULL, NULL)) { 16216 psError(PS_ERR_UNKNOWN, false, "failed to add item registered"); 16217 psFree(md); 16218 return false; 16219 } 16220 16221 bool status = psDBCreateTable(dbh, P6RUN_TABLE_NAME, md); 16222 16223 psFree(md); 16224 16225 return status; 16226 } 16227 16228 bool p6RunDropTable(psDB *dbh) 16229 { 16230 return psDBDropTable(dbh, P6RUN_TABLE_NAME); 16231 } 16232 16233 bool p6RunInsert(psDB * dbh, psS32 p6_id, const char *state, const char *workdir, psTime* registered) 16234 { 16235 psMetadata *md = psMetadataAlloc(); 16236 if (!psMetadataAdd(md, PS_LIST_TAIL, "p6_id", PS_DATA_S32, NULL, p6_id)) { 16237 psError(PS_ERR_UNKNOWN, false, "failed to add item p6_id"); 16238 psFree(md); 16239 return false; 16240 } 16241 if (!psMetadataAdd(md, PS_LIST_TAIL, "state", PS_DATA_STRING, NULL, state)) { 16242 psError(PS_ERR_UNKNOWN, false, "failed to add item state"); 16243 psFree(md); 16244 return false; 16245 } 16246 if (!psMetadataAdd(md, PS_LIST_TAIL, "workdir", PS_DATA_STRING, NULL, workdir)) { 16247 psError(PS_ERR_UNKNOWN, false, "failed to add item workdir"); 16248 psFree(md); 16249 return false; 16250 } 16251 if (!psMetadataAdd(md, PS_LIST_TAIL, "registered", PS_DATA_TIME, NULL, registered)) { 16252 psError(PS_ERR_UNKNOWN, false, "failed to add item registered"); 16253 psFree(md); 16254 return false; 16255 } 16256 16257 bool status = psDBInsertOneRow(dbh, P6RUN_TABLE_NAME, md); 16258 psFree(md); 16259 16260 return status; 16261 } 16262 16263 long long p6RunDelete(psDB *dbh, const psMetadata *where, unsigned long long limit) 16264 { 16265 long long deleted = 0; 16266 16267 long long count = psDBDeleteRows(dbh, P6RUN_TABLE_NAME, where, limit); 16268 if (count < 0) { 16269 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p6Run"); 16270 return count; 16271 16272 deleted += count; 16273 } 16274 16275 return deleted; 16276 } 16277 bool p6RunInsertObject(psDB *dbh, p6RunRow *object) 16278 { 16279 return p6RunInsert(dbh, object->p6_id, object->state, object->workdir, object->registered); 16280 } 16281 16282 bool p6RunInsertObjects(psDB *dbh, psArray *objects) 16283 { 16284 for (long i = 0; i < psArrayLength(objects); i++) { 16285 if (!p6RunInsertObject(dbh, objects->data[i])) { 16286 return false; 16287 } 16288 } 16289 16290 return true; 16291 } 16292 16293 bool p6RunInsertFits(psDB *dbh, const psFits *fits) 16294 { 16295 psArray *rowSet; 16296 16297 // move to (the first?) extension named P6RUN_TABLE_NAME 16298 if (!psFitsMoveExtName(fits, P6RUN_TABLE_NAME)) { 16299 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P6RUN_TABLE_NAME); 16300 return false; 16301 } 16302 16303 // check HDU type 16304 if (psFitsGetExtType(fits) != PS_FITS_TYPE_BINARY_TABLE) { 16305 psError(PS_ERR_UNKNOWN, true, "FITS HDU type is not PS_FITS_TYPE_BINARY_TABLE"); 16306 return false; 16307 } 16308 16309 // read fits table 16310 rowSet = psFitsReadTable(fits); 16311 if (!rowSet) { 16312 psError(PS_ERR_UNKNOWN, true, "FITS read error or FITS table is empty"); 16313 psFree(rowSet); 16314 return false; 16315 } 16316 16317 if (!psDBInsertRows(dbh, P6RUN_TABLE_NAME, rowSet)) { 16318 psError(PS_ERR_UNKNOWN, false, "databse insert failed"); 16319 psFree(rowSet); 16320 return false; 16321 } 16322 16323 psFree(rowSet); 16324 16325 return true; 16326 } 16327 16328 bool p6RunSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit) 16329 { 16330 psArray *rowSet; 16331 16332 rowSet = psDBSelectRows(dbh, P6RUN_TABLE_NAME, where, limit); 16333 if (!rowSet) { 16334 return false; 16335 } 16336 16337 // output to fits 16338 if (!psFitsWriteTable(fits, NULL, rowSet, P6RUN_TABLE_NAME)) { 16339 psError(PS_ERR_UNKNOWN, false, "FITS table write failed"); 16340 psFree(rowSet); 16341 return false; 16342 } 16343 16344 psFree(rowSet); 16345 16346 return true; 16347 } 16348 16349 psMetadata *p6RunMetadataFromObject(const p6RunRow *object) 16350 { 16351 psMetadata *md = psMetadataAlloc(); 16352 if (!psMetadataAdd(md, PS_LIST_TAIL, "p6_id", PS_DATA_S32, NULL, object->p6_id)) { 16353 psError(PS_ERR_UNKNOWN, false, "failed to add item p6_id"); 16354 psFree(md); 16355 return false; 16356 } 16357 if (!psMetadataAdd(md, PS_LIST_TAIL, "state", PS_DATA_STRING, NULL, object->state)) { 16358 psError(PS_ERR_UNKNOWN, false, "failed to add item state"); 16359 psFree(md); 16360 return false; 16361 } 16362 if (!psMetadataAdd(md, PS_LIST_TAIL, "workdir", PS_DATA_STRING, NULL, object->workdir)) { 16363 psError(PS_ERR_UNKNOWN, false, "failed to add item workdir"); 16364 psFree(md); 16365 return false; 16366 } 16367 if (!psMetadataAdd(md, PS_LIST_TAIL, "registered", PS_DATA_TIME, NULL, object->registered)) { 16368 psError(PS_ERR_UNKNOWN, false, "failed to add item registered"); 16369 psFree(md); 16370 return false; 16371 } 16372 16373 16374 return md; 16375 } 16376 16377 p6RunRow *p6RunObjectFromMetadata(psMetadata *md) 16378 { 16379 16380 bool status = false; 16381 psS32 p6_id = psMetadataLookupS32(&status, md, "p6_id"); 16382 if (!status) { 16383 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p6_id"); 16384 return false; 16385 } 16386 char* state = psMetadataLookupPtr(&status, md, "state"); 16387 if (!status) { 16388 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item state"); 16389 return false; 16390 } 16391 char* workdir = psMetadataLookupPtr(&status, md, "workdir"); 16392 if (!status) { 16393 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item workdir"); 16394 return false; 16395 } 16396 psTime* registered = psMetadataLookupPtr(&status, md, "registered"); 16397 if (!status) { 16398 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item registered"); 16399 return false; 16400 } 16401 16402 return p6RunRowAlloc(p6_id, state, workdir, registered); 16403 } 16404 psArray *p6RunSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) 16405 { 16406 psArray *rowSet; 16407 psArray *returnSet; 16408 psU64 i; 16409 16410 rowSet = psDBSelectRows(dbh, P6RUN_TABLE_NAME, where, limit); 16411 if (!rowSet) { 16412 return NULL; 16413 } 16414 16415 // convert psMetadata rows to row objects 16416 16417 returnSet = psArrayAllocEmpty(rowSet->n); 16418 16419 for (i = 0; i < rowSet->n; i++) { 16420 p6RunRow *object = p6RunObjectFromMetadata(rowSet->data[i]); 16421 psArrayAdd(returnSet, 0, object); 16422 psFree(object); 16423 } 16424 16425 psFree(rowSet); 16426 16427 return returnSet; 16428 } 16429 bool p6RunDeleteObject(psDB *dbh, const p6RunRow *object) 16430 { 16431 psMetadata *where = p6RunMetadataFromObject(object); 16432 long long count = psDBDeleteRows(dbh, P6RUN_TABLE_NAME, where, 0); 16433 psFree(where); 16434 if (count < 0) { 16435 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p6Run"); 16436 return false; 16437 } 16438 if (count > 1) { 16439 // XXX should this be a psAbort() instead? It is possible that 16440 // having an object match multiple rows was by design. 16441 psError(PS_ERR_UNKNOWN, true, "p6RunRow object matched more then one row. Check your database schema"); 16442 return false; 16443 } 16444 16445 return true; 16446 } 16447 long long p6RunDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 16448 { 16449 long long deleted = 0; 16450 16451 for (long long i = 0; i < objects->n; i++) { 16452 p6RunRow *object = objects->data[i]; 16453 psMetadata *where = p6RunMetadataFromObject(object); 16454 long long count = psDBDeleteRows(dbh, P6RUN_TABLE_NAME, where, limit); 16455 psFree(where); 16456 if (count < 0) { 16457 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p6Run"); 16458 return count; 16459 } 16460 16461 deleted += count; 16462 } 16463 16464 return deleted; 16465 } 16466 bool p6RunPrintObjects(FILE *stream, psArray *objects, bool mdcf) 16467 { 16468 PS_ASSERT_PTR_NON_NULL(objects, false); 16469 16470 psMetadata *output = psMetadataAlloc(); 16471 for (long i = 0; i < psArrayLength(objects); i++) { 16472 psMetadata *md = p6RunMetadataFromObject(objects->data[i]); 16473 if (!psMetadataAddMetadata( 16474 output, 16475 PS_LIST_TAIL, 16476 P6RUN_TABLE_NAME, 16477 PS_META_DUPLICATE_OK, 16478 NULL, 16479 md 16480 )) { 16481 psError(PS_ERR_UNKNOWN, false, "failed to add metadata"); 16482 psFree(md); 16483 psFree(output); 16484 return false; 16485 } 16486 psFree(md); 16487 } 16488 16489 if (!ippdbPrintMetadataRaw(stream, output, mdcf)) { 16490 psError(PS_ERR_UNKNOWN, false, "failed to print metadata"); 16491 psFree(output); 16492 } 16493 psFree(output); 16494 16495 return true; 16496 } 16497 bool p6RunPrintObject(FILE *stream, p6RunRow *object, bool mdcf) 16498 { 16499 PS_ASSERT_PTR_NON_NULL(object, false); 16500 16501 psMetadata *md = p6RunMetadataFromObject(object); 16502 16503 if (!ippdbPrintMetadataRaw(stream, md, mdcf)) { 16504 psError(PS_ERR_UNKNOWN, false, "failed to print metadata"); 16505 psFree(md); 16506 } 16507 16508 psFree(md); 16509 16510 return true; 16511 } -
trunk/ippdb/src/ippdb.h
r11809 r11820 2018 2018 psF64 posang; 2019 2019 char *object; 2020 psF32 solang; 2020 2021 psS16 fault; 2021 2022 } rawExpRow; … … 2048 2049 psF64 posang, 2049 2050 const char *object, 2051 psF32 solang, 2050 2052 psS16 fault 2051 2053 ); … … 2099 2101 psF64 posang, 2100 2102 const char *object, 2103 psF32 solang, 2101 2104 psS16 fault 2102 2105 ); … … 4417 4420 psTime* use_begin; 4418 4421 psTime* use_end; 4422 psF32 solang_min; 4423 psF32 solang_max; 4424 char *label; 4425 psS32 parent; 4419 4426 } detRunRow; 4420 4427 … … 4447 4454 psTime* time_end, 4448 4455 psTime* use_begin, 4449 psTime* use_end 4456 psTime* use_end, 4457 psF32 solang_min, 4458 psF32 solang_max, 4459 const char *label, 4460 psS32 parent 4450 4461 ); 4451 4462 … … 4499 4510 psTime* time_end, 4500 4511 psTime* use_begin, 4501 psTime* use_end 4512 psTime* use_end, 4513 psF32 solang_min, 4514 psF32 solang_max, 4515 const char *label, 4516 psS32 parent 4502 4517 ); 4503 4518 … … 7881 7896 char *skycell_id; 7882 7897 char *tess_id; 7883 char *exp_tag;7884 psS32 p3_version;7885 7898 char *kind; 7886 7899 bool template; … … 7897 7910 const char *skycell_id, 7898 7911 const char *tess_id, 7899 const char *exp_tag,7900 psS32 p3_version,7901 7912 const char *kind, 7902 7913 bool template … … 7934 7945 const char *skycell_id, 7935 7946 const char *tess_id, 7936 const char *exp_tag,7937 psS32 p3_version,7938 7947 const char *kind, 7939 7948 bool template … … 8297 8306 bool mdcf ///< format as mdconfig or simple 8298 8307 ); 8308 /** p6RunRow data structure 8309 * 8310 * Structure for representing a single row of p6Run table data. 8311 */ 8312 8313 typedef struct { 8314 psS32 p6_id; 8315 char *state; 8316 char *workdir; 8317 psTime* registered; 8318 } p6RunRow; 8319 8320 /** Creates a new p6RunRow object 8321 * 8322 * @return A new p6RunRow object or NULL on failure. 8323 */ 8324 8325 p6RunRow *p6RunRowAlloc( 8326 psS32 p6_id, 8327 const char *state, 8328 const char *workdir, 8329 psTime* registered 8330 ); 8331 8332 /** Creates a new p6Run table 8333 * 8334 * @return true on success 8335 */ 8336 8337 bool p6RunCreateTable( 8338 psDB *dbh ///< Database handle 8339 ); 8340 8341 /** Deletes a p6Run table 8342 * 8343 * @return true on success 8344 */ 8345 8346 bool p6RunDropTable( 8347 psDB *dbh ///< Database handle 8348 ); 8349 8350 /** Insert a single row into a table 8351 * 8352 * This function constructs and inserts a single row based on it's parameters. 8353 * 8354 * @return true on success 8355 */ 8356 8357 bool p6RunInsert( 8358 psDB *dbh, ///< Database handle 8359 psS32 p6_id, 8360 const char *state, 8361 const char *workdir, 8362 psTime* registered 8363 ); 8364 8365 /** Deletes up to limit rows from the database and returns the number of rows actually deleted. 8366 * 8367 * @return A The number of rows removed or a negative value on error 8368 */ 8369 8370 long long p6RunDelete( 8371 psDB *dbh, ///< Database handle 8372 const psMetadata *where, ///< Row match criteria 8373 unsigned long long limit ///< Maximum number of elements to delete 8374 ); 8375 8376 /** Insert a single p6RunRow object into a table 8377 * 8378 * This function constructs and inserts a single row based on it's parameters. 8379 * 8380 * @return true on success 8381 */ 8382 8383 bool p6RunInsertObject( 8384 psDB *dbh, ///< Database handle 8385 p6RunRow *object ///< p6RunRow object 8386 ); 8387 8388 /** Insert an array of p6RunRow object into a table 8389 * 8390 * This function constructs and inserts multiple rows based on it's parameters. 8391 * 8392 * @return true on success 8393 */ 8394 8395 bool p6RunInsertObjects( 8396 psDB *dbh, ///< Database handle 8397 psArray *objects ///< array of p6RunRow objects 8398 ); 8399 8400 /** Insert data from a binary FITS table p6RunRow into the database 8401 * 8402 * This function expects a psFits object with a FITS table as the first 8403 * extension. The table must have at least one row of data in it, that is of 8404 * the appropriate format (number of columns and their type). All other 8405 * extensions are ignored. 8406 * 8407 * @return true on success 8408 */ 8409 8410 bool p6RunInsertFits( 8411 psDB *dbh, ///< Database handle 8412 const psFits *fits ///< psFits object 8413 ); 8414 8415 /** Selects up to limit from the database and returns them in a binary FITS table 8416 * 8417 * This function assumes an empty psFits object and will create a FITS table 8418 * as the first extension. 8419 * 8420 * See psDBSelectRows() for documentation on the format of where. 8421 * 8422 * @return true on success 8423 */ 8424 8425 bool p6RunSelectRowsFits( 8426 psDB *dbh, ///< Database handle 8427 psFits *fits, ///< psFits object 8428 const psMetadata *where, ///< Row match criteria 8429 unsigned long long limit ///< Maximum number of elements to return 8430 ); 8431 8432 /** Convert a p6RunRow into an equivalent psMetadata 8433 * 8434 * @return A psMetadata pointer or NULL on error 8435 */ 8436 8437 psMetadata *p6RunMetadataFromObject( 8438 const p6RunRow *object ///< fooRow to convert into a psMetadata 8439 ); 8440 8441 /** Convert a psMetadata into an equivalent fooRow 8442 * 8443 * @return A p6RunRow pointer or NULL on error 8444 */ 8445 8446 p6RunRow *p6RunObjectFromMetadata( 8447 psMetadata *md ///< psMetadata to convert into a fooRow 8448 ); 8449 /** Selects up to limit rows from the database and returns as p6RunRow objects in a psArray 8450 * 8451 * See psDBSelectRows() for documentation on the format of where. 8452 * 8453 * @return A psArray pointer or NULL on error 8454 */ 8455 8456 psArray *p6RunSelectRowObjects( 8457 psDB *dbh, ///< Database handle 8458 const psMetadata *where, ///< Row match criteria 8459 unsigned long long limit ///< Maximum number of elements to return 8460 ); 8461 /** Deletes a row from the database coresponding to an p6Run 8462 * 8463 * Note that a 'where' search psMetadata is constructed from each object and 8464 * used to find rows to delete. 8465 * 8466 * @return A The number of rows removed or a negative value on error 8467 */ 8468 8469 bool p6RunDeleteObject( 8470 psDB *dbh, ///< Database handle 8471 const p6RunRow *object ///< Object to delete 8472 ); 8473 /** Deletes up to limit rows from the database and returns the number of rows actually deleted. 8474 * 8475 * Note that a 'where' search psMetadata is constructed from each object and 8476 * used to find rows to delete. 8477 * 8478 * @return A The number of rows removed or a negative value on error 8479 */ 8480 8481 long long p6RunDeleteRowObjects( 8482 psDB *dbh, ///< Database handle 8483 const psArray *objects, ///< Array of objects to delete 8484 unsigned long long limit ///< Maximum number of elements to delete 8485 ); 8486 /** Formats and prints an array of p6RunRow objects 8487 * 8488 * When mdcf is set the formated output is in psMetadataConfig 8489 * format, otherwise it is in a simple tabular format. 8490 * 8491 * @return true on success 8492 */ 8493 8494 bool p6RunPrintObjects( 8495 FILE *stream, ///< a stream 8496 psArray *objects, ///< An array of p6RunRow objects 8497 bool mdcf ///< format as mdconfig or simple 8498 ); 8499 /** Formats and prints an p6RunRow object 8500 * 8501 * When mdcf is set the formated output is in psMetadataConfig 8502 * format, otherwise it is in a simple tabular format. 8503 * 8504 * @return true on success 8505 */ 8506 8507 bool p6RunPrintObject( 8508 FILE *stream, ///< a stream 8509 p6RunRow *object, ///< an p6RunRow object 8510 bool mdcf ///< format as mdconfig or simple 8511 ); 8299 8512 8300 8513 /// @} … … 8304 8517 #endif 8305 8518 8306 #endif // P 5DIFFSCFILE_DB_H8519 #endif // P6RUN_DB_H -
trunk/ippdb/tests/alloc.c
r11809 r11820 311 311 rawExpRow *object; 312 312 313 object = rawExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, "a string", "a string", 32.32, 64.64, 64.64, 32.32, 64.64, 64.64, 64.64, 64.64, 64.64, 32.32, 64.64, "a string", -16 );313 object = rawExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, "a string", "a string", 32.32, 64.64, 64.64, 32.32, 64.64, 64.64, 64.64, 64.64, 64.64, 32.32, 64.64, "a string", 32.32, -16 ); 314 314 315 315 if (!object) { … … 400 400 exit(EXIT_FAILURE); 401 401 } 402 if (!object->solang == 32.32) { 403 psFree(object); 404 exit(EXIT_FAILURE); 405 } 402 406 if (!object->fault == -16) { 403 407 psFree(object); … … 832 836 detRunRow *object; 833 837 834 object = detRunRowAlloc(-32, -32, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 64.64, 64.64, "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z" );838 object = detRunRowAlloc(-32, -32, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 64.64, 64.64, "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", 32.32, 32.32, "a string", -32 ); 835 839 836 840 if (!object) { … … 925 929 exit(EXIT_FAILURE); 926 930 } 931 if (!object->solang_min == 32.32) { 932 psFree(object); 933 exit(EXIT_FAILURE); 934 } 935 if (!object->solang_max == 32.32) { 936 psFree(object); 937 exit(EXIT_FAILURE); 938 } 939 if (strncmp(object->label, "a string", MAX_STRING_LENGTH)) { 940 psFree(object); 941 exit(EXIT_FAILURE); 942 } 943 if (!object->parent == -32) { 944 psFree(object); 945 exit(EXIT_FAILURE); 946 } 927 947 928 948 psFree(object); … … 1581 1601 p5InputScfileRow *object; 1582 1602 1583 object = p5InputScfileRowAlloc(-32, -32, "a string", "a string", "a string", -32, "a string",true );1603 object = p5InputScfileRowAlloc(-32, -32, "a string", "a string", "a string", true ); 1584 1604 1585 1605 if (!object) { … … 1603 1623 exit(EXIT_FAILURE); 1604 1624 } 1605 if (strncmp(object->exp_tag, "a string", MAX_STRING_LENGTH)) {1606 psFree(object);1607 exit(EXIT_FAILURE);1608 }1609 if (!object->p3_version == -32) {1610 psFree(object);1611 exit(EXIT_FAILURE);1612 }1613 1625 if (strncmp(object->kind, "a string", MAX_STRING_LENGTH)) { 1614 1626 psFree(object); … … 1653 1665 } 1654 1666 if (!object->bg_mean_stdev == 64.64) { 1667 psFree(object); 1668 exit(EXIT_FAILURE); 1669 } 1670 1671 psFree(object); 1672 } 1673 1674 { 1675 p6RunRow *object; 1676 1677 object = p6RunRowAlloc(-32, "a string", "a string", "0001-01-01T00:00:00Z" ); 1678 1679 if (!object) { 1680 exit(EXIT_FAILURE); 1681 } 1682 1683 if (!object->p6_id == -32) { 1684 psFree(object); 1685 exit(EXIT_FAILURE); 1686 } 1687 if (strncmp(object->state, "a string", MAX_STRING_LENGTH)) { 1688 psFree(object); 1689 exit(EXIT_FAILURE); 1690 } 1691 if (strncmp(object->workdir, "a string", MAX_STRING_LENGTH)) { 1692 psFree(object); 1693 exit(EXIT_FAILURE); 1694 } 1655 1695 psFree(object); 1656 1696 exit(EXIT_FAILURE); -
trunk/ippdb/tests/createtable.c
r11809 r11820 575 575 } 576 576 577 { 578 psDB *dbh; 579 580 dbh = psDBInit("localhost", "test", NULL, "test"); 581 if (!dbh) { 582 exit(EXIT_FAILURE); 583 } 584 585 if(!p6RunCreateTable(dbh)) { 586 exit(EXIT_FAILURE); 587 } 588 589 psDBCleanup(dbh); 590 } 591 577 592 exit(EXIT_SUCCESS); 578 593 } -
trunk/ippdb/tests/dbcleanup.c
r11809 r11820 49 49 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p5InputScfile"); 50 50 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p5DiffScfile"); 51 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p6Run"); 51 52 52 53 psDBCleanup(dbh); -
trunk/ippdb/tests/dbsetup.c
r11809 r11820 127 127 p5DiffScfileCreateTable(dbh); 128 128 129 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p6Run"); 130 p6RunCreateTable(dbh); 131 129 132 psDBCleanup(dbh); 130 133 -
trunk/ippdb/tests/droptable.c
r11809 r11820 575 575 } 576 576 577 { 578 psDB *dbh; 579 580 dbh = psDBInit("localhost", "test", NULL, "test"); 581 if (!dbh) { 582 exit(EXIT_FAILURE); 583 } 584 585 if (!p6RunDropTable(dbh)) { 586 exit(EXIT_FAILURE); 587 } 588 589 psDBCleanup(dbh); 590 } 591 577 592 exit(EXIT_SUCCESS); 578 593 } -
trunk/ippdb/tests/insert.c
r11809 r11820 148 148 } 149 149 150 if (!rawExpInsert(dbh, "a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, "a string", "a string", 32.32, 64.64, 64.64, 32.32, 64.64, 64.64, 64.64, 64.64, 64.64, 32.32, 64.64, "a string", -16)) {150 if (!rawExpInsert(dbh, "a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, "a string", "a string", 32.32, 64.64, 64.64, 32.32, 64.64, 64.64, 64.64, 64.64, 64.64, 32.32, 64.64, "a string", 32.32, -16)) { 151 151 exit(EXIT_FAILURE); 152 152 } … … 313 313 } 314 314 315 if (!detRunInsert(dbh, -32, -32, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 64.64, 64.64, "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z" )) {315 if (!detRunInsert(dbh, -32, -32, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 64.64, 64.64, "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", 32.32, 32.32, "a string", -32)) { 316 316 exit(EXIT_FAILURE); 317 317 } … … 553 553 } 554 554 555 if (!p5InputScfileInsert(dbh, -32, -32, "a string", "a string", "a string", -32, "a string",true)) {555 if (!p5InputScfileInsert(dbh, -32, -32, "a string", "a string", "a string", true)) { 556 556 exit(EXIT_FAILURE); 557 557 } … … 569 569 570 570 if (!p5DiffScfileInsert(dbh, -32, "a string", "a string", "a string", 64.64, 64.64)) { 571 exit(EXIT_FAILURE); 572 } 573 574 psDBCleanup(dbh); 575 } 576 577 { 578 psDB *dbh; 579 580 dbh = psDBInit("localhost", "test", NULL, "test"); 581 if (!dbh) { 582 exit(EXIT_FAILURE); 583 } 584 585 if (!p6RunInsert(dbh, -32, "a string", "a string", "0001-01-01T00:00:00Z")) { 571 586 exit(EXIT_FAILURE); 572 587 } -
trunk/ippdb/tests/insertfits.c
r11809 r11820 997 997 } 998 998 999 { 1000 psDB *dbh; 1001 psFits *fits; 1002 1003 dbh = psDBInit("localhost", "test", NULL, "test"); 1004 if (!dbh) { 1005 exit(EXIT_FAILURE); 1006 } 1007 1008 // open a temp 1009 fits = psFitsOpen(TMP_FILENAME, "r"); 1010 if (!fits) { 1011 exit(EXIT_FAILURE); 1012 } 1013 1014 if (!p6RunInsertFits(dbh, fits)) { 1015 exit(EXIT_FAILURE); 1016 } 1017 1018 if (!psFitsClose(fits)) { 1019 exit(EXIT_FAILURE); 1020 } 1021 1022 psDBCleanup(dbh); 1023 } 1024 999 1025 exit(EXIT_SUCCESS); 1000 1026 } -
trunk/ippdb/tests/insertobject.c
r11809 r11820 212 212 } 213 213 214 object = rawExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, "a string", "a string", 32.32, 64.64, 64.64, 32.32, 64.64, 64.64, 64.64, 64.64, 64.64, 32.32, 64.64, "a string", -16);214 object = rawExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, "a string", "a string", 32.32, 64.64, 64.64, 32.32, 64.64, 64.64, 64.64, 64.64, 64.64, 32.32, 64.64, "a string", 32.32, -16); 215 215 if (!object) { 216 216 exit(EXIT_FAILURE); … … 454 454 } 455 455 456 object = detRunRowAlloc(-32, -32, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 64.64, 64.64, "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z" );456 object = detRunRowAlloc(-32, -32, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 64.64, 64.64, "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", 32.32, 32.32, "a string", -32); 457 457 if (!object) { 458 458 exit(EXIT_FAILURE); … … 806 806 } 807 807 808 object = p5InputScfileRowAlloc(-32, -32, "a string", "a string", "a string", -32, "a string",true);808 object = p5InputScfileRowAlloc(-32, -32, "a string", "a string", "a string", true); 809 809 if (!object) { 810 810 exit(EXIT_FAILURE); … … 834 834 835 835 if (!p5DiffScfileInsertObject(dbh, object)) { 836 exit(EXIT_FAILURE); 837 } 838 839 psFree(object); 840 psDBCleanup(dbh); 841 } 842 843 { 844 psDB *dbh; 845 p6RunRow *object; 846 847 dbh = psDBInit("localhost", "test", NULL, "test"); 848 if (!dbh) { 849 exit(EXIT_FAILURE); 850 } 851 852 object = p6RunRowAlloc(-32, "a string", "a string", "0001-01-01T00:00:00Z"); 853 if (!object) { 854 exit(EXIT_FAILURE); 855 } 856 857 if (!p6RunInsertObject(dbh, object)) { 836 858 exit(EXIT_FAILURE); 837 859 } -
trunk/ippdb/tests/metadatafromobject.c
r11809 r11820 384 384 bool status; 385 385 386 object = rawExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, "a string", "a string", 32.32, 64.64, 64.64, 32.32, 64.64, 64.64, 64.64, 64.64, 64.64, 32.32, 64.64, "a string", -16);386 object = rawExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, "a string", "a string", 32.32, 64.64, 64.64, 32.32, 64.64, 64.64, 64.64, 64.64, 64.64, 32.32, 64.64, "a string", 32.32, -16); 387 387 if (!object) { 388 388 exit(EXIT_FAILURE); … … 479 479 exit(EXIT_FAILURE); 480 480 } 481 if (!psMetadataLookupF32(&status, md, "solang") == 32.32) { 482 psFree(md); 483 exit(EXIT_FAILURE); 484 } 481 485 psFree(md); 482 486 exit(EXIT_FAILURE); … … 989 993 bool status; 990 994 991 object = detRunRowAlloc(-32, -32, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 64.64, 64.64, "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z" );995 object = detRunRowAlloc(-32, -32, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 64.64, 64.64, "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", 32.32, 32.32, "a string", -32); 992 996 if (!object) { 993 997 exit(EXIT_FAILURE); … … 1088 1092 exit(EXIT_FAILURE); 1089 1093 } 1094 if (!psMetadataLookupF32(&status, md, "solang_min") == 32.32) { 1095 psFree(md); 1096 exit(EXIT_FAILURE); 1097 } 1098 if (!psMetadataLookupF32(&status, md, "solang_max") == 32.32) { 1099 psFree(md); 1100 exit(EXIT_FAILURE); 1101 } 1102 if (strncmp(psMetadataLookupPtr(&status, md, "label"), "a string", MAX_STRING_LENGTH)) { 1103 psFree(md); 1104 exit(EXIT_FAILURE); 1105 } 1106 if (!psMetadataLookupS32(&status, md, "parent") == -32) { 1107 psFree(md); 1108 exit(EXIT_FAILURE); 1109 } 1090 1110 1091 1111 psFree(md); … … 1857 1877 bool status; 1858 1878 1859 object = p5InputScfileRowAlloc(-32, -32, "a string", "a string", "a string", -32, "a string",true);1879 object = p5InputScfileRowAlloc(-32, -32, "a string", "a string", "a string", true); 1860 1880 if (!object) { 1861 1881 exit(EXIT_FAILURE); … … 1885 1905 exit(EXIT_FAILURE); 1886 1906 } 1887 if (strncmp(psMetadataLookupPtr(&status, md, "exp_tag"), "a string", MAX_STRING_LENGTH)) {1888 psFree(md);1889 exit(EXIT_FAILURE);1890 }1891 if (!psMetadataLookupS32(&status, md, "p3_version") == -32) {1892 psFree(md);1893 exit(EXIT_FAILURE);1894 }1895 1907 if (strncmp(psMetadataLookupPtr(&status, md, "kind"), "a string", MAX_STRING_LENGTH)) { 1896 1908 psFree(md); … … 1943 1955 } 1944 1956 if (!psMetadataLookupF64(&status, md, "bg_mean_stdev") == 64.64) { 1957 psFree(md); 1958 exit(EXIT_FAILURE); 1959 } 1960 1961 psFree(md); 1962 } 1963 1964 { 1965 psMetadata *md; 1966 p6RunRow *object; 1967 bool status; 1968 1969 object = p6RunRowAlloc(-32, "a string", "a string", "0001-01-01T00:00:00Z"); 1970 if (!object) { 1971 exit(EXIT_FAILURE); 1972 } 1973 1974 md = p6RunMetadataFromObject(object); 1975 if (!md) { 1976 exit(EXIT_FAILURE); 1977 } 1978 1979 psFree(object); 1980 1981 if (!psMetadataLookupS32(&status, md, "p6_id") == -32) { 1982 psFree(md); 1983 exit(EXIT_FAILURE); 1984 } 1985 if (strncmp(psMetadataLookupPtr(&status, md, "state"), "a string", MAX_STRING_LENGTH)) { 1986 psFree(md); 1987 exit(EXIT_FAILURE); 1988 } 1989 if (strncmp(psMetadataLookupPtr(&status, md, "workdir"), "a string", MAX_STRING_LENGTH)) { 1990 psFree(md); 1991 exit(EXIT_FAILURE); 1992 } 1945 1993 psFree(md); 1946 1994 exit(EXIT_FAILURE); -
trunk/ippdb/tests/objectfrommetadata.c
r11809 r11820 622 622 exit(EXIT_FAILURE); 623 623 } 624 if (!psMetadataAddF32(md, PS_LIST_TAIL, "solang", 0, NULL, 32.32)) { 625 psFree(md); 626 exit(EXIT_FAILURE); 627 } 624 628 psFree(md); 625 629 exit(EXIT_FAILURE); … … 717 721 exit(EXIT_FAILURE); 718 722 } 723 if (!object->solang == 32.32) { 724 psFree(object); 725 exit(EXIT_FAILURE); 726 } 719 727 psFree(object); 720 728 exit(EXIT_FAILURE); … … 1572 1580 exit(EXIT_FAILURE); 1573 1581 } 1582 if (!psMetadataAddF32(md, PS_LIST_TAIL, "solang_min", 0, NULL, 32.32)) { 1583 psFree(md); 1584 exit(EXIT_FAILURE); 1585 } 1586 if (!psMetadataAddF32(md, PS_LIST_TAIL, "solang_max", 0, NULL, 32.32)) { 1587 psFree(md); 1588 exit(EXIT_FAILURE); 1589 } 1590 if (!psMetadataAddStr(md, PS_LIST_TAIL, "label", 0, NULL, "a string")) { 1591 psFree(md); 1592 exit(EXIT_FAILURE); 1593 } 1594 if (!psMetadataAddS32(md, PS_LIST_TAIL, "parent", 0, NULL, -32)) { 1595 psFree(md); 1596 exit(EXIT_FAILURE); 1597 } 1574 1598 1575 1599 object = detRunObjectFromMetadata(md); … … 1668 1692 exit(EXIT_FAILURE); 1669 1693 } 1694 if (!object->solang_min == 32.32) { 1695 psFree(object); 1696 exit(EXIT_FAILURE); 1697 } 1698 if (!object->solang_max == 32.32) { 1699 psFree(object); 1700 exit(EXIT_FAILURE); 1701 } 1702 if (strncmp(object->label, "a string", MAX_STRING_LENGTH)) { 1703 psFree(object); 1704 exit(EXIT_FAILURE); 1705 } 1706 if (!object->parent == -32) { 1707 psFree(object); 1708 exit(EXIT_FAILURE); 1709 } 1670 1710 1671 1711 psFree(object); … … 2853 2893 exit(EXIT_FAILURE); 2854 2894 } 2855 if (!psMetadataAddStr(md, PS_LIST_TAIL, "exp_tag", 0, NULL, "a string")) {2856 psFree(md);2857 exit(EXIT_FAILURE);2858 }2859 if (!psMetadataAddS32(md, PS_LIST_TAIL, "p3_version", 0, NULL, -32)) {2860 psFree(md);2861 exit(EXIT_FAILURE);2862 }2863 2895 if (!psMetadataAddStr(md, PS_LIST_TAIL, "kind", 0, NULL, "a string")) { 2864 2896 psFree(md); … … 2894 2926 exit(EXIT_FAILURE); 2895 2927 } 2896 if (strncmp(object->exp_tag, "a string", MAX_STRING_LENGTH)) {2897 psFree(object);2898 exit(EXIT_FAILURE);2899 }2900 if (!object->p3_version == -32) {2901 psFree(object);2902 exit(EXIT_FAILURE);2903 }2904 2928 if (strncmp(object->kind, "a string", MAX_STRING_LENGTH)) { 2905 2929 psFree(object); … … 2973 2997 } 2974 2998 if (!object->bg_mean_stdev == 64.64) { 2999 psFree(object); 3000 exit(EXIT_FAILURE); 3001 } 3002 3003 psFree(object); 3004 } 3005 3006 { 3007 psMetadata *md; 3008 p6RunRow *object; 3009 3010 md = psMetadataAlloc(); 3011 if (!psMetadataAddS32(md, PS_LIST_TAIL, "p6_id", 0, NULL, -32)) { 3012 psFree(md); 3013 exit(EXIT_FAILURE); 3014 } 3015 if (!psMetadataAddStr(md, PS_LIST_TAIL, "state", 0, NULL, "a string")) { 3016 psFree(md); 3017 exit(EXIT_FAILURE); 3018 } 3019 if (!psMetadataAddStr(md, PS_LIST_TAIL, "workdir", 0, NULL, "a string")) { 3020 psFree(md); 3021 exit(EXIT_FAILURE); 3022 } 3023 psFree(md); 3024 exit(EXIT_FAILURE); 3025 } 3026 3027 object = p6RunObjectFromMetadata(md); 3028 if (!object) { 3029 psFree(md); 3030 exit(EXIT_FAILURE); 3031 } 3032 3033 psFree(md); 3034 3035 if (!object->p6_id == -32) { 3036 psFree(object); 3037 exit(EXIT_FAILURE); 3038 } 3039 if (strncmp(object->state, "a string", MAX_STRING_LENGTH)) { 3040 psFree(object); 3041 exit(EXIT_FAILURE); 3042 } 3043 if (strncmp(object->workdir, "a string", MAX_STRING_LENGTH)) { 3044 psFree(object); 3045 exit(EXIT_FAILURE); 3046 } 2975 3047 psFree(object); 2976 3048 exit(EXIT_FAILURE); -
trunk/ippdb/tests/selectrowsfits.c
r11809 r11820 843 843 } 844 844 845 { 846 psDB *dbh; 847 psFits *fits; 848 849 dbh = psDBInit("localhost", "test", NULL, "test"); 850 if (!dbh) { 851 exit(EXIT_FAILURE); 852 } 853 854 fits = psFitsOpen(TMP_FILENAME, "w"); 855 if (!fits) { 856 exit(EXIT_FAILURE); 857 } 858 859 if (!p6RunSelectRowsFits(dbh, fits, NULL, 1)) { 860 exit(EXIT_FAILURE); 861 } 862 863 psFree(fits); 864 psDBCleanup(dbh); 865 } 866 845 867 exit(EXIT_SUCCESS); 846 868 }
Note:
See TracChangeset
for help on using the changeset viewer.
