Changeset 8120 for trunk/ippTools/src/chiptool.c
- Timestamp:
- Aug 3, 2006, 6:18:57 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/chiptool.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/chiptool.c
r8073 r8120 241 241 psFree(pendingImfiles); 242 242 243 // point of no return for p2PendingImfile -> p2DoneImfile 244 if (!psDBCommit(config->dbh)) { 245 psError(PS_ERR_UNKNOWN, false, "database error"); 246 return false; 247 } 248 249 // XXX make exposure state transition transactional 243 // XXX I've decided to make the transaction cover the Exp migration as 244 // well. Otherwise, if the last imfile in an exp is moved and the exp 245 // migration fails then the data base is left in a satuation where the exp 246 // migration can't happen. 250 247 251 248 // look for pending exposures 252 249 psArray *pendingExps = p2searchPendingExp(config); 253 250 if (!pendingExps) { 251 // rollback 252 if (!psDBRollback(config->dbh)) { 253 psError(PS_ERR_UNKNOWN, false, "database error"); 254 } 254 255 psError(PS_ERR_UNKNOWN, false, "no p2PendingExps found"); 255 256 return false; … … 265 266 if (!pendingImfiles) { 266 267 // exp has no coresponding imfiles 267 psArray *nukeMe = psArrayAlloc(1); 268 nukeMe->n = 0; 269 psArrayAdd(nukeMe, 0, pendingExp); 270 bool status = p2PendingExpDeleteRowObjects(config->dbh, nukeMe, MAX_ROWS); 271 psFree(nukeMe); 272 if (!status) { 268 psMetadata *where = psMetadataAlloc(); 269 psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==", pendingExp->exp_id); 270 long long count = p2PendingExpDelete(config->dbh, where, MAX_ROWS); 271 psFree(where); 272 if (count != 0) { 273 // rollback 274 if (!psDBRollback(config->dbh)) { 275 psError(PS_ERR_UNKNOWN, false, "database error"); 276 } 273 277 psError(PS_ERR_UNKNOWN, false, "dbh access failed"); 278 psFree(pendingExps); 274 279 return false; 275 280 } 276 // XXX need a func to convert from p2PendingExp -> p2DoneExp277 281 278 282 p2DoneExpRow *doneExp = p2pendingToDoneExp(pendingExp); 279 283 if (!doneExp) { 284 // rollback 285 if (!psDBRollback(config->dbh)) { 286 psError(PS_ERR_UNKNOWN, false, "database error"); 287 } 280 288 psError(PS_ERR_UNKNOWN, false, "p2PendingExp -> p2DoneExp failed"); 289 psFree(pendingExps); 281 290 return false; 282 291 } 283 292 if (!p2DoneExpInsertObject(config->dbh, doneExp)) { 293 // rollback 294 if (!psDBRollback(config->dbh)) { 295 psError(PS_ERR_UNKNOWN, false, "database error"); 296 } 284 297 psError(PS_ERR_UNKNOWN, false, "dbh access failed"); 298 psFree(doneExp); 299 psFree(pendingExps); 285 300 return false; 286 301 } 287 } 288 // skip phase 3 for the time being 302 psFree(doneExp); 303 } 304 // XXX skip phase 3 for the time being 289 305 psFree(pendingImfiles); 290 306 } 291 307 308 psFree(pendingExps); 309 310 // point of no return for p2PendingImfile -> p2DoneImfile 311 // point of no return for p2PendingExp -> p2DoneExp 312 if (!psDBCommit(config->dbh)) { 313 psError(PS_ERR_UNKNOWN, false, "database error"); 314 return false; 315 } 292 316 /* 293 317 psArray *doneFrames = p2pendingToDone(config, pendingFrames); … … 328 352 uri, 329 353 "my recipe", // recipe 330 "my stats", // stats331 354 imfile->p1_version, 332 355 imfile->p2_version
Note:
See TracChangeset
for help on using the changeset viewer.
