IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 4, 2006, 6:12:01 PM (20 years ago)
Author:
jhoblitt
Message:

update -residexp to include detInputExp.include in it's output

File:
1 edited

Legend:

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

    r9264 r9283  
    40074007    PS_ASSERT_PTR_NON_NULL(config, false);
    40084008
    4009     // no options are required... use the default where statement
    4010     psArray *residExps = detResidExpSelectRowObjects(config->dbh,
    4011             config->where, 0);
    4012     if (!residExps) {
    4013         psError(PS_ERR_UNKNOWN, false, "no detResidExpg rows found");
    4014         return false;
     4009    psString query = psStringCopy(
     4010            "SELECT"
     4011            "   detResidExp.*,"
     4012            "   detInputExp.include"
     4013            " FROM detResidExp"
     4014            " JOIN detInputExp"
     4015            "   USING(det_id, exp_tag, iteration)"
     4016            " JOIN detRun"
     4017            "   ON detResidExp.det_id = detRun.position"
     4018            "   AND detResidExp.iteration = detRun.iteration"
     4019            " WHERE"
     4020            "   detRun.state = 'run'"
     4021    );
     4022
     4023    if (config->where) {
     4024        psString whereClause = psDBGenerateWhereConditionSQL(config->where, NULL);
     4025        psStringAppend(&query, " AND %s", whereClause);
     4026        psFree(whereClause);
     4027    }
     4028
     4029    if (!p_psDBRunQuery(config->dbh, query)) {
     4030        psError(PS_ERR_UNKNOWN, false, "database error");
     4031        psFree(query);
     4032        return false;
     4033    }
     4034    psFree(query);
     4035
     4036    psArray *output = p_psDBFetchResult(config->dbh);
     4037    if (!output) {
     4038        psError(PS_ERR_UNKNOWN, false, "database error");
     4039        return false;
     4040    }
     4041    if (!psArrayLength(output)) {
     4042        // XXX check psError here
     4043        psError(PS_ERR_UNKNOWN, false, "no detResidExp rows found");
     4044        psFree(output)
     4045        return true;
    40154046    }
    40164047
     
    40264057
    40274058    // negative simple so the default is true
    4028     if (residExps->n) {
    4029         if (!detResidExpPrintObjects(stdout, residExps, !simple)) {
    4030             psError(PS_ERR_UNKNOWN, false, "failed to print array");
    4031             psFree(residExps);
    4032             return false;
    4033         }
    4034     }
    4035 
    4036     psFree(residExps);
     4059    if (!ippdbPrintMetadatas(stdout, output, "detResidExp", !simple)) {
     4060        psError(PS_ERR_UNKNOWN, false, "failed to print array");
     4061        psFree(output);
     4062        return false;
     4063    }
     4064
     4065    psFree(output);
    40374066
    40384067    return true;
Note: See TracChangeset for help on using the changeset viewer.