IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 9, 2007, 11:04:02 AM (19 years ago)
Author:
jhoblitt
Message:

add dettool -adddetrunsummary -again

File:
1 edited

Legend:

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

    r14079 r14082  
    54955495    PS_ASSERT_PTR_NON_NULL(config, false);
    54965496
    5497     // select detRun.det_id
    5498     // select detRun.iteration
    5499     // by:
    5500     // find the current iteration bassed on det_id
    5501     // find all exp_ids in the current det_id/iteration from detInputExp
    5502     // find all exp_ids in the current det_id/iteration from detResidExp
    5503     // compare the counts of exp_ids
     5497    // required
     5498    bool status = false;
     5499    psString det_id = psMetadataLookupStr(&status, config->args, "-det_id");
     5500    if (!status) {
     5501        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -det_id");
     5502        return false;
     5503    }
     5504    if (!det_id) {
     5505        psError(PS_ERR_UNKNOWN, true, "-det_id is required");
     5506        return false;
     5507    }
     5508   
     5509    // optional
     5510    bool again = psMetadataLookupBool(&status, config->args, "-again");
     5511    if (!status) {
     5512        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -again");
     5513        return false;
     5514    }
    55045515
    55055516    psString query = pxDataGet("dettool_find_completed_runs.sql");
     
    55135524        psMetadata *where = psMetadataAlloc();
    55145525        bool status = false;
    5515         psString det_id = psMetadataLookupStr(&status, config->args, "-det_id");
    5516         if (!status) {
    5517             psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -det_id");
    5518             psFree(where);
    5519             psFree(query);
    5520             return false;
    5521         }
    55225526        if (det_id) {
    5523             if (!psMetadataAddStr(where, PS_LIST_TAIL, "det_id", 0, "==", det_id)) {
     5527            if (!psMetadataAddS64(where, PS_LIST_TAIL, "det_id", 0, "==", (psS64)atoll(det_id))) {
    55245528                psError(PS_ERR_UNKNOWN, false, "failed to add item det_id");
    55255529                psFree(where);
     
    56035607
    56045608    psFree(output);
     5609
     5610    if (again) {
     5611        if (!startNewIteration(config, (psS64)atoll(det_id))) {
     5612            if (!psDBRollback(config->dbh)) {
     5613                psError(PS_ERR_UNKNOWN, false, "database error");
     5614            }
     5615            psError(PS_ERR_UNKNOWN, false, "failed to start new iteration");
     5616            return false;
     5617        }
     5618    } else {
     5619        // set detRun.state to stop
     5620        if (!setDetRunState(config, (psS64)atoll(det_id), "stop")) {
     5621            if (!psDBRollback(config->dbh)) {
     5622                psError(PS_ERR_UNKNOWN, false, "database error");
     5623            }
     5624            psError(PS_ERR_UNKNOWN, false, "failed to set detRun.state");
     5625            return false;
     5626        }
     5627    }
    56055628
    56065629    if (!psDBCommit(config->dbh)) {
     
    58315854    // in an inconsistent UPDATE below.  I added this AND clause
    58325855    // though there may be a cleaner method (EAM 2006.10.08)
    5833     psStringAppend(&query, " WHERE detRun.det_id = %" PRId64 , det_id);
     5856    psStringAppend(&query, " WHERE det_id = %" PRId64 , det_id);
    58345857
    58355858    if (!p_psDBRunQuery(config->dbh, query)) {
Note: See TracChangeset for help on using the changeset viewer.