IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 10, 2008, 5:04:43 PM (18 years ago)
Author:
bills
Message:

changed to support get_image (no postage stamp) jobs

File:
1 edited

Legend:

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

    r16596 r16931  
    290290
    291291    char *query ="INSERT INTO pstampRequest"
    292                  " (state, uri, ds_id, outFileset)"
    293                  " VALUES( 'new', '%s', %s, '%s')";
     292                 " (state, uri, ds_id, outFileset, resultsFile)"
     293                 " VALUES( 'new', '%s', %s, '%s', 1)";
    294294
    295295    if (!p_psDBRunQuery(config->dbh, query, uri, ds_id, outFileset)) {
     
    433433{
    434434    bool    status;
    435 
    436     PS_ASSERT_PTR_NON_NULL(config, false);
     435    bool    stampJob = false;
     436
     437    PS_ASSERT_PTR_NON_NULL(config, false);
     438
     439    psString job_type = psMetadataLookupStr(&status, config->args, "-job_type");
     440    if (!status) {
     441        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -job_type");
     442        return false;
     443    }
     444    if (job_type) {
     445        if (!strcmp(job_type, "get_image")) {
     446            stampJob = false;
     447        } else if (!strcmp(job_type, "stamp")) {
     448            stampJob = true;
     449        } else {
     450            psError(PS_ERR_UNKNOWN, false, "unknown value for -job_type: %s", job_type);
     451            return false;
     452        }
     453    } else {
     454        job_type = "stamp";
     455        stampJob = true;
     456    }
    437457
    438458    psString uri = psMetadataLookupStr(&status, config->args, "-uri");
     
    472492    }
    473493    if (!argString) {
    474         psError(PS_ERR_UNKNOWN, true, "-args is required");
    475         return false;
    476     }
    477 
    478     char *query ="INSERT INTO pstampJob"
    479                  " (req_id, state, uri, outputBase, args)"
     494        if (stampJob) {
     495            psError(PS_ERR_UNKNOWN, true, "-args is required");
     496            return false;
     497        }
     498    }
     499
     500    char *query;
     501   
     502    if (stampJob) {
     503        query ="INSERT INTO pstampJob"
     504                 " (req_id, state, jobType, uri, outputBase, args)"
     505                 " VALUES( %s, 'run', '%s', '%s', '%s', '%s')";
     506    } else {
     507        query ="INSERT INTO pstampJob"
     508                 " (req_id, state, jobType, uri, outputBase)"
    480509                 " VALUES( %s, 'run', '%s', '%s', '%s')";
    481 
    482     if (!p_psDBRunQuery(config->dbh, query, req_id, uri, outputBase, argString)) {
    483         psError(PS_ERR_UNKNOWN, false, "database error");
    484         psFree(query);
     510    }
     511
     512    if (!p_psDBRunQuery(config->dbh, query, req_id, job_type, uri, outputBase, argString)) {
     513        psError(PS_ERR_UNKNOWN, false, "database error");
    485514        return false;
    486515    }
Note: See TracChangeset for help on using the changeset viewer.