IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 8, 2008, 5:08:29 PM (18 years ago)
Author:
eugene
Message:

adding cleanup operations to dettool

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20080719/ippTools/src/dettool_detrunsummary.c

    r18641 r18991  
    9494        return false;
    9595    }
     96    psString data_state = psMetadataLookupStr(&status, row, "data_state");
     97    if (!status) {
     98        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for iteration");
     99        return false;
     100    }
    96101
    97102    // optional
     
    107112            det_id,
    108113            iteration,
     114            data_state,
    109115            bg,
    110116            bg_stdev,
     
    115121}
    116122
     123// XXX data_state should be set to 'full' here
    117124bool adddetrunsummaryMode(pxConfig *config)
    118125{
     
    121128    // build a query to search by det_id, iteration, exp_id
    122129    psMetadata *where = psMetadataAlloc();
    123     PXOPT_COPY_STR(config->args, where, "-det_id", "det_id", "==");
     130    PXOPT_COPY_S64(config->args, where, "-det_id", "det_id", "==");
    124131    PXOPT_COPY_S32(config->args, where, "-iteration", "iteration", "==");
    125132
    126     PXOPT_LOOKUP_STR(det_id, config->args, "-det_id", true, false); // required
     133    PXOPT_LOOKUP_S64(det_id, config->args, "-det_id", true, false); // required
    127134    PXOPT_LOOKUP_BOOL(again, config->args, "-again", false);
    128135
     
    200207    // XXX it should be an error for -again and -code to both be set
    201208    if (again) {
    202         if (!startNewIteration(config, (psS64)atoll(det_id))) {
     209        if (!startNewIteration(config, det_id)) {
    203210            if (!psDBRollback(config->dbh)) {
    204211                psError(PS_ERR_UNKNOWN, false, "database error");
     
    209216    } else {
    210217        // set detRun.state to stop
    211         if (!setDetRunState(config, (psS64)atoll(det_id), "stop")) {
     218        if (!setDetRunState(config, det_id, "stop")) {
    212219            if (!psDBRollback(config->dbh)) {
    213220                psError(PS_ERR_UNKNOWN, false, "database error");
     
    230237
    231238    psMetadata *where = psMetadataAlloc();
    232     PXOPT_COPY_STR(config->args, where, "-det_id",    "det_id", "==");
     239    PXOPT_COPY_S64(config->args, where, "-det_id",    "det_id", "==");
    233240    PXOPT_COPY_S32(config->args, where, "-iteration", "iteration", "==");
    234241
     
    302309
    303310    psMetadata *where = psMetadataAlloc();
    304     PXOPT_COPY_STR(config->args, where, "-det_id",    "det_id", "==");
     311    PXOPT_COPY_S64(config->args, where, "-det_id",    "det_id", "==");
    305312    PXOPT_COPY_S32(config->args, where, "-iteration", "iteration", "==");
    306313    PXOPT_COPY_STR(config->args, where, "-code",      "fault", "==");
     
    334341}
    335342
    336 
     343// XXX need to add -data_state here
    337344bool updatedetrunsummaryMode(pxConfig *config)
    338345{
    339346    PS_ASSERT_PTR_NON_NULL(config, false);
    340347   
    341     PXOPT_LOOKUP_STR(det_id, config->args, "-det_id", true, false); // required
     348    PXOPT_LOOKUP_S64(det_id, config->args, "-det_id", true, false); // required
    342349    PXOPT_LOOKUP_BOOL(accept, config->args, "-accept", false);
    343350    PXOPT_LOOKUP_BOOL(reject, config->args, "-reject", false);
     
    354361
    355362    char *query = "UPDATE detRunSummary SET accept = %d WHERE det_id = %"PRId64;
    356     if (!p_psDBRunQuery(config->dbh, query, accept, (psS64)atoll(det_id))) {
    357         psError(PS_ERR_UNKNOWN, false, "database error");
    358         return false;
    359     }
    360 
    361     return true;
    362 }
    363 
    364 
     363    if (!p_psDBRunQuery(config->dbh, query, accept, det_id)) {
     364        psError(PS_ERR_UNKNOWN, false, "database error");
     365        return false;
     366    }
     367
     368    return true;
     369}
     370
     371
Note: See TracChangeset for help on using the changeset viewer.