IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 20, 2009, 4:13:39 PM (17 years ago)
Author:
eugene
Message:

updates from head

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20091113/ippTools/src/stacktool.c

    r25935 r26236  
    150150    PXOPT_COPY_F32(config->args,  where, "-select_iq_m4_min",          "camProcessedExp.iq_m4", ">=");
    151151    PXOPT_COPY_F32(config->args,  where, "-select_iq_m4_max",          "camProcessedExp.iq_m4", "<=");
    152    
     152
    153153    PXOPT_COPY_STR(config->args,  where, "-select_exp_type",           "rawExp.exp_type", "==");
    154154    PXOPT_COPY_F32(config->args,  where, "-select_good_frac_min",      "warpSkyfile.good_frac", ">=");
     
    173173    }
    174174
    175     psString select = pxDataGet("stacktool_definebyquery_part1.sql");
     175    psString select = pxDataGet("stacktool_definebyquery_select.sql");
    176176    if (!select) {
    177177        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     
    179179    }
    180180
     181    psString where1 = psStringCopy("");
    181182    if (psListLength(where->list)) {
    182183        psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
    183         psStringAppend(&select, " AND %s", whereClause);
     184        psStringAppend(&where1, "\nAND %s", whereClause);
    184185        psFree(whereClause);
    185186    }
    186187
    187     psString groupby = pxDataGet("stacktool_definebyquery_part2.sql");
    188     if (!groupby) {
    189         psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
    190         psFree(where);
    191         return false;
    192     }
    193     psStringAppend(&select, " %s", groupby);
    194     psFree(groupby);
     188    psString where2 = psStringCopy("");
     189    if (label) {
     190        psStringAppend(&where2, "\nWHERE stackRun.label = '%s'", label);
     191    }
    195192
    196193    // Restriction on aggregated quantities using HAVING
     
    224221    psFree(having);
    225222
    226     if (!p_psDBRunQuery(config->dbh, select)) {
     223    if (!p_psDBRunQueryF(config->dbh, select, where1, where2)) {
    227224        psError(PS_ERR_UNKNOWN, false, "database error");
    228225        psFree(select);
    229         psFree(where);
     226        psFree(where1);
     227        psFree(where2);
    230228        return false;
    231229    }
    232230    psFree(select);
     231    psFree(where1);
     232    psFree(where2);
    233233
    234234    psArray *output = p_psDBFetchResult(config->dbh);
Note: See TracChangeset for help on using the changeset viewer.