IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 15, 2006, 5:47:34 PM (19 years ago)
Author:
jhoblitt
Message:

implemented -todiffimfile

File:
1 edited

Legend:

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

    r10771 r10772  
    332332    }
    333333    if (!psArrayLength(output)) {
    334         // XXX check psError here
    335334        psError(PS_ERR_UNKNOWN, false, "no p4InputImfile rows found");
    336335        psFree(output);
     
    475474    }
    476475    if (!psArrayLength(output)) {
    477         // XXX check psError here
    478476        psError(PS_ERR_UNKNOWN, false, "no p4WarpedImfile rows found");
    479477        psFree(output);
     
    509507    psString query = psStringCopy(
    510508        " SELECT DISTINCT"
    511         "   p4InputImfile.p4_id,"
    512         "   p2ProcessedImfile.*"
     509        "   p4WarpedImfile.*"
    513510        " FROM p4Run"
    514511        " JOIN p4WarpedImfile"
     
    541538    }
    542539    if (!psArrayLength(output)) {
    543         // XXX check psError here
    544540        psError(PS_ERR_UNKNOWN, false, "no p4WarpedImfile rows found");
    545541        psFree(output);
     
    665661    }
    666662    if (!psArrayLength(output)) {
    667         // XXX check psError here
    668663        psError(PS_ERR_UNKNOWN, false, "no p4StackedImfile rows found");
    669664        psFree(output);
     
    696691{
    697692    PS_ASSERT_PTR_NON_NULL(config, NULL);
     693
     694    psString query = psStringCopy(
     695        " SELECT DISTINCT"
     696        "   p4StackedImfile.*,"
     697        "   p4WarpedImfile.uri as warped_uri"
     698        " FROM p4Run"
     699        " JOIN p4StackedImfile"
     700        "   USING(p4_id)"
     701        " JOIN p4WarpedImfile"
     702        "   USING(p4_id, class_id)"
     703        " LEFT JOIN p4DiffImfile"
     704        "   ON p4WarpedImfile.p4_id = p4DiffImfile.p4_id"
     705        "   AND p4WarpedImfile.exp_tag = p4DiffImfile.exp_tag"
     706        "   AND p4WarpedImfile.p3_version = p4DiffImfile.p3_version"
     707        "   AND p4WarpedImfile.class_id = p4DiffImfile.class_id"
     708        " WHERE"
     709        "   p4Run.state = 'run'"
     710        "   AND p4DiffImfile.p4_id IS NULL"
     711        "   AND p4DiffImfile.exp_tag IS NULL"
     712        "   AND p4DiffImfile.p3_version IS NULL"
     713        "   AND p4DiffImfile.class_id IS NULL"
     714    );
     715
     716    if (config->where) {
     717        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p4StackedImfile");
     718        psStringAppend(&query, " AND %s", whereClause);
     719        psFree(whereClause);
     720    }
     721
     722    if (!p_psDBRunQuery(config->dbh, query)) {
     723        psError(PS_ERR_UNKNOWN, false, "database error");
     724        psFree(query);
     725        return false;
     726    }
     727    psFree(query);
     728
     729    psArray *output = p_psDBFetchResult(config->dbh);
     730    if (!output) {
     731        psError(PS_ERR_UNKNOWN, false, "database error");
     732        return false;
     733    }
     734    if (!psArrayLength(output)) {
     735        psError(PS_ERR_UNKNOWN, false, "no p4StackedImfile rows found");
     736        psFree(output);
     737        return true;
     738    }
     739
     740    bool simple = false;
     741    {
     742        bool status = false;
     743        simple = psMetadataLookupBool(&status, config->args, "-simple");
     744        if (!status) {
     745            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");
     746            return false;
     747        }
     748    }
     749
     750    // negative simple so the default is true
     751    if (!ippdbPrintMetadatas(stdout, output, "p4StackedImfile", !simple)) {
     752        psError(PS_ERR_UNKNOWN, false, "failed to print array");
     753        psFree(output);
     754        return false;
     755    }
     756
     757    psFree(output);
    698758
    699759    return true;
     
    815875    }
    816876    if (!psArrayLength(output)) {
    817         // XXX check psError here
    818877        psError(PS_ERR_UNKNOWN, false, "no p4DiffImfile rows found");
    819878        psFree(output);
Note: See TracChangeset for help on using the changeset viewer.