Changeset 10976 for trunk/ippTools/src/regtool.c
- Timestamp:
- Jan 8, 2007, 3:10:25 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/regtool.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/regtool.c
r10974 r10976 31 31 static bool updateexpMode(pxConfig *config); 32 32 static bool updateimfileMode(pxConfig *config); 33 static bool faultexpMode(pxConfig *config); 33 34 static bool faultimfileMode(pxConfig *config); 34 35 static bool rawimfileMode(pxConfig *config); … … 39 40 static rawDetrendExpRow *newToRawDetrendExp(pxConfig *config, newExpRow *exp); 40 41 static rawImfileRow *newToRawImfile(pxConfig *config, newImfileRow *exp); 41 static psU32 mapCodeStrToInt(char *codeStr); 42 static psU32 mapCodeStrToInt(const char *codeStr); 43 static bool setFaultFlags(psDB *dbh, const char *tableName, psMetadata *where, const char *codeStr); 42 44 43 45 … … 56 58 57 59 switch (config->mode) { 58 MODECASE(P0TOOL_MODE_PENDINGEXP, pendingexpMode); 59 MODECASE(P0TOOL_MODE_PENDINGIMFILE, pendingimfileMode); 60 MODECASE(P0TOOL_MODE_UPDATEEXP, updateexpMode); 61 MODECASE(P0TOOL_MODE_UPDATEIMFILE, updateimfileMode); 62 MODECASE(P0TOOL_MODE_FAULTIMFILE, faultimfileMode); 63 MODECASE(P0TOOL_MODE_RAWIMFILE, rawimfileMode); 60 MODECASE(P0TOOL_MODE_PENDINGEXP, pendingexpMode); 61 MODECASE(P0TOOL_MODE_PENDINGIMFILE, pendingimfileMode); 62 MODECASE(P0TOOL_MODE_UPDATEEXP, updateexpMode); 63 MODECASE(P0TOOL_MODE_FAULTEXP, faultexpMode); 64 MODECASE(P0TOOL_MODE_UPDATEIMFILE, updateimfileMode); 65 MODECASE(P0TOOL_MODE_FAULTIMFILE, faultimfileMode); 66 MODECASE(P0TOOL_MODE_RAWIMFILE, rawimfileMode); 64 67 default: 65 68 psAbort(argv[0], "invalid option (this should not happen)"); … … 89 92 if (!status) { 90 93 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -limit"); 94 return false; 95 } 96 97 bool faulted = psMetadataLookupU64(&status, config->args, "-faulted"); 98 if (!status) { 99 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -faulted"); 91 100 return false; 92 101 } … … 117 126 ); 118 127 128 if (faulted) { 129 // list only faulted rows 130 psStringAppend(&query, " %s", "AND newExp.flags > 0"); 131 } else { 132 // don't list faulted rows 133 psStringAppend(&query, " %s", "AND newExp.flags = 0"); 134 } 135 119 136 // treat limit == 0 as "no limit" 120 137 if (limit) { … … 255 272 } 256 273 257 static bool faultimfileMode(pxConfig *config) 258 { 259 PS_ASSERT_PTR_NON_NULL(config, false); 260 274 static bool faultexpMode(pxConfig *config) 275 { 261 276 bool status = false; 262 277 psString codeStr = psMetadataLookupStr(&status, config->args, "-code"); … … 269 284 return false; 270 285 } 286 287 if (!setFaultFlags(config->dbh, "newExp", config->where, codeStr)) { 288 psError(PS_ERR_UNKNOWN, false, "failed to set set fault flag"); 289 return false; 290 } 291 292 return true; 293 } 294 295 static bool faultimfileMode(pxConfig *config) 296 { 297 PS_ASSERT_PTR_NON_NULL(config, false); 298 299 bool status = false; 300 psString codeStr = psMetadataLookupStr(&status, config->args, "-code"); 301 if (!status) { 302 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -code"); 303 return false; 304 } 305 if (!codeStr) { 306 psError(PS_ERR_UNKNOWN, true, "-code is required"); 307 return false; 308 } 309 310 if (!setFaultFlags(config->dbh, "newImfile", config->where, codeStr)) { 311 psError(PS_ERR_UNKNOWN, false, "failed to set set fault flag"); 312 return false; 313 } 314 315 return true; 316 } 317 318 static bool setFaultFlags(psDB *dbh, const char *tableName, psMetadata *where, const char *codeStr) 319 { 320 PS_ASSERT_PTR_NON_NULL(dbh, false); 321 PS_ASSERT_PTR_NON_NULL(tableName, false); 322 PS_ASSERT_PTR_NON_NULL(codeStr, false); 271 323 272 324 // map code string to numeric fault code … … 286 338 psFree(values); 287 339 288 long rowsAffected = psDBUpdateRows( config->dbh, "newImfile", config->where, values);340 long rowsAffected = psDBUpdateRows(dbh, tableName, where, values); 289 341 if (rowsAffected < 0) { 290 342 // database error … … 300 352 return true; 301 353 } 354 302 355 303 356 static bool updateexpMode(pxConfig *config) … … 1088 1141 } 1089 1142 1090 static psU32 mapCodeStrToInt(c har *codeStr)1143 static psU32 mapCodeStrToInt(const char *codeStr) 1091 1144 { 1092 1145 if (strcasestr(codeStr, "none")) {
Note:
See TracChangeset
for help on using the changeset viewer.
