IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 28, 2008, 2:46:04 PM (18 years ago)
Author:
jhoblitt
Message:

strip out use of config->where

File:
1 edited

Legend:

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

    r17186 r17188  
    355355    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
    356356
    357     // XXX does this need to be constrained so that it won't return any results
    358     // if a match chipPendingExp hasn't been registered?
     357    psMetadata *where = psMetadataAlloc();
     358    PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", false, false);
     359    // convert chip_id into a psS64
     360    if (chip_id) {
     361        if (!psMetadataAddS64(where, PS_LIST_TAIL, "chipRun.chip_id", 0, "==", (psS64)atoll(chip_id))) {
     362            psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id");
     363            psFree(where);
     364            return false;
     365        }
     366    }
     367
     368    PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false);
     369    // convert exp_id into a psS64
     370    if (exp_id) {
     371        if (!psMetadataAddS64(where, PS_LIST_TAIL, "rawExp.exp_id", 0, "==", (psS64)atoll(exp_id))) {
     372            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
     373            psFree(where);
     374            return false;
     375        }
     376    }
     377
     378    PXOPT_COPY_STR(config->args, where, "-class_id", "rawImfile.class_id", "==");
     379    PXOPT_COPY_STR(config->args, where, "-inst", "rawExp.telescope", "==");
     380    PXOPT_COPY_STR(config->args, where, "-filter", "rawExp.filter", "==");
     381
    359382    psString query = pxDataGet("chiptool_pendingimfile.sql");
    360383    if (!query) {
     
    363386    }
    364387
    365     if (config->where) {
    366         psString whereClause = psDBGenerateWhereConditionSQL(config->where, "chipInputImfile");
     388    if (where && psListLength(where->list)) {
     389        psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
    367390        psStringAppend(&query, " AND %s", whereClause);
    368391        psFree(whereClause);
    369392    }
     393    psFree(where);
    370394
    371395    // treat limit == 0 as "no limit"
     
    529553    PXOPT_LOOKUP_BOOL(faulted, config->args, "-faulted", false);
    530554
    531     // XXX does this need to be constrained so that it won't return any results
    532     // if a match chipPendingExp hasn't been registered?
     555    psMetadata *where = psMetadataAlloc();
     556    PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", false, false);
     557    // convert chip_id into a psS64
     558    if (chip_id) {
     559        if (!psMetadataAddS64(where, PS_LIST_TAIL, "chipRun.chip_id", 0, "==", (psS64)atoll(chip_id))) {
     560            psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id");
     561            psFree(where);
     562            return false;
     563        }
     564    }
     565
     566    PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false);
     567    // convert exp_id into a psS64
     568    if (exp_id) {
     569        if (!psMetadataAddS64(where, PS_LIST_TAIL, "rawExp.exp_id", 0, "==", (psS64)atoll(exp_id))) {
     570            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
     571            psFree(where);
     572            return false;
     573        }
     574    }
     575
     576    PXOPT_COPY_STR(config->args, where, "-class_id", "rawImfile.class_id", "==");
     577    PXOPT_COPY_STR(config->args, where, "-inst", "rawExp.telescope", "==");
     578    PXOPT_COPY_STR(config->args, where, "-filter", "rawExp.filter", "==");
     579
    533580    psString query = pxDataGet("chiptool_processedimfile.sql");
    534581    if (!query) {
     
    537584    }
    538585
    539     if (config->where) {
    540         psString whereClause = psDBGenerateWhereConditionSQL(config->where, "chipProcessedImfile");
     586    if (where && psListLength(where->list)) {
     587        psString whereClause = psDBGenerateWhereConditionSQL(where, "chipProcessedImfile");
    541588        psStringAppend(&query, " AND %s", whereClause);
    542589        psFree(whereClause);
    543590    }
     591    psFree(where);
    544592
    545593    if (faulted) {
Note: See TracChangeset for help on using the changeset viewer.