Changeset 11140 for trunk/ippdb/src/ippdb.c
- Timestamp:
- Jan 18, 2007, 2:23:24 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippdb/src/ippdb.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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)
Note:
See TracChangeset
for help on using the changeset viewer.
