Changeset 19334 for trunk/ippTools/src/chiptool.c
- Timestamp:
- Sep 2, 2008, 2:05:26 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/chiptool.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/chiptool.c
r19324 r19334 50 50 static bool donecleanupMode(pxConfig *config); 51 51 static bool runMode(pxConfig *config); 52 static bool tocleanedimfileMode(pxConfig *config); 53 static bool tofullimfileMode(pxConfig *config); 54 static bool topurgedimfileMode(pxConfig *config); 52 55 53 56 static bool chipProcessedCompleteExp(pxConfig *config); … … 76 79 MODECASE(CHIPTOOL_MODE_PROCESSEDIMFILE, processedimfileMode); 77 80 MODECASE(CHIPTOOL_MODE_REVERTPROCESSEDIMFILE, revertprocessedimfileMode); 78 MODECASE(CHIPTOOL_MODE_UPDATEPROCESSEDIMFILE, updateprocessedimfileMode);81 MODECASE(CHIPTOOL_MODE_UPDATEPROCESSEDIMFILE, updateprocessedimfileMode); 79 82 MODECASE(CHIPTOOL_MODE_BLOCK, blockMode); 80 83 MODECASE(CHIPTOOL_MODE_MASKED, maskedMode); … … 85 88 MODECASE(CHIPTOOL_MODE_DONECLEANUP, donecleanupMode); 86 89 MODECASE(CHIPTOOL_MODE_RUN, runMode); 90 MODECASE(CHIPTOOL_MODE_TOCLEANEDIMFILE, tocleanedimfileMode); 91 MODECASE(CHIPTOOL_MODE_TOFULLIMFILE, tofullimfileMode); 92 MODECASE(CHIPTOOL_MODE_TOPURGEDIMFILE, topurgedimfileMode); 87 93 default: 88 94 psAbort("invalid option (this should not happen)"); … … 334 340 PS_ASSERT_PTR_NON_NULL(config, false); 335 341 336 // chip_id, ex t_tag, class_id are required342 // chip_id, exp_tag, class_id are required 337 343 PXOPT_LOOKUP_S64(chip_id, config->args, "-chip_id", true, false); 338 344 PXOPT_LOOKUP_S64(exp_id, config->args, "-exp_id", true, false); … … 379 385 exp_id, 380 386 class_id, 387 "full", 381 388 uri, 382 389 bg, … … 417 424 // XXX I've decided to make the transaction cover the Exp migration as 418 425 // well. Otherwise, if the last imfile in an exp is moved and the exp 419 // migration fails then the data base is left in a s atuation where the exp426 // migration fails then the data base is left in a situation where the exp 420 427 // migration can't happen. 421 428 … … 1069 1076 return true; 1070 1077 } 1078 1079 // update chipProcessedImfile.data_state to given value. 1080 // afterwards, if all imfiles in the exposure have the new state, update the state for the exposure as well 1081 // shared code for the modes -tocleanedimfile -tofullimfile -topurgedimfile 1082 1083 static bool change_imfile_data_state(pxConfig *config, psString data_state, psString run_state) 1084 { 1085 PS_ASSERT_PTR_NON_NULL(config, false); 1086 1087 // chip_id, class_id are required 1088 PXOPT_LOOKUP_S64(chip_id, config->args, "-chip_id", true, false); 1089 PXOPT_LOOKUP_STR(class_id, config->args, "-class_id", true, false); 1090 1091 psString query = pxDataGet("chiptool_change_imfile_data_state.sql"); 1092 1093 if (!psDBTransaction(config->dbh)) { 1094 psError(PS_ERR_UNKNOWN, false, "database error"); 1095 return false; 1096 } 1097 1098 // note only updates if chipRun.state = run_state 1099 if (!p_psDBRunQuery(config->dbh, query, data_state, chip_id, class_id, run_state)) { 1100 psError(PS_ERR_UNKNOWN, false, "database error"); 1101 // rollback 1102 if (!psDBRollback(config->dbh)) { 1103 psError(PS_ERR_UNKNOWN, false, "database error"); 1104 } 1105 psError(PS_ERR_UNKNOWN, false, "database error"); 1106 return false; 1107 } 1108 psFree(query); 1109 1110 // XXX Comment copied from addpendingimfile 1111 // I've decided to make the transaction cover the Exp migration as 1112 // well. Otherwise, if the last imfile in an exp is moved and the exp 1113 // migration fails then the data base is left in a situation where the exp 1114 // migration can't happen. 1115 1116 query = pxDataGet("chiptool_change_exp_state.sql"); 1117 if (!p_psDBRunQuery(config->dbh, query, data_state, chip_id, data_state)) { 1118 // rollback 1119 if (!psDBRollback(config->dbh)) { 1120 psError(PS_ERR_UNKNOWN, false, "database error"); 1121 } 1122 psError(PS_ERR_UNKNOWN, false, "database error"); 1123 return false; 1124 } 1125 1126 if (!psDBCommit(config->dbh)) { 1127 psError(PS_ERR_UNKNOWN, false, "database error"); 1128 return false; 1129 } 1130 1131 return true; 1132 } 1133 static bool tocleanedimfileMode(pxConfig *config) 1134 { 1135 return change_imfile_data_state(config, "cleaned", "goto_cleaned"); 1136 } 1137 static bool tofullimfileMode(pxConfig *config) 1138 { 1139 return change_imfile_data_state(config, "full", "update"); 1140 } 1141 static bool topurgedimfileMode(pxConfig *config) 1142 { 1143 return change_imfile_data_state(config, "purged", "goto_purged"); 1144 }
Note:
See TracChangeset
for help on using the changeset viewer.
