IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 9, 2009, 3:41:26 PM (17 years ago)
Author:
beaumont
Message:

sync with trunk

Location:
branches/cnb_branches/cnb_branch_20090215
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/cnb_branches/cnb_branch_20090215

  • branches/cnb_branches/cnb_branch_20090215/ippTools/src/chiptool.c

    r23199 r23239  
    5252static bool runMode(pxConfig *config);
    5353static bool tocleanedimfileMode(pxConfig *config);
    54 static bool tocleanedimfile_from_scrubbedMode(pxConfig *config);
     54// static bool tocleanedimfile_from_scrubbedMode(pxConfig *config);
    5555static bool tofullimfileMode(pxConfig *config);
    5656static bool topurgedimfileMode(pxConfig *config);
    5757static bool exportrunMode(pxConfig *config);
    5858static bool importrunMode(pxConfig *config);
     59static bool change_imfile_data_state(pxConfig *config, psString data_state, psString run_state);
    5960
    6061# define MODECASE(caseName, func) \
     
    9293        MODECASE(CHIPTOOL_MODE_RUN,                     runMode);
    9394        MODECASE(CHIPTOOL_MODE_TOCLEANEDIMFILE,         tocleanedimfileMode);
    94         MODECASE(CHIPTOOL_MODE_TOCLEANEDIMFILE_FROM_SCRUBBED, tocleanedimfile_from_scrubbedMode);
     95        // MODECASE(CHIPTOOL_MODE_TOCLEANEDIMFILE_FROM_SCRUBBED, tocleanedimfile_from_scrubbedMode);
    9596        MODECASE(CHIPTOOL_MODE_TOFULLIMFILE,            tofullimfileMode);
    9697        MODECASE(CHIPTOOL_MODE_TOPURGEDIMFILE,          topurgedimfileMode);
     
    651652    PXOPT_COPY_S64(config->args, where, "-chip_id", "chip_id", "==");
    652653    PXOPT_COPY_STR(config->args, where, "-class_id", "class_id", "==");
    653     PXOPT_LOOKUP_S16(code, config->args, "-code", true, false);
    654 
    655     if (!pxSetFaultCode(config->dbh, "chipProcessedImfile", where, code)) {
     654    PXOPT_LOOKUP_STR(state, config->args, "-set_state", false, false);
     655    PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
     656
     657    if (state && code) {
     658        psError(PS_ERR_UNKNOWN, true, "only one of -set_state and -code may be supplied");
     659        return false;
     660    }
     661
     662    if (state) {
     663      // make sure that the state string is valid
     664      if (!pxIsValidState(state)) {
     665        psError(PXTOOLS_ERR_DATA, false, "%s is not a valid state", state);
     666        return false;
     667      }
     668      if (!change_imfile_data_state(config, state, "unknown")) {
    656669        psError(PS_ERR_UNKNOWN, false, "failed to set set fault flag");
    657670        return false;
    658     }
    659     psFree(where);
    660 
    661     return true;
     671      }
     672      return true;
     673    }
     674
     675    if (code) {
     676      if (!pxSetFaultCode(config->dbh, "chipProcessedImfile", where, code)) {
     677        psError(PS_ERR_UNKNOWN, false, "failed to set set fault flag");
     678        return false;
     679      }
     680      psFree(where);
     681      return true;
     682    }
     683
     684    psError(PS_ERR_UNKNOWN, true, "one of -set_state or -code must be supplied");
     685    return false;
    662686}
    663687
     
    11951219// shared code for the modes -tocleanedimfile -tofullimfile -topurgedimfile
    11961220
     1221// XXX EAM : this function was enforcing only certain transitions with the SQL.  However,
     1222// this is getting fairly messy now that we have added a few additional target and
     1223// destination states.  I'm disabling these restrictions for now; is there are better way
     1224// to enforce the allowed state transitions?
     1225
    11971226static bool change_imfile_data_state(pxConfig *config, psString data_state, psString run_state)
    11981227{
     
    12101239    }
    12111240
     1241    // XXX this feature is disabled (run_state is ignored)
    12121242    // note only updates if chipRun.state = run_state
    1213     if (!p_psDBRunQueryF(config->dbh, query, data_state, chip_id, class_id, run_state)) {
     1243
     1244    if (!p_psDBRunQueryF(config->dbh, query, data_state, chip_id, class_id)) {
    12141245        psError(PS_ERR_UNKNOWN, false, "database error");
    12151246        // rollback
     
    12461277{
    12471278    return change_imfile_data_state(config, "cleaned", "goto_cleaned");
    1248 }
    1249 static bool tocleanedimfile_from_scrubbedMode(pxConfig *config)
    1250 {
    1251     return change_imfile_data_state(config, "cleaned", "goto_scrubbed");
    12521279}
    12531280static bool tofullimfileMode(pxConfig *config)
Note: See TracChangeset for help on using the changeset viewer.