IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 10, 2007, 10:59:10 AM (19 years ago)
Author:
jhoblitt
Message:

add chiptool -revertprocessedimfile

File:
1 edited

Legend:

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

    r14023 r14099  
    3838static bool addprocessedimfileMode(pxConfig *config);
    3939static bool processedimfileMode(pxConfig *config);
     40static bool revertprocessedimfileMode(pxConfig *config);
    4041static bool updateprocessedimfileMode(pxConfig *config);
    4142static bool blockMode(pxConfig *config);
     
    6667        MODECASE(CHIPTOOL_MODE_ADDPROCESSEDIMFILE,      addprocessedimfileMode);
    6768        MODECASE(CHIPTOOL_MODE_PROCESSEDIMFILE,         processedimfileMode);
     69        MODECASE(CHIPTOOL_MODE_REVERTPROCESSEDIMFILE,   revertprocessedimfileMode);
    6870        MODECASE(CHIPTOOL_MODE_UPDATEPROCESSEDIMFILE,updateprocessedimfileMode);
    6971        MODECASE(CHIPTOOL_MODE_BLOCK,                   blockMode);
     
    671673}
    672674
     675static bool revertprocessedimfileMode(pxConfig *config)
     676{
     677    PS_ASSERT_PTR_NON_NULL(config, false);
     678
     679    psString query = pxDataGet("chiptool_revertprocessedimfile.sql");
     680    if (!query) {
     681        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     682        return false;
     683    }
     684
     685    if (config->where) {
     686        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "chipProcessedImfile");
     687        psStringAppend(&query, " AND %s", whereClause);
     688        psFree(whereClause);
     689    }
     690
     691    if (!p_psDBRunQuery(config->dbh, query)) {
     692        psError(PS_ERR_UNKNOWN, false, "database error");
     693        psFree(query);
     694        return false;
     695    }
     696    psFree(query);
     697
     698    if (psDBAffectedRows(config->dbh) < 1) {
     699        psError(PS_ERR_UNKNOWN, false, "should have affected atleast 1 row");
     700        return false;
     701    }
     702
     703    return true;
     704}
    673705
    674706static bool updateprocessedimfileMode(pxConfig *config)
Note: See TracChangeset for help on using the changeset viewer.