Changeset 11140
- Timestamp:
- Jan 18, 2007, 2:23:24 PM (19 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
-
dbconfig/config.md (modified) (1 diff)
-
ippdb/configure.ac (modified) (1 diff)
-
ippdb/src/ippdb.c (modified) (10 diffs)
-
ippdb/src/ippdb.h (modified) (3 diffs)
-
ippdb/tests/alloc.c (modified) (2 diffs)
-
ippdb/tests/insert.c (modified) (1 diff)
-
ippdb/tests/insertobject.c (modified) (1 diff)
-
ippdb/tests/metadatafromobject.c (modified) (2 diffs)
-
ippdb/tests/objectfrommetadata.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/dbconfig/config.md
r11136 r11140 2 2 pkg_name STR ippdb 3 3 pkg_namespace STR ippdb 4 pkg_version STR 0.0.7 64 pkg_version STR 0.0.77 5 5 END -
trunk/ippdb/configure.ac
r11136 r11140 7 7 AC_PREREQ(2.59) 8 8 9 AC_INIT([ippdb], [0.0.7 6], [pan-starrs.ifa.hawaii.edu])9 AC_INIT([ippdb], [0.0.77], [pan-starrs.ifa.hawaii.edu]) 10 10 AC_CONFIG_SRCDIR([ippdb.pc.in]) 11 11 -
trunk/ippdb/src/ippdb.c
r11136 r11140 2799 2799 static void newExpRowFree(newExpRow *object); 2800 2800 2801 newExpRow *newExpRowAlloc(const char *exp_tag, const char *exp_id, const char *camera, const char *telescope, ps Time* dateobs, const char *exp_type, psS32 imfiles, const char *workdir)2801 newExpRow *newExpRowAlloc(const char *exp_tag, const char *exp_id, const char *camera, const char *telescope, psS32 imfiles, const char *workdir) 2802 2802 { 2803 2803 newExpRow *_object; … … 2810 2810 _object->camera = psStringCopy(camera); 2811 2811 _object->telescope = psStringCopy(telescope); 2812 _object->dateobs = psTimeCopy(dateobs);2813 _object->exp_type = psStringCopy(exp_type);2814 2812 _object->imfiles = imfiles; 2815 2813 _object->workdir = psStringCopy(workdir); … … 2824 2822 psFree(object->camera); 2825 2823 psFree(object->telescope); 2826 psFree(object->dateobs);2827 psFree(object->exp_type);2828 2824 psFree(object->workdir); 2829 2825 } … … 2852 2848 return false; 2853 2849 } 2854 if (!psMetadataAdd(md, PS_LIST_TAIL, "dateobs", PS_DATA_TIME, NULL, NULL)) {2855 psError(PS_ERR_UNKNOWN, false, "failed to add item dateobs");2856 psFree(md);2857 return false;2858 }2859 if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_type", PS_DATA_STRING, NULL, "64")) {2860 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_type");2861 psFree(md);2862 return false;2863 }2864 2850 if (!psMetadataAdd(md, PS_LIST_TAIL, "imfiles", PS_DATA_S32, NULL, 0)) { 2865 2851 psError(PS_ERR_UNKNOWN, false, "failed to add item imfiles"); … … 2885 2871 } 2886 2872 2887 bool newExpInsert(psDB * dbh, const char *exp_tag, const char *exp_id, const char *camera, const char *telescope, ps Time* dateobs, const char *exp_type, psS32 imfiles, const char *workdir)2873 bool newExpInsert(psDB * dbh, const char *exp_tag, const char *exp_id, const char *camera, const char *telescope, psS32 imfiles, const char *workdir) 2888 2874 { 2889 2875 psMetadata *md = psMetadataAlloc(); … … 2905 2891 if (!psMetadataAdd(md, PS_LIST_TAIL, "telescope", PS_DATA_STRING, NULL, telescope)) { 2906 2892 psError(PS_ERR_UNKNOWN, false, "failed to add item telescope"); 2907 psFree(md);2908 return false;2909 }2910 if (!psMetadataAdd(md, PS_LIST_TAIL, "dateobs", PS_DATA_TIME, NULL, dateobs)) {2911 psError(PS_ERR_UNKNOWN, false, "failed to add item dateobs");2912 psFree(md);2913 return false;2914 }2915 if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_type", PS_DATA_STRING, NULL, exp_type)) {2916 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_type");2917 2893 psFree(md); 2918 2894 return false; … … 2951 2927 bool newExpInsertObject(psDB *dbh, newExpRow *object) 2952 2928 { 2953 return newExpInsert(dbh, object->exp_tag, object->exp_id, object->camera, object->telescope, object-> dateobs, object->exp_type, object->imfiles, object->workdir);2929 return newExpInsert(dbh, object->exp_tag, object->exp_id, object->camera, object->telescope, object->imfiles, object->workdir); 2954 2930 } 2955 2931 … … 3044 3020 return false; 3045 3021 } 3046 if (!psMetadataAdd(md, PS_LIST_TAIL, "dateobs", PS_DATA_TIME, NULL, object->dateobs)) {3047 psError(PS_ERR_UNKNOWN, false, "failed to add item dateobs");3048 psFree(md);3049 return false;3050 }3051 if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_type", PS_DATA_STRING, NULL, object->exp_type)) {3052 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_type");3053 psFree(md);3054 return false;3055 }3056 3022 if (!psMetadataAdd(md, PS_LIST_TAIL, "imfiles", PS_DATA_S32, NULL, object->imfiles)) { 3057 3023 psError(PS_ERR_UNKNOWN, false, "failed to add item imfiles"); … … 3093 3059 return false; 3094 3060 } 3095 psTime* dateobs = psMetadataLookupPtr(&status, md, "dateobs");3096 if (!status) {3097 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item dateobs");3098 return false;3099 }3100 char* exp_type = psMetadataLookupPtr(&status, md, "exp_type");3101 if (!status) {3102 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_type");3103 return false;3104 }3105 3061 psS32 imfiles = psMetadataLookupS32(&status, md, "imfiles"); 3106 3062 if (!status) { … … 3114 3070 } 3115 3071 3116 return newExpRowAlloc(exp_tag, exp_id, camera, telescope, dateobs, exp_type,imfiles, workdir);3072 return newExpRowAlloc(exp_tag, exp_id, camera, telescope, imfiles, workdir); 3117 3073 } 3118 3074 psArray *newExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) -
trunk/ippdb/src/ippdb.h
r11136 r11140 1587 1587 char *camera; 1588 1588 char *telescope; 1589 psTime* dateobs;1590 char *exp_type;1591 1589 psS32 imfiles; 1592 1590 char *workdir; … … 1603 1601 const char *camera, 1604 1602 const char *telescope, 1605 psTime* dateobs,1606 const char *exp_type,1607 1603 psS32 imfiles, 1608 1604 const char *workdir … … 1640 1636 const char *camera, 1641 1637 const char *telescope, 1642 psTime* dateobs,1643 const char *exp_type,1644 1638 psS32 imfiles, 1645 1639 const char *workdir -
trunk/ippdb/tests/alloc.c
r11136 r11140 244 244 newExpRow *object; 245 245 246 object = newExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string",-32, "a string" );246 object = newExpRowAlloc("a string", "a string", "a string", "a string", -32, "a string" ); 247 247 248 248 if (!object) { … … 263 263 } 264 264 if (strncmp(object->telescope, "a string", MAX_STRING_LENGTH)) { 265 psFree(object);266 exit(EXIT_FAILURE);267 }268 psFree(object);269 exit(EXIT_FAILURE);270 }271 if (strncmp(object->exp_type, "a string", MAX_STRING_LENGTH)) {272 265 psFree(object); 273 266 exit(EXIT_FAILURE); -
trunk/ippdb/tests/insert.c
r11136 r11140 118 118 } 119 119 120 if (!newExpInsert(dbh, "a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string",-32, "a string")) {120 if (!newExpInsert(dbh, "a string", "a string", "a string", "a string", -32, "a string")) { 121 121 exit(EXIT_FAILURE); 122 122 } -
trunk/ippdb/tests/insertobject.c
r11136 r11140 168 168 } 169 169 170 object = newExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string",-32, "a string");170 object = newExpRowAlloc("a string", "a string", "a string", "a string", -32, "a string"); 171 171 if (!object) { 172 172 exit(EXIT_FAILURE); -
trunk/ippdb/tests/metadatafromobject.c
r11136 r11140 302 302 bool status; 303 303 304 object = newExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string",-32, "a string");304 object = newExpRowAlloc("a string", "a string", "a string", "a string", -32, "a string"); 305 305 if (!object) { 306 306 exit(EXIT_FAILURE); … … 327 327 } 328 328 if (strncmp(psMetadataLookupPtr(&status, md, "telescope"), "a string", MAX_STRING_LENGTH)) { 329 psFree(md);330 exit(EXIT_FAILURE);331 }332 psFree(md);333 exit(EXIT_FAILURE);334 }335 if (strncmp(psMetadataLookupPtr(&status, md, "exp_type"), "a string", MAX_STRING_LENGTH)) {336 329 psFree(md); 337 330 exit(EXIT_FAILURE); -
trunk/ippdb/tests/objectfrommetadata.c
r11136 r11140 439 439 exit(EXIT_FAILURE); 440 440 } 441 psFree(md);442 exit(EXIT_FAILURE);443 }444 if (!psMetadataAddStr(md, PS_LIST_TAIL, "exp_type", 0, NULL, "a string")) {445 psFree(md);446 exit(EXIT_FAILURE);447 }448 441 if (!psMetadataAddS32(md, PS_LIST_TAIL, "imfiles", 0, NULL, -32)) { 449 442 psFree(md); … … 476 469 } 477 470 if (strncmp(object->telescope, "a string", MAX_STRING_LENGTH)) { 478 psFree(object);479 exit(EXIT_FAILURE);480 }481 psFree(object);482 exit(EXIT_FAILURE);483 }484 if (strncmp(object->exp_type, "a string", MAX_STRING_LENGTH)) {485 471 psFree(object); 486 472 exit(EXIT_FAILURE);
Note:
See TracChangeset
for help on using the changeset viewer.
