IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 24, 2006, 12:39:40 PM (20 years ago)
Author:
jhoblitt
Message:

change -input to include rawDetrendExp info for the exp_ids

File:
1 edited

Legend:

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

    r8541 r8565  
    724724    PS_ASSERT_PTR_NON_NULL(config, false);
    725725
    726     // no options are required... use the default where statement
    727     psArray *inputExp = detInputExpSelectRowObjects(config->dbh, config->where,
    728             0);
    729     if (!inputExp) {
    730         psError(PS_ERR_UNKNOWN, false, "no rawDetrendExp rows found");
     726    // select detInputExp.*
     727    // select rawDetrendExp.*
     728    // by:
     729    // exp_id
     730
     731    psString query = psStringCopy(
     732        "SELECT DISTINCT *"
     733        " FROM detInputExp"
     734        " JOIN rawDetrendExp"
     735        " USING(exp_id)"
     736        );
     737
     738    if (config->where) {
     739        psString whereClause = psDBGenerateWhereSQL(config->where, "detInputExp");
     740        psStringAppend(&query, " %s", whereClause);
     741        psFree(whereClause);
     742    }
     743
     744    if (!p_psDBRunQuery(config->dbh, query)) {
     745        psError(PS_ERR_UNKNOWN, false, "database error");
     746        psFree(query);
     747        return false;
     748    }
     749    psFree(query);
     750
     751    psArray *output = p_psDBFetchResult(config->dbh);
     752    if (!output) {
     753        // XXX check psError here
     754        psError(PS_ERR_UNKNOWN, false, "no pending rawDetrendExp rows found");
    731755        return false;
    732756    }
     
    742766    }
    743767
    744     if (psArrayLength(inputExp)) {
    745         // negative simple so the default is true
    746         if (!detInputExpPrintObjects(stdout, inputExp, !simple)) {
    747             psError(PS_ERR_UNKNOWN, false, "failed to print array");
    748             psFree(inputExp);
    749             return false;
    750         }
    751     }
    752 
    753     psFree(inputExp);
     768    // negative simple so the default is true
     769    if (!ippdbPrintMetadatas(stdout, output, "detInputExp", !simple)) {
     770        psError(PS_ERR_UNKNOWN, false, "failed to print array");
     771        psFree(output);
     772        return false;
     773    }
     774
     775    psFree(output);
    754776
    755777    return true;
Note: See TracChangeset for help on using the changeset viewer.