IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 13, 2008, 11:21:45 AM (18 years ago)
Author:
eugene
Message:

cleanup command-line argument handling; deprecate config.where

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20080706/ippTools/src/stacktool.c

    r18336 r18496  
    524524    PS_ASSERT_PTR_NON_NULL(config, false);
    525525
     526    psMetadata *where = psMetadataAlloc();
     527    PXOPT_COPY_S64(config->args, where, "-warp_id", "warp_id", "==");
     528    PXOPT_COPY_S64(config->args, where, "-stack_id", "stack_id", "==");
     529
    526530    PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
    527531    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
     
    533537    }
    534538
    535     if (config->where) {
    536         psString whereClause = psDBGenerateWhereConditionSQL(config->where, "stackInputSkyfile");
     539    if (psListLength(where->list)) {
     540        psString whereClause = psDBGenerateWhereConditionSQL(where, "stackInputSkyfile");
    537541        psStringAppend(&query, " AND %s", whereClause);
    538542        psFree(whereClause);
    539543    }
     544    psFree(where);
    540545
    541546    // treat limit == 0 as "no limit"
     
    592597    PS_ASSERT_PTR_NON_NULL(config, false);
    593598
     599    psMetadata *where = psMetadataAlloc();
     600    PXOPT_COPY_S64(config->args, where, "-warp_id", "warp_id", "==");
     601    PXOPT_COPY_S64(config->args, where, "-stack_id", "stack_id", "==");
     602
    594603    PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
    595604    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
     
    601610    }
    602611
    603     if (config->where) {
    604         psString whereClause = psDBGenerateWhereConditionSQL(config->where, "stackSumSkyfile");
     612    if (psListLength(where->list)) {
     613        psString whereClause = psDBGenerateWhereConditionSQL(where, "stackSumSkyfile");
    605614        psStringAppend(&query, " AND %s", whereClause);
    606615        psFree(whereClause);
    607616    }
     617    psFree(where);
    608618
    609619    // treat limit == 0 as "no limit"
     
    723733    PS_ASSERT_PTR_NON_NULL(config, false);
    724734
     735    psMetadata *where = psMetadataAlloc();
     736    PXOPT_COPY_S64(config->args, where, "-warp_id", "warp_id", "==");
     737    PXOPT_COPY_S64(config->args, where, "-stack_id", "stack_id", "==");
     738
    725739    PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
    726740    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
     
    732746    }
    733747
    734     if (config->where) {
    735         psString whereClause = psDBGenerateWhereConditionSQL(config->where, "stackSumSkyfile");
     748    if (psListLength(where->list)) {
     749        psString whereClause = psDBGenerateWhereConditionSQL(where, "stackSumSkyfile");
    736750        psStringAppend(&query, " AND %s", whereClause);
    737751        psFree(whereClause);
    738752    }
     753    psFree(where);
    739754
    740755    // treat limit == 0 as "no limit"
     
    790805    PS_ASSERT_PTR_NON_NULL(config, false);
    791806
     807    psMetadata *where = psMetadataAlloc();
     808    PXOPT_COPY_S64(config->args, where, "-stack_id", "stack_id", "==");
     809    PXOPT_COPY_S16(config->args, where, "-code", "fault", "==");
     810
    792811    psString query = pxDataGet("stacktool_revertsumskyfile.sql");
    793812    if (!query) {
     
    796815    }
    797816
    798     if (config->where) {
    799         psString whereClause = psDBGenerateWhereConditionSQL(config->where, "stackSumSkyfile");
     817    if (psListLength(where->list)) {
     818        psString whereClause = psDBGenerateWhereConditionSQL(where, "stackSumSkyfile");
    800819        psStringAppend(&query, " AND %s", whereClause);
    801820        psFree(whereClause);
    802821    }
     822    psFree(where);
    803823
    804824    if (!p_psDBRunQuery(config->dbh, query)) {
Note: See TracChangeset for help on using the changeset viewer.