Changeset 12260
- Timestamp:
- Mar 5, 2007, 5:42:40 PM (19 years ago)
- Location:
- trunk/ippdb
- Files:
-
- 8 edited
-
configure.ac (modified) (1 diff)
-
src/ippdb.c (modified) (19 diffs)
-
src/ippdb.h (modified) (6 diffs)
-
tests/alloc.c (modified) (4 diffs)
-
tests/insert.c (modified) (1 diff)
-
tests/insertobject.c (modified) (2 diffs)
-
tests/metadatafromobject.c (modified) (4 diffs)
-
tests/objectfrommetadata.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippdb/configure.ac
r12202 r12260 7 7 AC_PREREQ(2.59) 8 8 9 AC_INIT([ippdb], [1.1.1 5], [pan-starrs.ifa.hawaii.edu])9 AC_INIT([ippdb], [1.1.16], [pan-starrs.ifa.hawaii.edu]) 10 10 AC_CONFIG_SRCDIR([ippdb.pc.in]) 11 11 -
trunk/ippdb/src/ippdb.c
r12236 r12260 3526 3526 static void rawExpRowFree(rawExpRow *object); 3527 3527 3528 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)3528 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 *filelevel, 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) 3529 3529 { 3530 3530 rawExpRow *_object; … … 3540 3540 _object->exp_type = psStringCopy(exp_type); 3541 3541 _object->imfiles = imfiles; 3542 _object->filelevel = psStringCopy(filelevel); 3542 3543 _object->workdir = psStringCopy(workdir); 3543 3544 _object->filter = psStringCopy(filter); … … 3568 3569 psFree(object->dateobs); 3569 3570 psFree(object->exp_type); 3571 psFree(object->filelevel); 3570 3572 psFree(object->workdir); 3571 3573 psFree(object->filter); … … 3611 3613 return false; 3612 3614 } 3615 if (!psMetadataAdd(md, PS_LIST_TAIL, "filelevel", PS_DATA_STRING, NULL, "64")) { 3616 psError(PS_ERR_UNKNOWN, false, "failed to add item filelevel"); 3617 psFree(md); 3618 return false; 3619 } 3613 3620 if (!psMetadataAdd(md, PS_LIST_TAIL, "workdir", PS_DATA_STRING, "destination for output files", "255")) { 3614 3621 psError(PS_ERR_UNKNOWN, false, "failed to add item workdir"); … … 3704 3711 } 3705 3712 3706 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)3713 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 *filelevel, 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) 3707 3714 { 3708 3715 psMetadata *md = psMetadataAlloc(); … … 3739 3746 if (!psMetadataAdd(md, PS_LIST_TAIL, "imfiles", PS_DATA_S32, NULL, imfiles)) { 3740 3747 psError(PS_ERR_UNKNOWN, false, "failed to add item imfiles"); 3748 psFree(md); 3749 return false; 3750 } 3751 if (!psMetadataAdd(md, PS_LIST_TAIL, "filelevel", PS_DATA_STRING, NULL, filelevel)) { 3752 psError(PS_ERR_UNKNOWN, false, "failed to add item filelevel"); 3741 3753 psFree(md); 3742 3754 return false; … … 3845 3857 bool rawExpInsertObject(psDB *dbh, rawExpRow *object) 3846 3858 { 3847 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);3859 return rawExpInsert(dbh, object->exp_tag, object->exp_id, object->camera, object->telescope, object->dateobs, object->exp_type, object->imfiles, object->filelevel, 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); 3848 3860 } 3849 3861 … … 3953 3965 return false; 3954 3966 } 3967 if (!psMetadataAdd(md, PS_LIST_TAIL, "filelevel", PS_DATA_STRING, NULL, object->filelevel)) { 3968 psError(PS_ERR_UNKNOWN, false, "failed to add item filelevel"); 3969 psFree(md); 3970 return false; 3971 } 3955 3972 if (!psMetadataAdd(md, PS_LIST_TAIL, "workdir", PS_DATA_STRING, NULL, object->workdir)) { 3956 3973 psError(PS_ERR_UNKNOWN, false, "failed to add item workdir"); … … 4077 4094 return false; 4078 4095 } 4096 char* filelevel = psMetadataLookupPtr(&status, md, "filelevel"); 4097 if (!status) { 4098 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item filelevel"); 4099 return false; 4100 } 4079 4101 char* workdir = psMetadataLookupPtr(&status, md, "workdir"); 4080 4102 if (!status) { … … 4158 4180 } 4159 4181 4160 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);4182 return rawExpRowAlloc(exp_tag, exp_id, camera, telescope, dateobs, exp_type, imfiles, filelevel, workdir, filter, airmass, ra, decl, exp_time, bg, bg_stdev, bg_mean_stdev, alt, az, ccd_temp, posang, object, solang, fault); 4161 4183 } 4162 4184 psArray *rawExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 4270 4292 static void rawImfileRowFree(rawImfileRow *object); 4271 4293 4272 rawImfileRow *rawImfileRowAlloc(const char *exp_tag, const char *class , const char *class_id, const char *uri, const char *exp_type, 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, psTime* dateobs, psS16 fault)4294 rawImfileRow *rawImfileRowAlloc(const char *exp_tag, const char *class_id, const char *uri, const char *exp_type, 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, psTime* dateobs, psS16 fault) 4273 4295 { 4274 4296 rawImfileRow *_object; … … 4278 4300 4279 4301 _object->exp_tag = psStringCopy(exp_tag); 4280 _object->class = psStringCopy(class);4281 4302 _object->class_id = psStringCopy(class_id); 4282 4303 _object->uri = psStringCopy(uri); … … 4304 4325 { 4305 4326 psFree(object->exp_tag); 4306 psFree(object->class);4307 4327 psFree(object->class_id); 4308 4328 psFree(object->uri); … … 4321 4341 return false; 4322 4342 } 4323 if (!psMetadataAdd(md, PS_LIST_TAIL, "class", PS_DATA_STRING, NULL, "64")) {4324 psError(PS_ERR_UNKNOWN, false, "failed to add item class");4325 psFree(md);4326 return false;4327 }4328 4343 if (!psMetadataAdd(md, PS_LIST_TAIL, "class_id", PS_DATA_STRING, "Primary Key", "64")) { 4329 4344 psError(PS_ERR_UNKNOWN, false, "failed to add item class_id"); … … 4429 4444 } 4430 4445 4431 bool rawImfileInsert(psDB * dbh, const char *exp_tag, const char *class , const char *class_id, const char *uri, const char *exp_type, 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, psTime* dateobs, psS16 fault)4446 bool rawImfileInsert(psDB * dbh, const char *exp_tag, const char *class_id, const char *uri, const char *exp_type, 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, psTime* dateobs, psS16 fault) 4432 4447 { 4433 4448 psMetadata *md = psMetadataAlloc(); 4434 4449 if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_tag", PS_DATA_STRING, NULL, exp_tag)) { 4435 4450 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag"); 4436 psFree(md);4437 return false;4438 }4439 if (!psMetadataAdd(md, PS_LIST_TAIL, "class", PS_DATA_STRING, NULL, class)) {4440 psError(PS_ERR_UNKNOWN, false, "failed to add item class");4441 4451 psFree(md); 4442 4452 return false; … … 4555 4565 bool rawImfileInsertObject(psDB *dbh, rawImfileRow *object) 4556 4566 { 4557 return rawImfileInsert(dbh, object->exp_tag, object->class , object->class_id, object->uri, object->exp_type, 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->dateobs, object->fault);4567 return rawImfileInsert(dbh, object->exp_tag, object->class_id, object->uri, object->exp_type, 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->dateobs, object->fault); 4558 4568 } 4559 4569 … … 4633 4643 return false; 4634 4644 } 4635 if (!psMetadataAdd(md, PS_LIST_TAIL, "class", PS_DATA_STRING, NULL, object->class)) {4636 psError(PS_ERR_UNKNOWN, false, "failed to add item class");4637 psFree(md);4638 return false;4639 }4640 4645 if (!psMetadataAdd(md, PS_LIST_TAIL, "class_id", PS_DATA_STRING, NULL, object->class_id)) { 4641 4646 psError(PS_ERR_UNKNOWN, false, "failed to add item class_id"); … … 4742 4747 return false; 4743 4748 } 4744 char* class = psMetadataLookupPtr(&status, md, "class");4745 if (!status) {4746 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class");4747 return false;4748 }4749 4749 char* class_id = psMetadataLookupPtr(&status, md, "class_id"); 4750 4750 if (!status) { … … 4838 4838 } 4839 4839 4840 return rawImfileRowAlloc(exp_tag, class , class_id, uri, exp_type, filter, airmass, ra, decl, exp_time, bg, bg_stdev, bg_mean_stdev, alt, az, ccd_temp, posang, object, dateobs, fault);4840 return rawImfileRowAlloc(exp_tag, class_id, uri, exp_type, filter, airmass, ra, decl, exp_time, bg, bg_stdev, bg_mean_stdev, alt, az, ccd_temp, posang, object, dateobs, fault); 4841 4841 } 4842 4842 psArray *rawImfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) -
trunk/ippdb/src/ippdb.h
r12236 r12260 2004 2004 char *exp_type; 2005 2005 psS32 imfiles; 2006 char *filelevel; 2006 2007 char *workdir; 2007 2008 char *filter; … … 2035 2036 const char *exp_type, 2036 2037 psS32 imfiles, 2038 const char *filelevel, 2037 2039 const char *workdir, 2038 2040 const char *filter, … … 2087 2089 const char *exp_type, 2088 2090 psS32 imfiles, 2091 const char *filelevel, 2089 2092 const char *workdir, 2090 2093 const char *filter, … … 2259 2262 typedef struct { 2260 2263 char *exp_tag; 2261 char *class;2262 2264 char *class_id; 2263 2265 char *uri; … … 2287 2289 rawImfileRow *rawImfileRowAlloc( 2288 2290 const char *exp_tag, 2289 const char *class,2290 2291 const char *class_id, 2291 2292 const char *uri, … … 2336 2337 psDB *dbh, ///< Database handle 2337 2338 const char *exp_tag, 2338 const char *class,2339 2339 const char *class_id, 2340 2340 const char *uri, -
trunk/ippdb/tests/alloc.c
r12236 r12260 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", 32.32, -16 );313 object = rawExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, "a string", "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) { … … 344 344 exit(EXIT_FAILURE); 345 345 } 346 if (strncmp(object->filelevel, "a string", MAX_STRING_LENGTH)) { 347 psFree(object); 348 exit(EXIT_FAILURE); 349 } 346 350 if (strncmp(object->workdir, "a string", MAX_STRING_LENGTH)) { 347 351 psFree(object); … … 415 419 rawImfileRow *object; 416 420 417 object = rawImfileRowAlloc("a string", "a string", "a string", "a string", "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", "0001-01-01T00:00:00Z", -16 );421 object = rawImfileRowAlloc("a string", "a string", "a string", "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", "0001-01-01T00:00:00Z", -16 ); 418 422 419 423 if (!object) { … … 422 426 423 427 if (strncmp(object->exp_tag, "a string", MAX_STRING_LENGTH)) { 424 psFree(object);425 exit(EXIT_FAILURE);426 }427 if (strncmp(object->class, "a string", MAX_STRING_LENGTH)) {428 428 psFree(object); 429 429 exit(EXIT_FAILURE); -
trunk/ippdb/tests/insert.c
r12236 r12260 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", 32.32, -16)) {151 exit(EXIT_FAILURE); 152 } 153 154 psDBCleanup(dbh); 155 } 156 157 { 158 psDB *dbh; 159 160 dbh = psDBInit("localhost", "test", NULL, "test"); 161 if (!dbh) { 162 exit(EXIT_FAILURE); 163 } 164 165 if (!rawImfileInsert(dbh, "a string", "a string", "a string", "a string", "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", "0001-01-01T00:00:00Z", -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", "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 exit(EXIT_FAILURE); 152 } 153 154 psDBCleanup(dbh); 155 } 156 157 { 158 psDB *dbh; 159 160 dbh = psDBInit("localhost", "test", NULL, "test"); 161 if (!dbh) { 162 exit(EXIT_FAILURE); 163 } 164 165 if (!rawImfileInsert(dbh, "a string", "a string", "a string", "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", "0001-01-01T00:00:00Z", -16)) { 166 166 exit(EXIT_FAILURE); 167 167 } -
trunk/ippdb/tests/insertobject.c
r12236 r12260 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", 32.32, -16);214 object = rawExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, "a string", "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); … … 234 234 } 235 235 236 object = rawImfileRowAlloc("a string", "a string", "a string", "a string", "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", "0001-01-01T00:00:00Z", -16);236 object = rawImfileRowAlloc("a string", "a string", "a string", "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", "0001-01-01T00:00:00Z", -16); 237 237 if (!object) { 238 238 exit(EXIT_FAILURE); -
trunk/ippdb/tests/metadatafromobject.c
r12236 r12260 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", 32.32, -16);386 object = rawExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, "a string", "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); … … 423 423 exit(EXIT_FAILURE); 424 424 } 425 if (strncmp(psMetadataLookupPtr(&status, md, "filelevel"), "a string", MAX_STRING_LENGTH)) { 426 psFree(md); 427 exit(EXIT_FAILURE); 428 } 425 429 if (strncmp(psMetadataLookupPtr(&status, md, "workdir"), "a string", MAX_STRING_LENGTH)) { 426 430 psFree(md); … … 495 499 bool status; 496 500 497 object = rawImfileRowAlloc("a string", "a string", "a string", "a string", "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", "0001-01-01T00:00:00Z", -16);501 object = rawImfileRowAlloc("a string", "a string", "a string", "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", "0001-01-01T00:00:00Z", -16); 498 502 if (!object) { 499 503 exit(EXIT_FAILURE); … … 508 512 509 513 if (strncmp(psMetadataLookupPtr(&status, md, "exp_tag"), "a string", MAX_STRING_LENGTH)) { 510 psFree(md);511 exit(EXIT_FAILURE);512 }513 if (strncmp(psMetadataLookupPtr(&status, md, "class"), "a string", MAX_STRING_LENGTH)) {514 514 psFree(md); 515 515 exit(EXIT_FAILURE); -
trunk/ippdb/tests/objectfrommetadata.c
r12236 r12260 566 566 exit(EXIT_FAILURE); 567 567 } 568 if (!psMetadataAddStr(md, PS_LIST_TAIL, "filelevel", 0, NULL, "a string")) { 569 psFree(md); 570 exit(EXIT_FAILURE); 571 } 568 572 if (!psMetadataAddStr(md, PS_LIST_TAIL, "workdir", 0, NULL, "a string")) { 569 573 psFree(md); … … 665 669 exit(EXIT_FAILURE); 666 670 } 671 if (strncmp(object->filelevel, "a string", MAX_STRING_LENGTH)) { 672 psFree(object); 673 exit(EXIT_FAILURE); 674 } 667 675 if (strncmp(object->workdir, "a string", MAX_STRING_LENGTH)) { 668 676 psFree(object); … … 741 749 exit(EXIT_FAILURE); 742 750 } 743 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, "a string")) {744 psFree(md);745 exit(EXIT_FAILURE);746 }747 751 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class_id", 0, NULL, "a string")) { 748 752 psFree(md); … … 825 829 826 830 if (strncmp(object->exp_tag, "a string", MAX_STRING_LENGTH)) { 827 psFree(object);828 exit(EXIT_FAILURE);829 }830 if (strncmp(object->class, "a string", MAX_STRING_LENGTH)) {831 831 psFree(object); 832 832 exit(EXIT_FAILURE);
Note:
See TracChangeset
for help on using the changeset viewer.
