- Timestamp:
- May 15, 2021, 8:38:08 AM (5 years ago)
- Location:
- trunk/ippTools/src
- Files:
-
- 2 edited
-
pztool.c (modified) (4 diffs)
-
pztoolConfig.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/pztool.c
r39519 r41582 49 49 static bool updatepzexpMode(pxConfig *config); 50 50 static bool updatenewexpMode(pxConfig *config); 51 static bool updatesummitExpMode(pxConfig *config); 51 52 52 53 // static bool copydoneCompleteExp(pxConfig *config); … … 54 55 static psArray *pzArrayZip(psArray *arraySet, psS64 limit); 55 56 static bool pzDownloadExpSetState(pxConfig *config, const psS64 summit_id, const char *state); 57 static bool summitExpSetFault(pxConfig *config, const psS64 summit_id, const int fault); 56 58 57 59 # define MODECASE(caseName, func) \ … … 88 90 MODECASE(PZTOOL_MODE_UPDATEPZEXP, updatepzexpMode); 89 91 MODECASE(PZTOOL_MODE_UPDATENEWEXP, updatenewexpMode); 92 MODECASE(PZTOOL_MODE_UPDATESUMMITEXP, updatesummitExpMode); 90 93 default: 91 94 psAbort("invalid option (this should not happen)"); … … 933 936 } 934 937 938 static bool summitExpSetFault(pxConfig *config, const psS64 summit_id, const int fault) 939 { 940 // check that state is a valid string value 941 if ((fault < 0) || (fault > 2048)) { 942 psError(PS_ERR_UNKNOWN, false, 943 "invalid summitExp fault: %d", fault); 944 return false; 945 } 946 947 char *query = "UPDATE summitExp SET fault = %d WHERE summit_id = %ld"; 948 if (!p_psDBRunQueryF(config->dbh, query, fault, summit_id)) { 949 psError(PS_ERR_UNKNOWN, false, "failed to change state for %lld", (long long) summit_id); 950 return false; 951 } 952 953 return true; 954 } 955 956 static bool updatesummitExpMode(pxConfig *config) 957 { 958 PS_ASSERT_PTR_NON_NULL(config, false); 959 PXOPT_LOOKUP_S64(summit_id, config->args, "-summit_id", true, false); 960 PXOPT_LOOKUP_S32(state, config->args, "-set_fault",true, false); 961 962 if (!summitExpSetFault(config,summit_id, fault)) { 963 psError(PS_ERR_UNKNOWN, false, "failed to change state for %lld", (long long) summit_id); 964 return false; 965 } 966 return true; 967 } 968 969 935 970 static bool updatepzexpMode(pxConfig *config) 936 971 { -
trunk/ippTools/src/pztoolConfig.c
r39519 r41582 171 171 psMetadataAddStr(updatepzexpArgs, PS_LIST_TAIL, "-set_state", 0, "define new state (required)", NULL); 172 172 173 // -updatesummitexp 174 psMetadata *updatesummitexpArgs = psMetadataAlloc(); 175 psMetadataAddS64(updatesummitexpArgs, PS_LIST_TAIL, "-summit_id", 0, "define summit_id", 0); 176 psMetadataAddStr(updatesummitexpArgs, PS_LIST_TAIL, "-exp_name", 0, "search by exposure name (required)", NULL); 177 psMetadataAddStr(updatesummitexpArgs, PS_LIST_TAIL, "-inst", 0, "search by camera (required)", NULL); 178 psMetadataAddStr(updatesummitexpArgs, PS_LIST_TAIL, "-telescope", 0, "search by telescope (required)", NULL); 179 psMetadataAddS32(updatesummitexpArgs, PS_LIST_TAIL, "-set_fault", 0, "define new fault (required)", 0); 180 173 181 // -updatenewexp 174 182 psMetadata *updatenewexpArgs = psMetadataAlloc();
Note:
See TracChangeset
for help on using the changeset viewer.
