Changeset 23438 for trunk/ippTools/src
- Timestamp:
- Mar 19, 2009, 2:54:59 PM (17 years ago)
- Location:
- trunk/ippTools/src
- Files:
-
- 2 edited
-
difftool.c (modified) (7 diffs)
-
magicdstool.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/difftool.c
r23388 r23438 48 48 static bool importrunMode(pxConfig *config); 49 49 50 static bool setdiffRunState(pxConfig *config, psS64 diff_id, const char *state );50 static bool setdiffRunState(pxConfig *config, psS64 diff_id, const char *state, bool magicked); 51 51 static bool diffRunComplete(pxConfig *config); 52 52 … … 169 169 if (state) { 170 170 // set detRun.state to state 171 return setdiffRunState(config, diff_id, state );171 return setdiffRunState(config, diff_id, state, false); 172 172 } 173 173 … … 283 283 284 284 if (count == 2) { 285 if (!setdiffRunState(config, diff_id, "new" )) {285 if (!setdiffRunState(config, diff_id, "new", false)) { 286 286 if (!psDBRollback(config->dbh)) { 287 287 psError(PS_ERR_UNKNOWN, false, "database error"); … … 732 732 733 733 734 static bool setdiffRunState(pxConfig *config, psS64 diff_id, const char *state )734 static bool setdiffRunState(pxConfig *config, psS64 diff_id, const char *state, bool magicked) 735 735 { 736 736 PS_ASSERT_PTR_NON_NULL(state, false); … … 742 742 } 743 743 744 char *query = "UPDATE diffRun SET state = '%s' WHERE diff_id = %"PRId64; 745 if (!p_psDBRunQueryF(config->dbh, query, state, diff_id)) { 744 char *query = "UPDATE diffRun SET state = '%s', magicked = %d WHERE diff_id = %"PRId64; 745 746 if (!p_psDBRunQueryF(config->dbh, query, state, magicked, diff_id)) { 746 747 psError(PS_ERR_UNKNOWN, false, 747 748 "failed to change state for diff_id %"PRId64, diff_id); … … 1169 1170 query = NULL; 1170 1171 1171 if (!setdiffRunState(config, run->diff_id, "new" )) {1172 if (!setdiffRunState(config, run->diff_id, "new", false)) { 1172 1173 psError(PS_ERR_UNKNOWN, false, "failed to change diffRun.state for diff_id: %" PRId64, 1173 1174 run->diff_id); … … 1432 1433 1433 1434 psS64 diff_id = psMetadataLookupS64(NULL, row, "diff_id"); 1435 bool magicked = psMetadataLookupBool(NULL, row, "magicked"); 1434 1436 1435 1437 // set diffRun.state to 'stop' 1436 if (!setdiffRunState(config, diff_id, "full" )) {1438 if (!setdiffRunState(config, diff_id, "full", magicked)) { 1437 1439 psError(PS_ERR_UNKNOWN, false, "failed to change diffRun.state for diff_id: %" PRId64, 1438 1440 diff_id); -
trunk/ippTools/src/magicdstool.c
r23389 r23438 40 40 41 41 static bool setmagicDSRunState(pxConfig *config, psS64 magic_id, const char *state); 42 static bool magicDSRunComplete(pxConfig *config );42 static bool magicDSRunComplete(pxConfig *config, bool setmagicked); 43 43 static bool magicDSGetIDs(pxConfig *config, psString stage, psS64 magic_id, psS64 *stage_id, psS64 *cam_id); 44 44 … … 528 528 } 529 529 530 static bool 531 setRunMagicked(pxConfig *config, psS64 magic_ds_id) 532 { 533 // first query the magicDSRun to find the stage and the stage_id 534 psString query = "SELECT stage, stage_id from magicDSRun where magic_ds_id = %" PRId64; 535 536 if (!p_psDBRunQueryF(config->dbh, query, magic_ds_id)) { 537 psError(PS_ERR_UNKNOWN, false, "database error"); 538 return false; 539 } 540 541 psArray *output = p_psDBFetchResult(config->dbh); 542 if (!output) { 543 psError(PS_ERR_UNKNOWN, false, "database error"); 544 return false; 545 } 546 if (!psArrayLength(output)) { 547 psError(PS_ERR_UNKNOWN, true, "magicDSRun not found for magic_ds_id %" PRId64, magic_ds_id); 548 psFree(output); 549 return false; 550 } 551 if (psArrayLength(output) > 1) { 552 psError(PS_ERR_UNKNOWN, true, "unexpected number of rows found %ld for magic_ds_id %" PRId64, 553 psArrayLength(output), magic_ds_id); 554 psFree(output); 555 return false; 556 } 557 psMetadata *row = output->data[0]; 558 559 psString stage = psMetadataLookupStr(NULL, row, "stage"); 560 psS64 stage_id = psMetadataLookupS64(NULL, row, "stage_id"); 561 562 563 // chose the appropriate query based on the stage 564 if (!strcmp(stage, "raw")) { 565 query = "UPDATE rawExp SET magicked = 1 where exp_id = %" PRId64; 566 } else if (!strcmp(stage, "chip")) { 567 query = "UPDATE chipRun SET magicked = 1 where chip_id = %" PRId64; 568 } else if (!strcmp(stage, "warp")) { 569 query = "UPDATE warpRun SET magicked = 1 where warp_id = %" PRId64; 570 } else if (!strcmp(stage, "diff")) { 571 query = "UPDATE diffRun SET magicked = 1 where diff_id = %" PRId64; 572 } else { 573 psError(PS_ERR_UNKNOWN, true, "unexpected value for stage: %s found", stage); 574 psFree(output); 575 return false; 576 } 577 if (!p_psDBRunQueryF(config->dbh, query, stage_id)) { 578 psError(PS_ERR_UNKNOWN, false, "database error"); 579 return false; 580 } 581 psFree(output); 582 583 psU64 affected = psDBAffectedRows(config->dbh); 584 if (affected != 1) { 585 psError(PS_ERR_UNKNOWN, false, "should have affected 1 row"); 586 return false; 587 } 588 589 return true; 590 } 591 530 592 static bool adddestreakedfileMode(pxConfig *config) 531 593 { … … 553 615 554 616 if (setmagicked) { 617 // set the image file's magicked flag 555 618 if (!setMagicked(config, magic_ds_id, component)) { 556 619 psError(PS_ERR_UNKNOWN, false, "setMagicked failed"); 620 if (!psDBRollback(config->dbh)) { 621 psError(PS_ERR_UNKNOWN, false, "database error"); 622 } 557 623 return false; 558 624 } … … 568 634 } 569 635 570 if (!magicDSRunComplete(config )) {636 if (!magicDSRunComplete(config, setmagicked)) { 571 637 // rollback 572 638 if (!psDBRollback(config->dbh)) { … … 593 659 594 660 if (!strcmp(stage, "diff")) { 595 // don't need these ids for diff stage 661 // don't need these ids for diff stage because diff_id is in the magicRun 596 662 *stage_id = 0; 597 663 *cam_id = 0; … … 654 720 } 655 721 656 static bool magicDSRunComplete(pxConfig *config )722 static bool magicDSRunComplete(pxConfig *config, bool setmagicked) 657 723 { 658 724 PS_ASSERT_PTR_NON_NULL(config, false); … … 686 752 687 753 psS64 magic_ds_id = psMetadataLookupS64(NULL, row, "magic_ds_id"); 754 755 // if requested, set stageRun.magicked 756 if (setmagicked && !setRunMagicked(config, magic_ds_id)) { 757 psError(PS_ERR_UNKNOWN, false, "failed to change stageRun.magicked for magic_ds_id: %" PRId64, 758 magic_ds_id); 759 return false; 760 } 688 761 689 762 // set magicDSRun.state to 'full'
Note:
See TracChangeset
for help on using the changeset viewer.
