Changeset 14023 for trunk/ippTools/src/pxinject.c
- Timestamp:
- Jul 5, 2007, 3:16:08 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/pxinject.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/pxinject.c
r14018 r14023 80 80 81 81 bool status = false; 82 psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");83 if (!status) { 84 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for - exp_id");85 return false; 86 } 87 if (! exp_id) {88 psError(PS_ERR_UNKNOWN, true, "- exp_idis required");89 return false; 90 } 91 psString camera = psMetadataLookupStr(&status, config->args, "-inst");92 if (!status) { 93 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for - inst");94 return false; 95 } 96 if (! camera) {97 psError(PS_ERR_UNKNOWN, true, "- inst is required");98 return false; 99 } 100 psString t elescope = psMetadataLookupStr(&status, config->args, "-telescope");101 if (!status) { 102 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -t elescope");103 return false; 104 } 105 if (!t elescope) {106 psError(PS_ERR_UNKNOWN, true, "-t elescope is required");82 psString tmp_exp_name = psMetadataLookupStr(&status, config->args, "-tmp_exp_name"); 83 if (!status) { 84 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -tmp_exp_name"); 85 return false; 86 } 87 if (!tmp_exp_name) { 88 psError(PS_ERR_UNKNOWN, true, "-tmp_exp_name is required"); 89 return false; 90 } 91 psString tmp_camera = psMetadataLookupStr(&status, config->args, "-tmp_inst"); 92 if (!status) { 93 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -tmp_inst"); 94 return false; 95 } 96 if (!tmp_camera) { 97 psError(PS_ERR_UNKNOWN, true, "-tmp_inst is required"); 98 return false; 99 } 100 psString tmp_telescope = psMetadataLookupStr(&status, config->args, "-tmp_telescope"); 101 if (!status) { 102 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -tmp_telescope"); 103 return false; 104 } 105 if (!tmp_telescope) { 106 psError(PS_ERR_UNKNOWN, true, "-tmp_telescope is required"); 107 107 return false; 108 108 } … … 127 127 } 128 128 129 psString exp_tag = pxGenExpTag(config, exp_id);130 if (!exp_tag) {131 psError(PS_ERR_UNKNOWN, false, "database error");132 return false;133 }134 135 129 if (!newExpInsert(config->dbh, 136 exp_tag,137 exp_id,130 0x0, // exp_id 131 tmp_exp_name, 138 132 "reg", // state 139 camera,140 t elescope,133 tmp_camera, 134 tmp_telescope, 141 135 imfiles, 142 136 workdir, … … 145 139 ) { 146 140 psError(PS_ERR_UNKNOWN, false, "database error"); 147 psFree(exp_tag); 148 return false; 149 } 141 return false; 142 } 143 144 psS64 lastInsertID = psDBLastInsertID(config->dbh); 145 psString exp_id = psDBIntToString(lastInsertID); 150 146 151 147 psMetadata *md = psMetadataAlloc(); 152 if (!psMetadataAddStr(md, PS_LIST_TAIL, "exp_ tag", 0, NULL, exp_tag)) {153 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_ tag");148 if (!psMetadataAddStr(md, PS_LIST_TAIL, "exp_id", 0, NULL, exp_id)) { 149 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id"); 154 150 psFree(md); 155 psFree(exp_tag); 156 psFree(md); 157 } 158 psFree(exp_tag); 151 psFree(exp_id); 152 } 153 psFree(exp_id); 159 154 160 155 bool simple = false; … … 186 181 187 182 bool status = false; 188 psString exp_ tag = psMetadataLookupStr(&status, config->args, "-exp_tag");189 if (!status) { 190 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_ tag");191 return false; 192 } 193 if (!exp_ tag) {194 psError(PS_ERR_UNKNOWN, true, "-exp_ tagis required");183 psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id"); 184 if (!status) { 185 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id"); 186 return false; 187 } 188 if (!exp_id) { 189 psError(PS_ERR_UNKNOWN, true, "-exp_id is required"); 195 190 return false; 196 191 } … … 206 201 } 207 202 #endif 208 psString class_id = psMetadataLookupStr(&status, config->args, "-class_id");209 if (!status) { 210 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for - class_id");211 return false; 212 } 213 if (! class_id) {214 psError(PS_ERR_UNKNOWN, true, "- class_id is required");203 psString tmp_class_id = psMetadataLookupStr(&status, config->args, "-tmp_class_id"); 204 if (!status) { 205 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -tmp_class_id"); 206 return false; 207 } 208 if (!tmp_class_id) { 209 psError(PS_ERR_UNKNOWN, true, "-tmp_class_id is required"); 215 210 return false; 216 211 } … … 226 221 227 222 // insert with error flag state set to 0 (no errors) 228 if (!newImfileInsert(config->dbh, exp_tag,class_id, uri)) {223 if (!newImfileInsert(config->dbh, (psS64)atoll(exp_id), tmp_class_id, uri)) { 229 224 psError(PS_ERR_UNKNOWN, false, "database error"); 230 225 return false; … … 240 235 241 236 bool status = false; 242 psString exp_ tag = psMetadataLookupStr(&status, config->args, "-exp_tag");243 if (!status) { 244 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_ tag");245 return false; 246 } 247 if (!exp_ tag) {248 psError(PS_ERR_UNKNOWN, true, "-exp_ tagis required");237 psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id"); 238 if (!status) { 239 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id"); 240 return false; 241 } 242 if (!exp_id) { 243 psError(PS_ERR_UNKNOWN, true, "-exp_id is required"); 249 244 return false; 250 245 } … … 262 257 if (state) { 263 258 // set detRun.state to state 264 return pxnewExpSetState(config, exp_ tag, state);259 return pxnewExpSetState(config, exp_id, state); 265 260 } 266 261
Note:
See TracChangeset
for help on using the changeset viewer.
