IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 30, 2012, 2:49:37 PM (14 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/eam_branches/ipp-20111122/ippTools/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20111122/ippTools/src

  • branches/eam_branches/ipp-20111122/ippTools/src/pstamptool.c

    r32851 r33638  
    704704    PXOPT_LOOKUP_S16(fault,       config->args, "-fault",      false, false);
    705705    PXOPT_LOOKUP_S64(exp_id,      config->args, "-exp_id",     false, false);
    706     PXOPT_LOOKUP_S64(options,     config->args, "-options",     false, false);
     706    PXOPT_LOOKUP_S64(options,     config->args, "-options",    false, false);
    707707    PXOPT_LOOKUP_S64(dep_id,      config->args, "-dep_id",     false, false);
     708    PXOPT_LOOKUP_S64(parent_id,   config->args, "-parent_id",  false, false);
     709    PXOPT_LOOKUP_BOOL(is_parent,  config->args, "-is_parent",  false);
    708710
    709711    // unless the job is being inserted with stop state require outputBase
     
    716718    if (!strcmp(job_type, "get_image") || !strcmp(job_type, "detect_query") || !strcmp(job_type, "none")) {
    717719        stampJob = false;
     720    } else if (!strcmp(job_type, "child")) {
     721        // job_type child's only action is to resolve a dependent
     722        // XXX: IS this necessary?
     723        if (!dep_id) {
     724            psError(PS_ERR_UNKNOWN, true, "dep_id required for child job\n");
     725            return false;
     726        }
     727        if (is_parent) {
     728            psError(PS_ERR_UNKNOWN, true, "job type child can not be a parent job\n");
     729            return false;
     730        }
     731        stampJob = false;
     732    } else if (!strcmp(job_type, "mosaic")) {
     733        stampJob = false;
     734        is_parent = true;
    718735    } else if (!strcmp(job_type, "stamp")) {
    719736        stampJob = true;
     
    723740    }
    724741    if (!pstampJobInsert(config->dbh,
    725             0, // job_id
     742            0,          // job_id
    726743            req_id,
    727744            rownum,
     
    733750            options,
    734751            dep_id,
    735             0   // fault_count
     752            0,          // fault_count
     753            parent_id,
     754            is_parent
    736755            )) {
    737756        psError(PS_ERR_UNKNOWN, false, "database error");
     
    761780    PXOPT_COPY_S64(config->args, where, "-req_id", "req_id", "==");
    762781    PXOPT_COPY_S64(config->args, where, "-dep_id", "dep_id", "==");
     782    PXOPT_COPY_STR(config->args, where, "-jobType", "jobType", "==");
    763783    PXOPT_COPY_S64(config->args, where, "-fault",  "fault", "==");
    764784
     
    842862
    843863    // use psDBGenerateWhereSQL because the SQL yields an intermediate table
     864    psString whereStr = NULL;
    844865    if (psListLength(where->list)) {
    845866        psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
    846         psStringAppend(&query, " AND %s", whereClause);
     867        psStringAppend(&whereStr, "\n AND %s", whereClause);
    847868        psFree(whereClause);
     869    } else {
     870        psStringAppend(&whereStr, "%s", "");
    848871    }
    849872    psFree(where);
     
    858881    }
    859882
    860     if (!p_psDBRunQuery(config->dbh, query)) {
    861         psError(PS_ERR_UNKNOWN, false, "database error");
    862         psFree(query);
    863         return false;
    864     }
     883    if (!p_psDBRunQueryF(config->dbh, query, whereStr, whereStr)) {
     884        psError(PS_ERR_UNKNOWN, false, "database error");
     885        psFree(whereStr);
     886        psFree(query);
     887        return false;
     888    }
     889    psFree(whereStr);
    865890    psFree(query);
    866891
     
    956981
    957982    PXOPT_LOOKUP_S32(fault,  config->args, "-set_fault",  true, false);
     983    PXOPT_LOOKUP_STR(state,  config->args, "-set_state",  false, false);
    958984
    959985    psMetadata *where = psMetadataAlloc();
     
    9861012    psFree(where);
    9871013
    988     if (!p_psDBRunQueryF(config->dbh, query, fault, fault)) {
     1014    if (!p_psDBRunQueryF(config->dbh, query, fault, fault, state)) {
    9891015        psError(PS_ERR_UNKNOWN, false, "database error");
    9901016        psFree(query);
Note: See TracChangeset for help on using the changeset viewer.