IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 10, 2007, 2:18:03 PM (19 years ago)
Author:
jhoblitt
Message:

add difftool -revertdiffskyfile

File:
1 edited

Legend:

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

    r13691 r14108  
    3838static bool adddiffskyfileMode(pxConfig *config);
    3939static bool diffskyfileMode(pxConfig *config);
     40static bool revertdiffskyfileMode(pxConfig *config);
    4041
    4142static bool setdiffRunState(pxConfig *config, const char *warp_id, const char *state);
     
    6667        MODECASE(DIFFTOOL_MODE_ADDDIFFSKYFILE,     adddiffskyfileMode);
    6768        MODECASE(DIFFTOOL_MODE_DIFFSKYFILE,        diffskyfileMode);
     69        MODECASE(DIFFTOOL_MODE_REVERTDIFFSKYFILE,  revertdiffskyfileMode);
    6870        default:
    6971            psAbort("invalid option (this should not happen)");
     
    521523    }
    522524
     525    // default values
     526    psS16 code = psMetadataLookupS16(&status, config->args, "-code");
     527    if (!status) {
     528        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -code");
     529        return false;
     530    }
     531
    523532    if (!psDBTransaction(config->dbh)) {
    524533        psError(PS_ERR_UNKNOWN, false, "database error");
     
    531540            path_base,
    532541            bg,
    533             bg_stdev
     542            bg_stdev,
     543            code
    534544        )) {
    535545        if (!psDBRollback(config->dbh)) {
     
    645655}
    646656
     657
     658static bool revertdiffskyfileMode(pxConfig *config)
     659{
     660    PS_ASSERT_PTR_NON_NULL(config, false);
     661
     662    psString query = pxDataGet("difftool_revertdiffskyfile.sql");
     663    if (!query) {
     664        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     665        return false;
     666    }
     667
     668    if (config->where) {
     669        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "diffSkyfile");
     670        psStringAppend(&query, " AND %s", whereClause);
     671        psFree(whereClause);
     672    }
     673
     674    if (!p_psDBRunQuery(config->dbh, query)) {
     675        psError(PS_ERR_UNKNOWN, false, "database error");
     676        psFree(query);
     677        return false;
     678    }
     679    psFree(query);
     680
     681    if (psDBAffectedRows(config->dbh) < 1) {
     682        psError(PS_ERR_UNKNOWN, false, "should have affected atleast 1 row");
     683        return false;
     684    }
     685
     686    return true;
     687}
     688
     689
    647690static bool setdiffRunState(pxConfig *config, const char *diff_id, const char *state)
    648691{
Note: See TracChangeset for help on using the changeset viewer.