- Timestamp:
- Oct 21, 2010, 2:45:13 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20100823/ippTools/src/magicdstool.c
r28936 r29515 637 637 psFree(where); 638 638 639 psStringAppend(&query, "\nORDER BY priority DESC, magic_ds_id"); 640 639 641 // treat limit == 0 as "no limit" 640 642 if (limit) { … … 933 935 } 934 936 937 // treat limit == 0 as "no limit" 938 if (limit) { 939 psString limitString = psDBGenerateLimitSQL(limit); 940 psStringAppend(&query, " %s", limitString); 941 psFree(limitString); 942 } 943 935 944 if (!p_psDBRunQuery(config->dbh, query)) { 936 945 psError(PS_ERR_UNKNOWN, false, "database error"); … … 950 959 return true; 951 960 } 952 if (!psDBTransaction(config->dbh)) {953 psError(PS_ERR_UNKNOWN, false, "database error");954 return false;955 }956 961 for (long i = 0; i < psArrayLength(output); i++) { 957 962 psMetadata *row = output->data[i]; 958 963 959 964 psS64 magic_ds_id = psMetadataLookupS64(NULL, row, "magic_ds_id"); 965 psS64 magicked = psMetadataLookupS64(NULL, row, "magicked"); 966 if (!psDBTransaction(config->dbh)) { 967 psError(PS_ERR_UNKNOWN, false, "database error"); 968 return false; 969 } 960 970 961 971 // if re_place, set stageRun.magicked 962 972 bool setmagicked = psMetadataLookupBool(NULL, row, "re_place"); 963 if (setmagicked && !setRunMagicked(config, magic_ds_id)) { 964 psError(PS_ERR_UNKNOWN, false, "failed to change stageRun.magicked for magic_ds_id: %" PRId64, 965 magic_ds_id); 966 if (!psDBRollback(config->dbh)) { 967 psError(PS_ERR_UNKNOWN, false, "database error"); 973 if (setmagicked) { 974 if (magicked <= 0) { 975 if (!setRunMagicked(config, magic_ds_id)) { 976 psError(PS_ERR_UNKNOWN, false, "failed to change stageRun.magicked for magic_ds_id: %" PRId64, 977 magic_ds_id); 978 if (!psDBRollback(config->dbh)) { 979 psError(PS_ERR_UNKNOWN, false, "database error"); 980 } 981 return false; 982 } 983 } else { 984 fprintf(stderr, "run is already marked as destreaked for magic_ds_id %" PRId64 "\n", magic_ds_id); 968 985 } 969 return false;970 986 } 971 987 … … 980 996 return false; 981 997 } 982 }983 if (!psDBCommit(config->dbh)) {984 psError(PS_ERR_UNKNOWN, false, "database error");985 return false;998 if (!psDBCommit(config->dbh)) { 999 psError(PS_ERR_UNKNOWN, false, "database error"); 1000 return false; 1001 } 986 1002 } 987 1003
Note:
See TracChangeset
for help on using the changeset viewer.
