IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 9395


Ignore:
Timestamp:
Oct 6, 2006, 7:08:58 PM (20 years ago)
Author:
jhoblitt
Message:

fix -select & -search SQL where generation

Location:
trunk/ippTools/src
Files:
2 edited

Legend:

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

    r9392 r9395  
    160160
    161161    if (config->where) {
    162         psString whereClause = psDBGenerateWhereConditionSQL(config->where, NULL);
     162        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "detNormalizedImfile");
    163163        psStringAppend(&query, " AND %s", whereClause);
    164164        psFree(whereClause);
  • trunk/ippTools/src/detselectConfig.c

    r9392 r9395  
    136136    } \
    137137}
     138#define addWhereS32(name) \
     139{ \
     140    psS32 s32 = 0; \
     141    bool status = false; \
     142    if ((s32= psMetadataLookupS32(&status, config->args, "-" #name))) { \
     143        if (!psMetadataAddS32(config->where, PS_LIST_TAIL, #name, 0, "==", s32)) { \
     144            psError(PS_ERR_UNKNOWN, false, "failed to add item " #name); \
     145            goto FAIL; \
     146        } \
     147    } \
     148}
     149
     150#define addWhereF32(name) \
     151{ \
     152    psF32 var = 0; \
     153    bool status = false; \
     154    if (!isnan(psMetadataLookupF32(&status, config->args, "-" #name))) { \
     155        if (!psMetadataAddF32(config->where, PS_LIST_TAIL, #name, 0, "==", var)) { \
     156            psError(PS_ERR_UNKNOWN, false, "failed to add item " #name); \
     157            goto FAIL; \
     158        } \
     159    } \
     160}
     161
     162#define addWhereF64(name) \
     163{ \
     164    psF64 var = 0; \
     165    bool status = false; \
     166    if (!isnan(psMetadataLookupF64(&status, config->args, "-" #name))) { \
     167        if (!psMetadataAddF64(config->where, PS_LIST_TAIL, #name, 0, "==", var)) { \
     168            psError(PS_ERR_UNKNOWN, false, "failed to add item " #name); \
     169            goto FAIL; \
     170        } \
     171    } \
     172}
    138173
    139174    // generate SQL where clause
    140175    config->where = psMetadataAlloc();
    141176
     177    addWhereStr(det_id);
     178    addWhereS32(iteration);
    142179    addWhereStr(exp_tag);
    143180    // convert '-inst' to 'camera'
     
    154191    addWhereStr(telescope);
    155192    addWhereStr(exp_type);
    156     {
    157         int imfiles = 0;
    158         bool status = false;
    159         if ((imfiles = psMetadataLookupS32(&status, config->args, "-imfiles"))) {
    160             if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "imfiles", 0, "==", imfiles)) {
    161                 psError(PS_ERR_UNKNOWN, false, "failed to add item imfiles");
    162                 goto FAIL;
    163             }
    164         }
    165     }
     193    addWhereStr(det_type);
     194    addWhereS32(imfiles);
    166195    addWhereStr(class);
    167196    addWhereStr(class_id);
    168197    addWhereStr(filter);
     198    addWhereF32(exp_time);
     199    addWhereF64(ccd_temp);
     200    addWhereF32(airmass);
    169201
    170202    if (config->where->list->n < 1) {
Note: See TracChangeset for help on using the changeset viewer.