Changeset 28304 for branches/czw_branch/20100519/ippTools/src/pstamptool.c
- Timestamp:
- Jun 10, 2010, 6:28:51 PM (16 years ago)
- Location:
- branches/czw_branch/20100519
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
ippTools/src (modified) (1 prop)
-
ippTools/src/pstamptool.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/czw_branch/20100519
- Property svn:mergeinfo changed
-
branches/czw_branch/20100519/ippTools/src
- Property svn:ignore
-
old new 38 38 stamp-h1 39 39 warptool 40 40 staticskytool
-
- Property svn:ignore
-
branches/czw_branch/20100519/ippTools/src/pstamptool.c
r27969 r28304 30 30 #include "pxdata.h" 31 31 #include "pstamptool.h" 32 #include "pstamp.h" 32 33 33 34 static bool adddatastoreMode(pxConfig *config); … … 53 54 static bool updatedependentMode(pxConfig *config); 54 55 static bool revertdependentMode(pxConfig *config); 56 static bool getwebrequestnumMode(pxConfig *config); 55 57 56 58 # define MODECASE(caseName, func) \ … … 95 97 MODECASE(PSTAMPTOOL_MODE_UPDATEDEPENDENT, updatedependentMode); 96 98 MODECASE(PSTAMPTOOL_MODE_REVERTDEPENDENT, revertdependentMode); 99 MODECASE(PSTAMPTOOL_MODE_GETWEBREQUESTNUM, getwebrequestnumMode); 97 100 default: 98 101 psAbort("invalid option (this should not happen)"); … … 939 942 PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false); 940 943 941 // By default only revert faults < 10which are our "ipp exit codes"944 // By default only revert faults < PSTAMP_FIRST_ERROR_CODE which are our "ipp exit codes" 942 945 // codes larger than that are the pstamp request interface. 943 946 // Don't fault those unless -fault waa provided 944 psString faultClause = "";947 psString faultClause = psStringCopy(""); 945 948 if (!fault) { 946 faultClause = " \nAND (pstampJob.fault < 10)";949 psStringAppend(&faultClause, " \nAND (pstampJob.fault < %d)", PSTAMP_FIRST_ERROR_CODE); 947 950 } 948 951 … … 961 964 962 965 if (!p_psDBRunQueryF(config->dbh, query, faultClause)) { 963 psError(PS_ERR_UNKNOWN, false, "database error"); 964 return false; 965 } 966 psFree(faultClause); 967 psFree(query); 968 psError(PS_ERR_UNKNOWN, false, "database error"); 969 return false; 970 } 971 972 psFree(faultClause); 966 973 967 974 return true; … … 1133 1140 psFree(output); 1134 1141 return false; 1142 } 1143 psS32 fault = psMetadataLookupS64(NULL, dep, "fault"); 1144 if (fault > 0) { 1145 fprintf(stderr, "existing dependent has fault %d\n", fault); 1146 exit (fault); 1135 1147 } 1136 1148 printf("%" PRId64 "\n", dep_id); … … 1315 1327 return false; 1316 1328 } 1329 1330 PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false); 1331 1317 1332 psString query = pxDataGet("pstamptool_revertdependent.sql"); 1318 1333 if (!query) { … … 1326 1341 psFree(where); 1327 1342 1328 if (!p_psDBRunQuery(config->dbh, query)) { 1329 psError(PS_ERR_UNKNOWN, false, "database error"); 1330 psFree(query); 1331 return false; 1332 } 1333 1334 return true; 1335 } 1343 if (!fault) { 1344 // unless asked to clear a specific fault value, restrict reverts to fault codes 1345 // that are less than the minimum fault in the API 1346 psStringAppend(&query, " AND (pstampDependent.fault < %d)", PSTAMP_FIRST_ERROR_CODE); 1347 } 1348 1349 if (!p_psDBRunQuery(config->dbh, query)) { 1350 psError(PS_ERR_UNKNOWN, false, "database error"); 1351 psFree(query); 1352 return false; 1353 } 1354 1355 return true; 1356 } 1357 1358 static bool getwebrequestnumMode(pxConfig *config) 1359 { 1360 PS_ASSERT_PTR_NON_NULL(config, false); 1361 1362 if (!pstampWebRequestInsert(config->dbh, 0 )) { 1363 psError(PS_ERR_UNKNOWN, false, "failed to insert pstampWebRequest"); 1364 return false; 1365 } 1366 1367 psS64 req_id = psDBLastInsertID(config->dbh); 1368 1369 printf("%" PRId64 "\n", req_id); 1370 1371 return true; 1372 }
Note:
See TracChangeset
for help on using the changeset viewer.
