Changeset 11033 for trunk/ippTools/src/chiptool.c
- Timestamp:
- Jan 11, 2007, 12:11:08 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/chiptool.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/chiptool.c
r11024 r11033 33 33 static bool pendingimfileMode(pxConfig *config); 34 34 static bool addprocessedimfileMode(pxConfig *config); 35 static bool faultimfileMode(pxConfig *config); 35 static bool processedimfileMode(pxConfig *config); 36 static bool updateprocessedimfileMode(pxConfig *config); 36 37 static bool blockMode(pxConfig *config); 37 38 static bool maskedMode(pxConfig *config); 38 39 static bool unblockMode(pxConfig *config); 40 39 41 static p2ProcessedImfileRow *p2PendingToProcessedImfile(pxConfig *config, p2PendingImfileRow *imfile); 40 42 static p2ProcessedExpRow *p2PendingToProcessedExp(pxConfig *config, p2PendingExpRow *pendingExp); … … 59 61 MODECASE(P2TOOL_MODE_PENDINGIMFILE, pendingimfileMode); 60 62 MODECASE(P2TOOL_MODE_ADDPROCESSEDIMFILE, addprocessedimfileMode); 61 MODECASE(P2TOOL_MODE_FAULTIMFILE, faultimfileMode); 63 MODECASE(P2TOOL_MODE_PROCESSEDIMFILE, processedimfileMode); 64 MODECASE(P2TOOL_MODE_UPDATEPROCESSEDIMFILE, updateprocessedimfileMode); 62 65 MODECASE(P2TOOL_MODE_BLOCK, blockMode); 63 66 MODECASE(P2TOOL_MODE_MASKED, maskedMode); … … 183 186 } 184 187 185 bool faulted = psMetadataLookupU64(&status, config->args, "-faulted");186 if (!status) {187 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -faulted");188 return false;189 }190 191 188 // XXX does this need to be constrained so that it won't return any results 192 189 // if a match p2PendingExp hasn't been registered? … … 212 209 } 213 210 214 if (faulted) {215 // list only faulted rows216 psStringAppend(&query, " %s", "AND p2PendingImfile.fault != 0");217 } else {218 // don't list faulted rows219 psStringAppend(&query, " %s", "AND p2PendingImfile.fault = 0");220 }221 222 211 // treat limit == 0 as "no limit" 223 212 if (limit) { … … 433 422 434 423 435 static bool faultimfileMode(pxConfig *config) 424 static bool processedimfileMode(pxConfig *config) 425 { 426 PS_ASSERT_PTR_NON_NULL(config, NULL); 427 428 bool status = false; 429 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 430 if (!status) { 431 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -limit"); 432 return false; 433 } 434 435 bool faulted = psMetadataLookupU64(&status, config->args, "-faulted"); 436 if (!status) { 437 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -faulted"); 438 return false; 439 } 440 441 // XXX does this need to be constrained so that it won't return any results 442 // if a match p2PendingExp hasn't been registered? 443 psString query = psStringCopy( 444 "SELECT" 445 " p2ProcessedImfile.*," 446 " rawScienceExp.camera" 447 " FROM p2ProcessedImfile" 448 " JOIN rawScienceExp" 449 " USING(exp_tag)" 450 " WHERE " 451 " p2ProcessedImfile.exp_tag is NOT NULL" // bogus test -- just here so there there is a 'WHERE' stmt to append conditionals too 452 ); 453 454 if (config->where) { 455 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p2ProcessedImfile"); 456 psStringAppend(&query, " AND %s", whereClause); 457 psFree(whereClause); 458 } 459 460 if (faulted) { 461 // list only faulted rows 462 psStringAppend(&query, " %s", "AND p2ProcessedImfile.fault != 0"); 463 } else { 464 // don't list faulted rows 465 psStringAppend(&query, " %s", "AND p2ProcessedImfile.fault = 0"); 466 } 467 468 // treat limit == 0 as "no limit" 469 if (limit) { 470 psString limitString = psDBGenerateLimitSQL(limit); 471 psStringAppend(&query, " %s", limitString); 472 psFree(limitString); 473 } 474 475 if (!p_psDBRunQuery(config->dbh, query)) { 476 psError(PS_ERR_UNKNOWN, false, "database error"); 477 psFree(query); 478 return false; 479 } 480 psFree(query); 481 482 psArray *output = p_psDBFetchResult(config->dbh); 483 if (!output) { 484 psError(PS_ERR_UNKNOWN, false, "database error"); 485 return false; 486 } 487 if (!psArrayLength(output)) { 488 // XXX check psError here 489 psError(PS_ERR_UNKNOWN, false, "no p2ProcessedImfile rows found"); 490 psFree(output); 491 return true; 492 } 493 494 bool simple = false; 495 { 496 bool status = false; 497 simple = psMetadataLookupBool(&status, config->args, "-simple"); 498 if (!status) { 499 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple"); 500 return false; 501 } 502 } 503 504 // negative simple so the default is true 505 if (!ippdbPrintMetadatas(stdout, output, "p2ProcessedImfile", !simple)) { 506 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 507 psFree(output); 508 return false; 509 } 510 511 psFree(output); 512 513 return true; 514 } 515 516 517 static bool updateprocessedimfileMode(pxConfig *config) 436 518 { 437 519 PS_ASSERT_PTR_NON_NULL(config, false); … … 444 526 } 445 527 446 if (!pxSetFaultCode(config->dbh, "p2P endingImfile", config->where, code)) {528 if (!pxSetFaultCode(config->dbh, "p2ProcessedImfile", config->where, code)) { 447 529 psError(PS_ERR_UNKNOWN, false, "failed to set set fault flag"); 448 530 return false; … … 733 815 } 734 816 817 // default values 818 psS8 code = psMetadataLookupS8(&status, config->args, "-code"); 819 if (!status) { 820 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -code"); 821 return false; 822 } 823 735 824 return p2ProcessedImfileRowAlloc( 736 825 imfile->exp_tag, … … 744 833 b2_uri, 745 834 imfile->p1_version, 746 imfile->p2_version 835 imfile->p2_version, 836 code 747 837 ); 748 838 }
Note:
See TracChangeset
for help on using the changeset viewer.
