Changeset 19702 for trunk/ippTools/src/faketool.c
- Timestamp:
- Sep 23, 2008, 12:43:04 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/faketool.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/faketool.c
r19592 r19702 48 48 static bool pendingcleanupimfileMode(pxConfig *config); 49 49 static bool donecleanupMode(pxConfig *config); 50 static bool tocleanedimfileMode(pxConfig *config); 51 static bool tofullimfileMode(pxConfig *config); 52 static bool topurgedimfileMode(pxConfig *config); 50 53 51 54 static bool fakeProcessedCompleteExp(pxConfig *config); … … 83 86 MODECASE(FAKETOOL_MODE_PENDINGCLEANUPIMFILE, pendingcleanupimfileMode); 84 87 MODECASE(FAKETOOL_MODE_DONECLEANUP, donecleanupMode); 88 MODECASE(FAKETOOL_MODE_TOCLEANEDIMFILE, tocleanedimfileMode); 89 MODECASE(FAKETOOL_MODE_TOFULLIMFILE, tofullimfileMode); 90 MODECASE(FAKETOOL_MODE_TOPURGEDIMFILE, topurgedimfileMode); 91 85 92 default: 86 93 psAbort("invalid option (this should not happen)"); … … 1129 1136 return true; 1130 1137 } 1138 1139 // update fakeProcessedImfile.data_state to given value. 1140 // afterwards, if all imfiles in the exposure have the new state, update the state for the exposure as well 1141 // shared code for the modes -tocleanedimfile -tofullimfile -topurgedimfile 1142 1143 static bool change_imfile_data_state(pxConfig *config, psString data_state, psString run_state) 1144 { 1145 PS_ASSERT_PTR_NON_NULL(config, false); 1146 1147 // fake_id, class_id are required 1148 PXOPT_LOOKUP_S64(fake_id, config->args, "-fake_id", true, false); 1149 PXOPT_LOOKUP_STR(class_id, config->args, "-class_id", true, false); 1150 1151 psString query = pxDataGet("faketool_change_imfile_data_state.sql"); 1152 1153 if (!psDBTransaction(config->dbh)) { 1154 psError(PS_ERR_UNKNOWN, false, "database error"); 1155 return false; 1156 } 1157 1158 // note only updates if fakeRun.state = run_state 1159 if (!p_psDBRunQuery(config->dbh, query, data_state, fake_id, class_id, run_state)) { 1160 psError(PS_ERR_UNKNOWN, false, "database error"); 1161 // rollback 1162 if (!psDBRollback(config->dbh)) { 1163 psError(PS_ERR_UNKNOWN, false, "database error"); 1164 } 1165 psError(PS_ERR_UNKNOWN, false, "database error"); 1166 return false; 1167 } 1168 psFree(query); 1169 1170 if (psDBAffectedRows(config->dbh) < 1) { 1171 psError(PS_ERR_UNKNOWN, false, "should have affected atleast 1 row"); 1172 return false; 1173 } 1174 1175 query = pxDataGet("faketool_change_exp_state.sql"); 1176 if (!p_psDBRunQuery(config->dbh, query, data_state, fake_id, data_state)) { 1177 // rollback 1178 if (!psDBRollback(config->dbh)) { 1179 psError(PS_ERR_UNKNOWN, false, "database error"); 1180 } 1181 psError(PS_ERR_UNKNOWN, false, "database error"); 1182 return false; 1183 } 1184 1185 if (!psDBCommit(config->dbh)) { 1186 psError(PS_ERR_UNKNOWN, false, "database error"); 1187 return false; 1188 } 1189 1190 return true; 1191 } 1192 static bool tocleanedimfileMode(pxConfig *config) 1193 { 1194 return change_imfile_data_state(config, "cleaned", "goto_cleaned"); 1195 } 1196 static bool tofullimfileMode(pxConfig *config) 1197 { 1198 return change_imfile_data_state(config, "full", "update"); 1199 } 1200 static bool topurgedimfileMode(pxConfig *config) 1201 { 1202 return change_imfile_data_state(config, "purged", "goto_purged"); 1203 }
Note:
See TracChangeset
for help on using the changeset viewer.
