IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 15, 2008, 10:30:59 AM (18 years ago)
Author:
eugene
Message:

completely deprecate config->where; make all command-line handling consistent; move nearly all sql into share/*.sql; ensure consistency between args supplied and used

File:
1 edited

Legend:

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

    r18336 r18561  
    5050    // -pendingimfile
    5151    psMetadata *pendingimfileArgs = psMetadataAlloc();
    52 // support for this options is unimplemented
    53 #if 0
    54     ADD_OPT(Str,  pendingimfileArgs, "-exp_id",    "search by exposure ID", NULL);
    55     ADD_OPT(Str,  pendingimfileArgs, "-class",     "search by class",       NULL);
    56     ADD_OPT(Str,  pendingimfileArgs, "-class_id",  "search by class ID",    NULL);
    57 #endif
    5852    ADD_OPT(U64,  pendingimfileArgs, "-limit",     "limit result set to N items",  0);
    5953    ADD_OPT(Bool, pendingimfileArgs, "-simple",    "use the simple output format", false);
     
    6862    ADD_OPT(Str,  addprocessedimfileArgs, "-class_id",       "define class ID (required)",         NULL);
    6963    ADD_OPT(Str,  addprocessedimfileArgs, "-uri",            "define URI (required)",             NULL);
     64
    7065    ADD_OPT(Str,  addprocessedimfileArgs, "-exp_type",       "define exposure type",             NULL);
    7166    ADD_OPT(Str,  addprocessedimfileArgs, "-filelevel",      "define filelevel",             NULL);
    7267    ADD_OPT(Str,  addprocessedimfileArgs, "-filter",         "define filter ",                 NULL);
    7368    ADD_OPT(Str,  addprocessedimfileArgs, "-comment",        "define comment ",             NULL);
     69
    7470    ADD_OPT(F32,  addprocessedimfileArgs, "-airmass",        "define airmass",                 NAN);
    7571    ADD_OPT(F64,  addprocessedimfileArgs, "-ra",             "define RA",                 NAN);
     
    9490    ADD_OPT(F32,  addprocessedimfileArgs, "-m2_tip",         "define M2 TIP position",                NAN);
    9591    ADD_OPT(F32,  addprocessedimfileArgs, "-m2_tilt",        "define M2 TILT position",         NAN);
     92
    9693    ADD_OPT(F32,  addprocessedimfileArgs, "-env_temperature","define Environmental Temperature",     NAN);
    9794    ADD_OPT(F32,  addprocessedimfileArgs, "-env_humidity",   "define Environmental Humidity",         NAN);
     
    139136    // -pendingexp
    140137    psMetadata *pendingexpArgs = psMetadataAlloc();
    141 // support for these options in unimplemented
    142 #if 0
    143     psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-exp_id",   0,        "search by exposure ID", NULL);
    144     psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-inst",     0,        "search by camera", NULL);
    145     psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-telescope",0,        "search by telescope", NULL);
    146     psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-exp_type", 0,        "search by exposure type", NULL);
    147 #endif
    148138    psMetadataAddU64(pendingexpArgs, PS_LIST_TAIL, "-limit",    0,        "limit result set to N items", 0);
    149139    psMetadataAddBool(pendingexpArgs, PS_LIST_TAIL, "-simple",  0,        "use the simple output format", false);
     
    156146    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-telescope",        0,        "define the telescope name (required)", NULL);
    157147    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-exp_tag",          0,        "define the external exposure tag name (required)", NULL);
     148    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-filelevel",        0,        "define the data partitioning level of this file (required)", NULL);
     149
    158150    psMetadataAddTime(addprocessedexpArgs, PS_LIST_TAIL, "-dateobs",         0,        "define observation time", NULL);
    159151    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-exp_type",         0,        "define exposure type", NULL);
    160     psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-filelevel",        0,        "define the data partitioning level of this file", NULL);
    161152    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-workdir",          0,        "define the \"default\" workdir for this exposure", NULL);
    162153    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-dvodb",            0,        "define the dvodb for the next processing step", NULL);
     
    208199    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-hostname",         0,        "define host name", NULL);
    209200    psMetadataAddS16(addprocessedexpArgs, PS_LIST_TAIL, "-code",             0,        "set fault code", 0);
    210     /*
    211     psMetadataAddStr(updateArgs, PS_LIST_TAIL, "-recip",  0,        "define URL", NULL);
    212     psMetadataAddStr(updateArgs, PS_LIST_TAIL, "-mosiac",  0,        "define URL", NULL);
    213     */
    214201
    215202    // -processedexp
     
    297284    psFree(modes);
    298285
    299     // setup search criterion
    300 #define addWhereStr(name) \
    301 { \
    302     psString str = NULL; \
    303     bool status = false; \
    304     if ((str = psMetadataLookupStr(&status, config->args, "-" #name))) { \
    305         if (!psMetadataAddStr(config->where, PS_LIST_TAIL, #name, 0, "==", str)) {\
    306             psError(PXTOOLS_ERR_PROG, false, "failed to add item " #name); \
    307             psFree(config); \
    308             return NULL; \
    309         } \
    310     } \
    311 }
    312 
    313     // generate SQL where clause
    314     config->where = psMetadataAlloc();
    315 
    316     addWhereStr(exp_id);
    317     addWhereStr(exp_name);
    318     // convert '-inst' to 'camera'
    319     {
    320         psString str = NULL;
    321         bool status = false;
    322         if ((str = psMetadataLookupStr(&status, config->args, "-inst"))) {
    323             if (!psMetadataAddStr(config->where, PS_LIST_TAIL, "camera", 0, "==", str)) {
    324                 psError(PXTOOLS_ERR_PROG, false, "failed to add item camera");
    325                 psFree(config);
    326                 return NULL;
    327             }
    328         }
    329     }
    330 
    331     addWhereStr(telescope);
    332     addWhereStr(exp_type);
    333     addWhereStr(class);
    334     addWhereStr(class_id);
    335     addWhereStr(tmp_class_id);
    336     addWhereStr(filter);
    337 
    338     // convert '-code' to 'fault'
    339     {
    340         psS16 fault = 0;
    341         bool status = false;
    342         if ((fault = psMetadataLookupS16(&status, config->args, "-code"))) {
    343             if (!psMetadataAddS16(config->where, PS_LIST_TAIL, "fault", 0, "==", fault)) {
    344                 psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
    345                 psFree(config);
    346                 return NULL;
    347             }
    348         }
    349     }
    350 
    351     if (config->where->list->n < 1) {
    352         psFree(config->where);
    353         config->where = NULL;
    354     }
    355 
    356 
    357286    // define Database handle, if used
    358287    config->dbh = psMemIncrRefCounter(pmConfigDB(config->modules));
Note: See TracChangeset for help on using the changeset viewer.