IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 23544


Ignore:
Timestamp:
Mar 26, 2009, 8:58:47 AM (17 years ago)
Author:
eugene
Message:

add dateobs range to pendingimfile; add user_1 as option for updateprocessedimfile

File:
1 edited

Legend:

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

    r23500 r23544  
    319319
    320320    psMetadata *where = psMetadataAlloc();
    321     PXOPT_COPY_S64(config->args, where,  "-exp_id", "exp_id", "==");
    322     PXOPT_COPY_STR(config->args, where,  "-exp_name", "exp_name", "==");
    323     PXOPT_COPY_STR(config->args, where,  "-class_id", "class_id", "==");
     321    PXOPT_COPY_S64(config->args, where,  "-exp_id",        "exp_id",   "==");
     322    PXOPT_COPY_STR(config->args, where,  "-exp_name",      "exp_name", "==");
     323    PXOPT_COPY_STR(config->args, where,  "-class_id",      "class_id", "==");
     324    PXOPT_COPY_TIME(config->args, where, "-dateobs_begin", "dateobs",  ">=");
     325    PXOPT_COPY_TIME(config->args, where, "-dateobs_end",   "dateobs",  "<=");
    324326
    325327    PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
     
    447449    PS_ASSERT_PTR_NON_NULL(config, false);
    448450
     451    PXOPT_LOOKUP_S64(exp_id, config->args, "-exp_id", true, false);
     452    PXOPT_LOOKUP_STR(class_id, config->args, "-class_id", true, false);
     453
     454    PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
     455    PXOPT_LOOKUP_F64(user_1, config->args, "-user_1", false, false);
     456
     457    if ((code == INT16_MAX) && !isfinite(user_1)) {
     458        psError(PS_ERR_UNKNOWN, false, "one of -code or -user_1 must be selected");
     459        return false;
     460    }
     461    if ((code != INT16_MAX) && isfinite(user_1)) {
     462        psError(PS_ERR_UNKNOWN, false, "only one of -code or -user_1 must be selected");
     463        return false;
     464    }
     465
    449466    psMetadata *where = psMetadataAlloc();
    450467    PXOPT_COPY_S64(config->args, where,  "-exp_id",       "exp_id", "==");
    451468    PXOPT_COPY_STR(config->args, where,  "-class_id",     "class_id", "==");
    452469
    453     PXOPT_LOOKUP_S16(code, config->args, "-code", true, false);
    454 
    455     if (!pxSetFaultCode(config->dbh, "rawImfile", where, code)) {
    456         psError(PS_ERR_UNKNOWN, false, "failed to set set fault flag");
    457         psFree (where);
    458         return false;
     470    if (code != INT16_MAX) {
     471        // this is fairly dangerous : can set all if the where is not set...
     472        if (!pxSetFaultCode(config->dbh, "rawImfile", where, code)) {
     473            psError(PS_ERR_UNKNOWN, false, "failed to set set fault flag");
     474            psFree (where);
     475            return false;
     476        }
     477    }
     478
     479    if (isfinite(user_1)) {
     480        psString query = pxDataGet("regtool_updateprocessedimfile.sql");
     481        if (!query) {
     482            psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     483            return false;
     484        }
     485
     486        if (!p_psDBRunQueryF(config->dbh, query, user_1, exp_id, class_id)) {
     487            psError(PS_ERR_UNKNOWN, false, "database error");
     488            psFree(query);
     489            return false;
     490        }
     491        psFree(query);
    459492    }
    460493    psFree (where);
Note: See TracChangeset for help on using the changeset viewer.