IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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

add camtool -revertprocessedexp

File:
1 edited

Legend:

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

    r14023 r14100  
    3434static bool addprocessedexpMode(pxConfig *config);
    3535static bool processedexpMode(pxConfig *config);
     36static bool revertprocessedexpMode(pxConfig *config);
    3637static bool updateprocessedexpMode(pxConfig *config);
    3738static bool blockMode(pxConfig *config);
     
    6263        MODECASE(CAMTOOL_MODE_ADDPROCESSEDEXP,      addprocessedexpMode);
    6364        MODECASE(CAMTOOL_MODE_PROCESSEDEXP,         processedexpMode);
     65        MODECASE(CAMTOOL_MODE_REVERTPROCESSEDEXP,   revertprocessedexpMode);
    6466        MODECASE(CAMTOOL_MODE_UPDATEPROCESSEDEXP,   updateprocessedexpMode);
    6567        MODECASE(CAMTOOL_MODE_BLOCK,                blockMode);
     
    757759
    758760
     761static bool revertprocessedexpMode(pxConfig *config)
     762{
     763    PS_ASSERT_PTR_NON_NULL(config, false);
     764
     765    psString query = pxDataGet("camtool_revertprocessedexp.sql");
     766    if (!query) {
     767        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     768        return false;
     769    }
     770
     771    if (config->where) {
     772        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "camProcessedExp");
     773        psStringAppend(&query, " AND %s", whereClause);
     774        psFree(whereClause);
     775    }
     776
     777    if (!p_psDBRunQuery(config->dbh, query)) {
     778        psError(PS_ERR_UNKNOWN, false, "database error");
     779        psFree(query);
     780        return false;
     781    }
     782    psFree(query);
     783
     784    if (psDBAffectedRows(config->dbh) < 1) {
     785        psError(PS_ERR_UNKNOWN, false, "should have affected atleast 1 row");
     786        return false;
     787    }
     788
     789    return true;
     790}
     791
     792
    759793static bool updateprocessedexpMode(pxConfig *config)
    760794{
Note: See TracChangeset for help on using the changeset viewer.