Changeset 17570 for trunk/ippdb
- Timestamp:
- May 7, 2008, 3:47:34 PM (18 years ago)
- Location:
- trunk/ippdb
- Files:
-
- 8 edited
-
configure.ac (modified) (1 diff)
-
src/ippdb.c (modified) (8 diffs)
-
src/ippdb.h (modified) (3 diffs)
-
tests/alloc.c (modified) (2 diffs)
-
tests/insert.c (modified) (1 diff)
-
tests/insertobject.c (modified) (1 diff)
-
tests/metadatafromobject.c (modified) (2 diffs)
-
tests/objectfrommetadata.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippdb/configure.ac
r17142 r17570 7 7 AC_PREREQ(2.61) 8 8 9 AC_INIT([ippdb], [1.1.3 2], [pan-starrs.ifa.hawaii.edu])9 AC_INIT([ippdb], [1.1.33], [pan-starrs.ifa.hawaii.edu]) 10 10 AC_CONFIG_SRCDIR([ippdb.pc.in]) 11 11 -
trunk/ippdb/src/ippdb.c
r17144 r17570 586 586 static void summitExpRowFree(summitExpRow *object); 587 587 588 summitExpRow *summitExpRowAlloc(const char *exp_name, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, const char *uri, psS32 imfiles )588 summitExpRow *summitExpRowAlloc(const char *exp_name, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, const char *uri, psS32 imfiles, psS16 fault) 589 589 { 590 590 summitExpRow *_object; … … 600 600 _object->uri = psStringCopy(uri); 601 601 _object->imfiles = imfiles; 602 _object->fault = fault; 602 603 603 604 return _object; … … 652 653 return false; 653 654 } 655 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, "Key NOT NULL", 0)) { 656 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 657 psFree(md); 658 return false; 659 } 654 660 655 661 bool status = psDBCreateTable(dbh, SUMMITEXP_TABLE_NAME, md); … … 665 671 } 666 672 667 bool summitExpInsert(psDB * dbh, const char *exp_name, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, const char *uri, psS32 imfiles )673 bool summitExpInsert(psDB * dbh, const char *exp_name, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, const char *uri, psS32 imfiles, psS16 fault) 668 674 { 669 675 psMetadata *md = psMetadataAlloc(); … … 700 706 if (!psMetadataAdd(md, PS_LIST_TAIL, "imfiles", PS_DATA_S32, NULL, imfiles)) { 701 707 psError(PS_ERR_UNKNOWN, false, "failed to add item imfiles"); 708 psFree(md); 709 return false; 710 } 711 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, fault)) { 712 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 702 713 psFree(md); 703 714 return false; … … 726 737 bool summitExpInsertObject(psDB *dbh, summitExpRow *object) 727 738 { 728 return summitExpInsert(dbh, object->exp_name, object->camera, object->telescope, object->dateobs, object->exp_type, object->uri, object->imfiles );739 return summitExpInsert(dbh, object->exp_name, object->camera, object->telescope, object->dateobs, object->exp_type, object->uri, object->imfiles, object->fault); 729 740 } 730 741 … … 834 845 return false; 835 846 } 847 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, object->fault)) { 848 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 849 psFree(md); 850 return false; 851 } 836 852 837 853 … … 878 894 return false; 879 895 } 880 881 return summitExpRowAlloc(exp_name, camera, telescope, dateobs, exp_type, uri, imfiles); 896 psS16 fault = psMetadataLookupS16(&status, md, "fault"); 897 if (!status) { 898 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fault"); 899 return false; 900 } 901 902 return summitExpRowAlloc(exp_name, camera, telescope, dateobs, exp_type, uri, imfiles, fault); 882 903 } 883 904 psArray *summitExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) -
trunk/ippdb/src/ippdb.h
r17144 r17570 339 339 char *uri; 340 340 psS32 imfiles; 341 psS16 fault; 341 342 } summitExpRow; 342 343 … … 353 354 const char *exp_type, 354 355 const char *uri, 355 psS32 imfiles 356 psS32 imfiles, 357 psS16 fault 356 358 ); 357 359 … … 389 391 const char *exp_type, 390 392 const char *uri, 391 psS32 imfiles 393 psS32 imfiles, 394 psS16 fault 392 395 ); 393 396 -
trunk/ippdb/tests/alloc.c
r17144 r17570 36 36 summitExpRow *object; 37 37 38 object = summitExpRowAlloc("a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string", -32 );38 object = summitExpRowAlloc("a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string", -32, -16 ); 39 39 40 40 if (!object) { … … 66 66 } 67 67 if (!object->imfiles == -32) { 68 psFree(object); 69 exit(EXIT_FAILURE); 70 } 71 if (!object->fault == -16) { 68 72 psFree(object); 69 73 exit(EXIT_FAILURE); -
trunk/ippdb/tests/insert.c
r17144 r17570 28 28 } 29 29 30 if (!summitExpInsert(dbh, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string", -32 )) {30 if (!summitExpInsert(dbh, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string", -32, -16)) { 31 31 exit(EXIT_FAILURE); 32 32 } -
trunk/ippdb/tests/insertobject.c
r17144 r17570 36 36 } 37 37 38 object = summitExpRowAlloc("a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string", -32 );38 object = summitExpRowAlloc("a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string", -32, -16); 39 39 if (!object) { 40 40 exit(EXIT_FAILURE); -
trunk/ippdb/tests/metadatafromobject.c
r17144 r17570 46 46 bool status; 47 47 48 object = summitExpRowAlloc("a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string", -32 );48 object = summitExpRowAlloc("a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string", -32, -16); 49 49 if (!object) { 50 50 exit(EXIT_FAILURE); … … 82 82 } 83 83 if (!psMetadataLookupS32(&status, md, "imfiles") == -32) { 84 psFree(md); 85 exit(EXIT_FAILURE); 86 } 84 87 psFree(md); 85 88 exit(EXIT_FAILURE); -
trunk/ippdb/tests/objectfrommetadata.c
r17144 r17570 82 82 exit(EXIT_FAILURE); 83 83 } 84 psFree(md); 85 exit(EXIT_FAILURE); 86 } 84 87 85 88 object = summitExpObjectFromMetadata(md); … … 115 118 } 116 119 if (!object->imfiles == -32) { 120 psFree(object); 121 exit(EXIT_FAILURE); 122 } 117 123 psFree(object); 118 124 exit(EXIT_FAILURE);
Note:
See TracChangeset
for help on using the changeset viewer.
