Changeset 15755 for trunk/ippTools/src/flatcorr.c
- Timestamp:
- Dec 6, 2007, 3:46:12 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/flatcorr.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/flatcorr.c
r15695 r15755 35 35 static bool newrunMode(pxConfig *config); 36 36 static bool pendingMode(pxConfig *config); 37 static bool flatcorrimfileMode(pxConfig *config); 37 38 static bool updateMode(pxConfig *config); 38 39 … … 59 60 MODECASE(FLATCORR_MODE_NEWRUN, newrunMode); 60 61 MODECASE(FLATCORR_MODE_PENDING, pendingMode); 62 MODECASE(FLATCORR_MODE_FLATCORRIMFILE, flatcorrimfileMode); 61 63 MODECASE(FLATCORR_MODE_UPDATE, updateMode); 62 64 default: … … 429 431 } 430 432 433 434 static bool flatcorrimfileMode(pxConfig *config) 435 { 436 PS_ASSERT_PTR_NON_NULL(config, false); 437 438 439 bool status = false; 440 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 441 if (!status) { 442 psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -limit"); 443 return false; 444 } 445 446 // find all rawImfiles matching the default query 447 psString query = pxDataGet("flatcorr_find_processedimfiles.sql"); 448 if (!query) { 449 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 450 return false; 451 } 452 453 if (config->where) { 454 psString whereClause = psDBGenerateWhereConditionSQL(config->where, NULL); 455 psStringAppend(&query, " AND %s", whereClause); 456 psFree(whereClause); 457 } 458 459 // treat limit == 0 as "no limit" 460 if (limit) { 461 psString limitString = psDBGenerateLimitSQL(limit); 462 psStringAppend(&query, " %s", limitString); 463 psFree(limitString); 464 } 465 466 if (!p_psDBRunQuery(config->dbh, query)) { 467 psError(PS_ERR_UNKNOWN, false, "database error"); 468 psFree(query); 469 return false; 470 } 471 psFree(query); 472 473 psArray *output = p_psDBFetchResult(config->dbh); 474 if (!output) { 475 psErrorCode err = psErrorCodeLast(); 476 switch (err) { 477 case PS_ERR_DB_CLIENT: 478 psError(PXTOOLS_ERR_SYS, false, "database error"); 479 case PS_ERR_DB_SERVER: 480 psError(PXTOOLS_ERR_PROG, false, "database error"); 481 default: 482 psError(PXTOOLS_ERR_PROG, false, "unknown error"); 483 } 484 485 return false; 486 } 487 if (!psArrayLength(output)) { 488 psTrace("warptool", PS_LOG_INFO, "no rows found"); 489 psFree(output); 490 return true; 491 } 492 493 bool simple = false; 494 { 495 bool status = false; 496 simple = psMetadataLookupBool(&status, config->args, "-simple"); 497 if (!status) { psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple"); 498 return false; 499 } 500 } 501 502 if (psArrayLength(output)) { 503 if (!convertIdToStr(output)) { 504 psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings"); 505 psFree(output); 506 return false; 507 } 508 509 // negative simple so the default is true 510 if (!ippdbPrintMetadatas(stdout, output, "chipProcessedImfile", !simple)) { 511 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 512 psFree(output); 513 return false; 514 } 515 } 516 517 psFree(output); 518 519 return true; 520 } 521 522 431 523 static bool updateMode(pxConfig *config) 432 524 {
Note:
See TracChangeset
for help on using the changeset viewer.
