Changeset 25465 for trunk/ippTools/src/magicdstool.c
- Timestamp:
- Sep 21, 2009, 2:49:37 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/magicdstool.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/magicdstool.c
r25423 r25465 37 37 static bool todestreakMode(pxConfig *config); 38 38 static bool adddestreakedfileMode(pxConfig *config); 39 static bool advancerunMode(pxConfig *config); 39 40 static bool revertdestreakedfileMode(pxConfig *config); 40 41 static bool getskycellsMode(pxConfig *config); … … 44 45 45 46 static bool setmagicDSRunState(pxConfig *config, psS64 magic_id, const char *state); 46 static bool magicDSRunComplete(pxConfig *config, bool setmagicked);47 47 static bool magicDSGetIDs(pxConfig *config, psString stage, psS64 magic_id, psS64 *stage_id, psS64 *cam_id); 48 48 … … 70 70 MODECASE(MAGICDSTOOL_MODE_TODESTREAK, todestreakMode); 71 71 MODECASE(MAGICDSTOOL_MODE_ADDDESTREAKEDFILE, adddestreakedfileMode); 72 MODECASE(MAGICDSTOOL_MODE_ADVANCERUN, advancerunMode); 72 73 MODECASE(MAGICDSTOOL_MODE_REVERTDESTREAKEDFILE,revertdestreakedfileMode); 73 74 MODECASE(MAGICDSTOOL_MODE_GETSKYCELLS, getskycellsMode); … … 119 120 PXOPT_COPY_S64(config->args, where, "-warp_id", "warp_id", "=="); 120 121 PXOPT_COPY_S64(config->args, where, "-diff_id", "diff_id", "=="); 121 PXOPT_COPY_S64(config->args, where, "-magic_id","magic _id", "==");122 PXOPT_COPY_S64(config->args, where, "-magic_id","magicRun.magic_id", "=="); 122 123 PXOPT_COPY_S32(config->args, where, "-streaks_max","streaks", "<="); 123 124 … … 661 662 } 662 663 663 if (!magicDSRunComplete(config, setmagicked)) {664 // rollback665 if (!psDBRollback(config->dbh)) {666 psError(PS_ERR_UNKNOWN, false, "database error");667 }668 psError(PS_ERR_UNKNOWN, false, "database error");669 return false;670 }671 672 664 if (!psDBCommit(config->dbh)) { 673 665 psError(PS_ERR_UNKNOWN, false, "database error"); … … 743 735 } 744 736 745 static bool magicDSRunComplete(pxConfig *config, bool setmagicked)737 static bool advancerunMode(pxConfig *config) 746 738 { 747 739 PS_ASSERT_PTR_NON_NULL(config, false); 740 741 psMetadata *where = psMetadataAlloc(); 742 PXOPT_COPY_S64(config->args, where, "-magic_ds_id", "magicDSRun.magic_ds_id", "=="); 743 pxAddLabelSearchArgs (config, where, "-label", "magicDSRun.label", "=="); 744 745 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 748 746 749 747 // look for completed magicDSRuns … … 754 752 } 755 753 754 if (psListLength(where->list)) { 755 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 756 psStringAppend(&query, " WHERE %s", whereClause); 757 psFree(whereClause); 758 } 759 756 760 if (!p_psDBRunQuery(config->dbh, query)) { 757 761 psError(PS_ERR_UNKNOWN, false, "database error"); … … 771 775 return true; 772 776 } 777 if (!psDBTransaction(config->dbh)) { 778 psError(PS_ERR_UNKNOWN, false, "database error"); 779 return false; 780 } 773 781 for (long i = 0; i < psArrayLength(output); i++) { 774 782 psMetadata *row = output->data[i]; … … 776 784 psS64 magic_ds_id = psMetadataLookupS64(NULL, row, "magic_ds_id"); 777 785 778 // if requested, set stageRun.magicked 786 // if re_place, set stageRun.magicked 787 bool setmagicked = psMetadataLookupBool(NULL, row, "re_place"); 779 788 if (setmagicked && !setRunMagicked(config, magic_ds_id)) { 780 789 psError(PS_ERR_UNKNOWN, false, "failed to change stageRun.magicked for magic_ds_id: %" PRId64, 781 790 magic_ds_id); 791 if (!psDBRollback(config->dbh)) { 792 psError(PS_ERR_UNKNOWN, false, "database error"); 793 } 782 794 return false; 783 795 } … … 788 800 magic_ds_id); 789 801 psFree(output); 802 if (!psDBRollback(config->dbh)) { 803 psError(PS_ERR_UNKNOWN, false, "database error"); 804 } 790 805 return false; 791 806 } 792 807 } 793 808 if (!psDBCommit(config->dbh)) { 809 psError(PS_ERR_UNKNOWN, false, "database error"); 810 return false; 811 } 794 812 795 813 return true; … … 833 851 return true; 834 852 } 853 835 854 static bool completedrevertMode(pxConfig *config) 836 855 {
Note:
See TracChangeset
for help on using the changeset viewer.
