Changeset 29416 for trunk/ippTools/src/chiptool.c
- Timestamp:
- Oct 14, 2010, 2:23:39 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/chiptool.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/chiptool.c
r28716 r29416 50 50 static bool pendingcleanuprunMode(pxConfig *config); 51 51 static bool pendingcleanupimfileMode(pxConfig *config); 52 static bool revertcleanupMode(pxConfig *config); 52 53 static bool donecleanupMode(pxConfig *config); 53 54 static bool runMode(pxConfig *config); … … 94 95 MODECASE(CHIPTOOL_MODE_PENDINGCLEANUPRUN, pendingcleanuprunMode); 95 96 MODECASE(CHIPTOOL_MODE_PENDINGCLEANUPIMFILE, pendingcleanupimfileMode); 97 MODECASE(CHIPTOOL_MODE_REVERTCLEANUP, revertcleanupMode); 96 98 MODECASE(CHIPTOOL_MODE_DONECLEANUP, donecleanupMode); 97 99 MODECASE(CHIPTOOL_MODE_RUN, runMode); … … 859 861 } 860 862 psString query_update = pxDataGet("chiptool_revertupdatedimfile.sql"); 861 if (!query ) {863 if (!query_update) { 862 864 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 863 865 psFree(where); 864 866 return false; 865 867 } 868 866 869 867 870 if (where && psListLength(where->list)) { … … 886 889 } 887 890 psFree(query_update); 891 892 return true; 893 } 894 static bool revertcleanupMode(pxConfig *config) 895 { 896 PS_ASSERT_PTR_NON_NULL(config, false); 897 898 psMetadata *where = psMetadataAlloc(); 899 PXOPT_COPY_S64(config->args, where, "-chip_id", "chipRun.chip_id", "=="); 900 pxAddLabelSearchArgs (config, where, "-label", "chipRun.label", "LIKE"); 901 pxAddLabelSearchArgs (config, where, "-data_group", "chipRun.data_group", "LIKE"); 902 PXOPT_LOOKUP_STR(state, config->args, "-state", false, false); 903 904 char* newState = NULL; 905 if (!state) { 906 state = "error_cleaned"; 907 } 908 if (!strcmp(state, "error_cleaned")) { 909 newState = "goto_cleaned"; 910 } else if (!strcmp(state, "error_purged")) { 911 newState = "goto_purged"; 912 } else if (!strcmp(state, "error_scrubbed")) { 913 newState = "goto_scrubbed"; 914 } else { 915 psError(PXTOOLS_ERR_CONFIG, true, "-state must be either error_cleaned, error_purged, or error_scrubbed"); 916 return false; 917 } 918 919 if (!psListLength(where->list)) { 920 psFree(where); 921 psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required"); 922 return false; 923 } 924 925 psString query = pxDataGet("chiptool_revertcleanup.sql"); 926 if (!query) { 927 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 928 psFree(where); 929 return false; 930 } 931 932 if (where && psListLength(where->list)) { 933 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 934 psStringAppend(&query, " AND %s", whereClause); 935 psFree(whereClause); 936 } 937 938 psFree(where); 939 940 if (!p_psDBRunQueryF(config->dbh, query, newState, state, state)) { 941 psError(PS_ERR_UNKNOWN, false, "database error"); 942 psFree(query); 943 return false; 944 } 945 psFree(query); 888 946 889 947 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
