IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 10, 2007, 6:42:52 PM (19 years ago)
Author:
jhoblitt
Message:

add p3tool -faultexp & -pendingexp -faulted & -pendingexp -limit

File:
1 edited

Legend:

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

    r10944 r11024  
    3030static bool pendingimfileMode(pxConfig *config);
    3131static bool addprocessedexpMode(pxConfig *config);
     32static bool faultexpMode(pxConfig *config);
    3233static bool blockMode(pxConfig *config);
    3334static bool maskedMode(pxConfig *config);
     
    5152        MODECASE(P3TOOL_MODE_PENDINGIMFILE,     pendingimfileMode);
    5253        MODECASE(P3TOOL_MODE_ADDPROCESSEDEXP,   addprocessedexpMode);
     54        MODECASE(P3TOOL_MODE_FAULTEXP,          faultexpMode);
    5355        MODECASE(P3TOOL_MODE_BLOCK,             blockMode);
    5456        MODECASE(P3TOOL_MODE_MASKED,            maskedMode);
     
    7678{
    7779    PS_ASSERT_PTR_NON_NULL(config, false);
     80
     81    bool status = false;
     82    psU64 limit = psMetadataLookupU64(&status, config->args, "-limit");
     83    if (!status) {
     84        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -limit");
     85        return false;
     86    }
     87
     88    bool faulted = psMetadataLookupU64(&status, config->args, "-faulted");
     89    if (!status) {
     90        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -faulted");
     91        return false;
     92    }
    7893
    7994    psString query = psStringCopy(
     
    97112        psStringAppend(&query, " %s", whereClause);
    98113        psFree(whereClause);
     114    }
     115
     116    if (faulted) {
     117        // list only faulted rows
     118        psStringAppend(&query, " %s", "AND p3PendingExp.fault != 0");
     119    } else {
     120        // don't list faulted rows
     121        psStringAppend(&query, " %s", "AND p3PendingExp.fault = 0");
     122    }
     123
     124    // treat limit == 0 as "no limit"
     125    if (limit) {
     126        psString limitString = psDBGenerateLimitSQL(limit);
     127        psStringAppend(&query, " %s", limitString);
     128        psFree(limitString);
    99129    }
    100130
     
    390420}
    391421
     422
     423static bool faultexpMode(pxConfig *config)
     424{
     425    PS_ASSERT_PTR_NON_NULL(config, false);
     426
     427    bool status = false;
     428    psS8 code = psMetadataLookupS8(&status, config->args, "-code");
     429    if (!status) {
     430        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -code");
     431        return false;
     432    }
     433
     434    if (!pxSetFaultCode(config->dbh, "p3PendingExp", config->where, code)) {
     435        psError(PS_ERR_UNKNOWN, false, "failed to set set fault flag");
     436        return false;
     437    }
     438
     439    return true;
     440}
     441
     442
    392443static bool blockMode(pxConfig *config)
    393444{
Note: See TracChangeset for help on using the changeset viewer.