Changeset 29416 for trunk/ippTools/src/difftool.c
- Timestamp:
- Oct 14, 2010, 2:23:39 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/difftool.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/difftool.c
r29365 r29416 48 48 static bool pendingcleanuprunMode(pxConfig *config); 49 49 static bool pendingcleanupskyfileMode(pxConfig *config); 50 static bool revertcleanupMode(pxConfig *config); 50 51 static bool donecleanupMode(pxConfig *config); 51 52 static bool updatediffskyfileMode(pxConfig *config); … … 100 101 MODECASE(DIFFTOOL_MODE_PENDINGCLEANUPRUN, pendingcleanuprunMode); 101 102 MODECASE(DIFFTOOL_MODE_PENDINGCLEANUPSKYFILE, pendingcleanupskyfileMode); 103 MODECASE(DIFFTOOL_MODE_REVERTCLEANUP, revertcleanupMode); 102 104 MODECASE(DIFFTOOL_MODE_DONECLEANUP, donecleanupMode); 103 105 MODECASE(DIFFTOOL_MODE_UPDATEDIFFSKYFILE, updatediffskyfileMode); … … 2531 2533 2532 2534 2535 static bool revertcleanupMode(pxConfig *config) 2536 { 2537 PS_ASSERT_PTR_NON_NULL(config, false); 2538 2539 psMetadata *where = psMetadataAlloc(); 2540 PXOPT_COPY_S64(config->args, where, "-diff_id", "diffSkyfile.diff_id", "=="); 2541 pxAddLabelSearchArgs (config, where, "-label", "diffRun.label", "LIKE"); 2542 pxAddLabelSearchArgs (config, where, "-data_group", "diffRun.data_group", "LIKE"); 2543 2544 PXOPT_LOOKUP_STR(state, config->args, "-state", false, false); 2545 2546 if (!psListLength(where->list)) { 2547 psFree(where); 2548 psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required"); 2549 return false; 2550 } 2551 if (!state) { 2552 state = "error_cleaned"; 2553 } 2554 char *newState = NULL; 2555 if (!strcmp(state, "error_cleaned")) { 2556 newState = "goto_cleaned"; 2557 } else if (!strcmp(state, "error_purged")) { 2558 newState = "goto_purged"; 2559 } else if (!strcmp(state, "error_scrubbed")) { 2560 newState = "goto_scrubbed"; 2561 } else { 2562 psError(PXTOOLS_ERR_CONFIG, true, "-state must be either error_cleaned, error_purged, or error_scrubbed"); 2563 return false; 2564 } 2565 2566 psString query = pxDataGet("difftool_revertcleanup.sql"); 2567 if (!query) { 2568 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 2569 return false; 2570 } 2571 2572 if (psListLength(where->list)) { 2573 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 2574 psStringAppend(&query, " AND %s", whereClause); 2575 psFree(whereClause); 2576 } 2577 psFree(where); 2578 2579 if (!p_psDBRunQueryF(config->dbh, query, newState, state, state)) { 2580 psError(PS_ERR_UNKNOWN, false, "database error"); 2581 psFree(query); 2582 return false; 2583 } 2584 psFree(query); 2585 2586 int numDeleted = psDBAffectedRows(config->dbh); 2587 2588 psLogMsg("difftool", PS_LOG_INFO, "Reverted %d diffRuns and diffSkyfiles", numDeleted); 2589 2590 return true; 2591 } 2533 2592 static bool donecleanupMode(pxConfig *config) 2534 2593 {
Note:
See TracChangeset
for help on using the changeset viewer.
