IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 9, 2007, 3:59:08 PM (19 years ago)
Author:
jhoblitt
Message:

rename setFaultCode() -> pxSetFaultCode() and move it into it's own file
add p2tool -faultimfile & -pendingimfile -faulted & -pendingimfile -limit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/src/chiptool.c

    r10943 r11002  
    3333static bool pendingimfileMode(pxConfig *config);
    3434static bool addprocessedimfileMode(pxConfig *config);
     35static bool faultimfileMode(pxConfig *config);
    3536static bool blockMode(pxConfig *config);
    3637static bool maskedMode(pxConfig *config);
     
    5859        MODECASE(P2TOOL_MODE_PENDINGIMFILE,         pendingimfileMode);
    5960        MODECASE(P2TOOL_MODE_ADDPROCESSEDIMFILE,    addprocessedimfileMode);
     61        MODECASE(P2TOOL_MODE_FAULTIMFILE,           faultimfileMode);
    6062        MODECASE(P2TOOL_MODE_BLOCK,                 blockMode);
    6163        MODECASE(P2TOOL_MODE_MASKED,                maskedMode);
     
    174176    PS_ASSERT_PTR_NON_NULL(config, NULL);
    175177
     178    bool status = false;
     179    psU64 limit = psMetadataLookupU64(&status, config->args, "-limit");
     180    if (!status) {
     181        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -limit");
     182        return false;
     183    }
     184
     185    bool faulted = psMetadataLookupU64(&status, config->args, "-faulted");
     186    if (!status) {
     187        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -faulted");
     188        return false;
     189    }
     190
    176191    // XXX does this need to be constrained so that it won't return any results
    177192    // if a match p2PendingExp hasn't been registered?
     
    197212    }
    198213
     214    if (faulted) {
     215        // list only faulted rows
     216        psStringAppend(&query, " %s", "AND p2PendingImfile.fault != 0");
     217    } else {
     218        // don't list faulted rows
     219        psStringAppend(&query, " %s", "AND p2PendingImfile.fault = 0");
     220    }
     221
     222    // treat limit == 0 as "no limit"
     223    if (limit) {
     224        psString limitString = psDBGenerateLimitSQL(limit);
     225        psStringAppend(&query, " %s", limitString);
     226        psFree(limitString);
     227    }
     228
    199229    if (!p_psDBRunQuery(config->dbh, query)) {
    200230        psError(PS_ERR_UNKNOWN, false, "database error");
     
    401431    return true;
    402432}
     433
     434
     435static bool faultimfileMode(pxConfig *config)
     436{
     437    PS_ASSERT_PTR_NON_NULL(config, false);
     438
     439    bool status = false;
     440    psS8 code = psMetadataLookupS8(&status, config->args, "-code");
     441    if (!status) {
     442        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -code");
     443        return false;
     444    }
     445
     446    if (!pxSetFaultCode(config->dbh, "p2PendingImfile", config->where, code)) {
     447        psError(PS_ERR_UNKNOWN, false, "failed to set set fault flag");
     448        return false;
     449    }
     450
     451    return true;
     452}
     453
    403454
    404455static bool blockMode(pxConfig *config)
Note: See TracChangeset for help on using the changeset viewer.