Changeset 8289 for trunk/ippTools/src/dettool.c
- Timestamp:
- Aug 11, 2006, 3:03:14 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/dettool.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/dettool.c
r8288 r8289 213 213 } 214 214 215 if ( where->list->n< 1) {215 if (psListLength(where->list) < 1) { 216 216 psFree(where); 217 217 where = NULL; … … 226 226 } 227 227 228 // we should have one rawDetrendExp row beexp_id specified228 // we should have one rawDetrendExp row per exp_id specified 229 229 if (psListLength(item->data.list) != psArrayLength(detrendExps)) { 230 230 psAbort(config->argv[0], … … 260 260 psFree(detrendExps); 261 261 262 for (long i = 0; i < psArrayLength(inputExps); i++) { 263 if (!detInputExpInsertObject(config->dbh, inputExps->data[i])) { 262 // insert detInputExp objects into the database 263 if (!detInputExpInsertObjects(config->dbh, inputExps)) { 264 psError(PS_ERR_UNKNOWN, false, "database error"); 265 // rollback 266 if (!psDBRollback(config->dbh)) { 264 267 psError(PS_ERR_UNKNOWN, false, "database error"); 265 // rollback 266 if (!psDBRollback(config->dbh)) { 267 psError(PS_ERR_UNKNOWN, false, "database error"); 268 } 269 psFree(inputExps); 270 return false; 271 } 268 } 269 psFree(inputExps); 270 return false; 272 271 } 273 272 psFree(inputExps); … … 279 278 } 280 279 280 bool simple = false; 281 { 282 bool status = false; 283 simple = psMetadataLookupBool(&status, config->args, "-simple"); 284 if (!status) { 285 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple"); 286 return false; 287 } 288 } 289 281 290 // print the new det_id 282 printf("%ld\n", det_id); 291 psArray *detRuns = NULL; 292 { 293 psMetadata *where = psMetadataAlloc(); 294 // map det_id -> position 295 psMetadataAddS32(where, PS_LIST_TAIL, "position", 0, "==", det_id); 296 detRuns = psDBSelectRows(config->dbh, "detRun", where, 0); 297 psFree(where); 298 } 299 if (!detRuns) { 300 psError(PS_ERR_UNKNOWN, false, "can't find the detRun we just created"); 301 return false; 302 } 303 // sanity check results 304 if (psArrayLength(detRuns) != 1) { 305 psAbort(config->argv[0], "found more then one detRun matching det_id %ld(this should not happen)", det_id); 306 return false; 307 } 308 309 // map position -> det_id 310 // but leave position in the metadata as ippdbPrintMetadatas() will strip it 311 // for us 312 for (long i = 0; i < psArrayLength(detRuns); i++) { 313 bool status = false; 314 psS32 position = psMetadataLookupS32(&status, detRuns->data[i], "position"); 315 if (!status) { 316 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for position"); 317 psFree(detRuns); 318 return false; 319 } 320 psMetadataAddS32(detRuns->data[i], PS_LIST_HEAD, "det_id", 0, NULL, position); 321 } 322 323 // negative simple so the default is true 324 if (!ippdbPrintMetadatas(stdout, detRuns, "detRun", !simple)) { 325 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 326 psFree(detRuns); 327 return false; 328 } 329 psFree(detRuns); 283 330 284 331 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
