Changeset 17188
- Timestamp:
- Mar 28, 2008, 2:46:04 PM (18 years ago)
- Location:
- trunk/ippTools/src
- Files:
-
- 2 edited
-
chiptool.c (modified) (4 diffs)
-
chiptoolConfig.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/chiptool.c
r17186 r17188 355 355 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 356 356 357 // XXX does this need to be constrained so that it won't return any results 358 // if a match chipPendingExp hasn't been registered? 357 psMetadata *where = psMetadataAlloc(); 358 PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", false, false); 359 // convert chip_id into a psS64 360 if (chip_id) { 361 if (!psMetadataAddS64(where, PS_LIST_TAIL, "chipRun.chip_id", 0, "==", (psS64)atoll(chip_id))) { 362 psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id"); 363 psFree(where); 364 return false; 365 } 366 } 367 368 PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false); 369 // convert exp_id into a psS64 370 if (exp_id) { 371 if (!psMetadataAddS64(where, PS_LIST_TAIL, "rawExp.exp_id", 0, "==", (psS64)atoll(exp_id))) { 372 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id"); 373 psFree(where); 374 return false; 375 } 376 } 377 378 PXOPT_COPY_STR(config->args, where, "-class_id", "rawImfile.class_id", "=="); 379 PXOPT_COPY_STR(config->args, where, "-inst", "rawExp.telescope", "=="); 380 PXOPT_COPY_STR(config->args, where, "-filter", "rawExp.filter", "=="); 381 359 382 psString query = pxDataGet("chiptool_pendingimfile.sql"); 360 383 if (!query) { … … 363 386 } 364 387 365 if ( config->where) {366 psString whereClause = psDBGenerateWhereConditionSQL( config->where, "chipInputImfile");388 if (where && psListLength(where->list)) { 389 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 367 390 psStringAppend(&query, " AND %s", whereClause); 368 391 psFree(whereClause); 369 392 } 393 psFree(where); 370 394 371 395 // treat limit == 0 as "no limit" … … 529 553 PXOPT_LOOKUP_BOOL(faulted, config->args, "-faulted", false); 530 554 531 // XXX does this need to be constrained so that it won't return any results 532 // if a match chipPendingExp hasn't been registered? 555 psMetadata *where = psMetadataAlloc(); 556 PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", false, false); 557 // convert chip_id into a psS64 558 if (chip_id) { 559 if (!psMetadataAddS64(where, PS_LIST_TAIL, "chipRun.chip_id", 0, "==", (psS64)atoll(chip_id))) { 560 psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id"); 561 psFree(where); 562 return false; 563 } 564 } 565 566 PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false); 567 // convert exp_id into a psS64 568 if (exp_id) { 569 if (!psMetadataAddS64(where, PS_LIST_TAIL, "rawExp.exp_id", 0, "==", (psS64)atoll(exp_id))) { 570 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id"); 571 psFree(where); 572 return false; 573 } 574 } 575 576 PXOPT_COPY_STR(config->args, where, "-class_id", "rawImfile.class_id", "=="); 577 PXOPT_COPY_STR(config->args, where, "-inst", "rawExp.telescope", "=="); 578 PXOPT_COPY_STR(config->args, where, "-filter", "rawExp.filter", "=="); 579 533 580 psString query = pxDataGet("chiptool_processedimfile.sql"); 534 581 if (!query) { … … 537 584 } 538 585 539 if ( config->where) {540 psString whereClause = psDBGenerateWhereConditionSQL( config->where, "chipProcessedImfile");586 if (where && psListLength(where->list)) { 587 psString whereClause = psDBGenerateWhereConditionSQL(where, "chipProcessedImfile"); 541 588 psStringAppend(&query, " AND %s", whereClause); 542 589 psFree(whereClause); 543 590 } 591 psFree(where); 544 592 545 593 if (faulted) { -
trunk/ippTools/src/chiptoolConfig.c
r17186 r17188 244 244 psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-filter", 0, 245 245 "search by filter of interest", NULL); 246 psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-uri", 0,247 "search by URL", NULL);248 246 psMetadataAddU64(pendingimfileArgs, PS_LIST_TAIL, "-limit", 0, 249 247 "limit result set to N items", 0); … … 327 325 psMetadataAddStr(processedimfileArgs, PS_LIST_TAIL, "-filter", 0, 328 326 "define filter of interest", NULL); 329 psMetadataAddStr(processedimfileArgs, PS_LIST_TAIL, "-uri", 0,330 "define URL", NULL);331 327 psMetadataAddU64(processedimfileArgs, PS_LIST_TAIL, "-limit", 0, 332 328 "limit result set to N items", 0); … … 492 488 psFree(modes); 493 489 494 // setup search criterion495 #define addWhereStr(name) \496 { \497 psString str = NULL; \498 bool status = false; \499 if ((str = psMetadataLookupStr(&status, config->args, "-" #name))) { \500 if (!psMetadataAddStr(config->where, PS_LIST_TAIL, #name, 0, "==", str)) {\501 psError(PS_ERR_UNKNOWN, false, "failed to add item " #name); \502 psFree(config); \503 return NULL; \504 } \505 } \506 }507 508 // generate SQL where clause509 config->where = psMetadataAlloc();510 511 {512 psString str = NULL;513 bool status = false;514 if ((str = psMetadataLookupStr(&status, config->args, "-chip_id"))) {515 if (!psMetadataAddS64(config->where, PS_LIST_TAIL, "chip_id", 0, "==", (psS64)atoll(str))) {516 psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id");517 psFree(config);518 return NULL;519 }520 }521 }522 523 addWhereStr(exp_id);524 // convert '-inst' to 'camera'525 {526 psString str = NULL;527 bool status = false;528 if ((str = psMetadataLookupStr(&status, config->args, "-inst"))) {529 if (!psMetadataAddStr(config->where, PS_LIST_TAIL, "camera", 0, "==", str)) {530 psError(PS_ERR_UNKNOWN, false, "failed to add item camera");531 psFree(config);532 return NULL;533 }534 }535 }536 537 538 addWhereStr(filter);539 addWhereStr(class_id);540 541 // convert '-code' to 'fault'542 {543 psS16 fault = 0;544 bool status = false;545 if ((fault = psMetadataLookupS16(&status, config->args, "-code"))) {546 if (!psMetadataAddS16(config->where, PS_LIST_TAIL, "fault", 0, "==", fault)) {547 psError(PS_ERR_UNKNOWN, false, "failed to add item fault");548 psFree(config);549 return NULL;550 }551 }552 }553 554 /*555 // psMetadataConfig does not support times yet556 if (!psTimeIsZero(config->start) && !psTimeIsZero(config->stop)) {557 psMetadataAddTime (where, PS_LIST_TAIL, "TIME_START", 0, "<", config->stop);558 psMetadataAddTime (where, PS_LIST_TAIL, "TIME_STOP", 0, ">", config->start);559 }560 */561 562 if (config->where->list->n < 1) {563 psFree(config->where);564 config->where = NULL;565 }566 567 490 // define Database handle, if used 568 491 config->dbh = pmConfigDB(config->modules);
Note:
See TracChangeset
for help on using the changeset viewer.
