IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 4, 2006, 4:11:17 PM (20 years ago)
Author:
jhoblitt
Message:

implemented -pendingimfile

File:
1 edited

Legend:

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

    r9272 r9273  
    5151{
    5252    PS_ASSERT_PTR_NON_NULL(config, false);
    53 
    54     // return only exps that:
    55     // are not in rawScienceExp
    56     // are not in rawDetrendExp
    57     // have ALL of their imfiles in rawImfile (by count)
    58     // and have no associated imfiles left in newImfile
    5953
    6054    psString query = psStringCopy("SELECT * FROM p3PendingExp");
     
    111105    PS_ASSERT_PTR_NON_NULL(config, false);
    112106
    113     // select newImfiles that:
    114     // exp_tag is in newExp
    115     // don't have their exp_tag in rawScienceExp
    116     // don't have their exp_tag in rawDetrendExp
    117     // XXX having the same exp_tag in newExp and raw*Exp is probably an error
    118     // that should be checked for
    119     char *query =
    120         "SELECT newImfile.* FROM newImfile"
    121         " LEFT JOIN newExp USING(exp_tag)"
    122         " LEFT JOIN rawScienceExp USING(exp_tag)"
    123         " LEFT JOIN rawDetrendExp USING (exp_tag)"
    124         " WHERE newExp.exp_tag is NOT NULL"
    125         " AND rawScienceExp.exp_tag IS NULL"
    126         " AND rawDetrendExp.exp_tag IS NULL";
     107    psString query = psStringCopy(
     108        "SELECT p2ProcessedImfile.*"
     109        " FROM p3PendingExp"
     110        " JOIN p2ProcessedImfile"
     111        " USING(exp_tag, p2_version)"
     112    );
     113
     114    if (config->where) {
     115        psString whereClause = psDBGenerateWhereSQL(config->where, "p2ProcessedImfile");
     116        psStringAppend(&query, " %s", whereClause);
     117        psFree(whereClause);
     118    }
    127119
    128120    if (!p_psDBRunQuery(config->dbh, query)) {
    129121        psError(PS_ERR_UNKNOWN, false, "database error");
     122        psFree(query)
    130123        return false;
    131124    }
     125    psFree(query)
    132126
    133127    psArray *output = p_psDBFetchResult(config->dbh);
     
    138132    if (!psArrayLength(output)) {
    139133        // XXX check psError here
    140         psError(PS_ERR_UNKNOWN, false, "no pending newImfile rows found");
     134        psError(PS_ERR_UNKNOWN, false, "no pending p2ProcessedImfile rows found");
    141135        psFree(output);
    142136        return true;
     
    154148
    155149    // negate simple so the default is true
    156     if (!ippdbPrintMetadatas(stdout, output, "newImfile", !simple)) {
     150    if (!ippdbPrintMetadatas(stdout, output, "p2ProcessedImfile", !simple)) {
    157151        psError(PS_ERR_UNKNOWN, false, "failed to print array");
    158152        psFree(output);
Note: See TracChangeset for help on using the changeset viewer.