IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 8420


Ignore:
Timestamp:
Aug 17, 2006, 6:36:29 PM (20 years ago)
Author:
jhoblitt
Message:

update -residimfile

File:
1 edited

Legend:

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

    r8407 r8420  
    26632663    PS_ASSERT_PTR_NON_NULL(config, false);
    26642664
    2665     // no options are required... use the default where statement
    2666     psArray *residImfiles = detResidImfileSelectRowObjects(config->dbh,
    2667             config->where, 0);
    2668     if (!residImfiles) {
     2665    // select detResidImfile.*
     2666    // by:
     2667    // where det_id, iteration, exp_id is not in detResidExp;
     2668
     2669    psString query = psStringCopy(
     2670        "SELECT"
     2671        "   detResidImfile.*"
     2672        " FROM detResidImfile"
     2673        " LEFT JOIN detResidExp"
     2674        "   USING(det_id, iteration, exp_id)"
     2675        " WHERE"
     2676        "   detResidExp.det_id IS NULL" 
     2677        "   AND detResidExp.iteration IS NULL" 
     2678        "   AnD detResidExp.exp_id IS NULL" 
     2679        );
     2680
     2681    if (config->where) {
     2682        psString whereClaus = psDBGenerateWhereConditionSQL(config->where, "detResidImfile");
     2683        psStringAppend(&query, " AND %s", whereClaus);
     2684        psFree(whereClaus);
     2685    }
     2686
     2687    if (!p_psDBRunQuery(config->dbh, query)) {
     2688        psError(PS_ERR_UNKNOWN, false, "database error");
     2689        psFree(query);
     2690        return false;
     2691    }
     2692    psFree(query);
     2693
     2694    psArray *output = p_psDBFetchResult(config->dbh);
     2695    if (!output) {
     2696        // XXX check psError here
    26692697        psError(PS_ERR_UNKNOWN, false, "no detResidImfile rows found");
    26702698        return false;
     
    26772705        if (!status) {
    26782706            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");
     2707            psFree(output);
    26792708            return false;
    26802709        }
     
    26822711
    26832712    // negative simple so the default is true
    2684     if (residImfiles->n) {
    2685         if (!detResidImfilePrintObjects(stdout, residImfiles, !simple)) {
    2686             psError(PS_ERR_UNKNOWN, false, "failed to print array");
    2687             psFree(residImfiles);
    2688             return false;
    2689         }
    2690     }
    2691 
    2692     psFree(residImfiles);
     2713    if (!ippdbPrintMetadatas(stdout, output, "rawResidImfile", !simple)) {
     2714        psError(PS_ERR_UNKNOWN, false, "failed to print array");
     2715        psFree(output);
     2716        return false;
     2717    }
     2718
     2719    psFree(output);
    26932720
    26942721    return true;
Note: See TracChangeset for help on using the changeset viewer.