IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 24, 2010, 2:59:09 PM (16 years ago)
Author:
Paul Price
Message:

Merging trunk in advance of reintegrating into trunk.

Location:
branches/pap
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/pap

  • branches/pap/ippTools/src

    • Property svn:ignore
      •  

        old new  
        3939warptool
        4040staticskytool
        41 
        4241bgtool
         42diffphottool
  • branches/pap/ippTools/src/pstamptool.c

    r28146 r28484  
    271271        uri,
    272272        NULL,   // outdir
     273        NULL,   // timestamp
    273274        0       // fault
    274275        )) {
     
    547548    PXOPT_LOOKUP_BOOL(clearfault,config->args, "-clearfault",    false);
    548549
     550    if (!state && !label && !outProduct && !fault && !uri && !outdir && !name && !reqType && !clearfault) {
     551        psError(PS_ERR_UNKNOWN, true, "at least one set option is required");
     552        return false;
     553    }
     554
    549555    psMetadata *where = psMetadataAlloc();
    550556    PXOPT_COPY_S64(config->args, where, "-req_id",     "req_id", "==");
     
    552558    PXOPT_COPY_S32(config->args, where, "-fault",      "fault", "==");
    553559    PXOPT_COPY_STR(config->args, where, "-state",      "state", "==");
     560    PXOPT_COPY_TIME(config->args, where, "-timestamp_begin", "timestamp", ">=");
     561    PXOPT_COPY_TIME(config->args, where, "-timestamp_end", "timestamp", "<=");
    554562    pxAddLabelSearchArgs(config, where, "-label",      "pstampRequest.label", "LIKE");
    555563    if (!psListLength(where->list)) {
     
    559567    }
    560568
    561     psString query = psStringCopy("UPDATE pstampRequest SET");
     569    psString query = psStringCopy("UPDATE pstampRequest SET timestamp = UTC_TIMESTAMP()");
    562570
    563571    psString stateCheck = NULL;
    564     char c = ' ';
    565572    if (state) {
    566         psStringAppend(&query, "%c state = '%s'", c, state);
    567         c = ',';
     573        psStringAppend(&query, ", state = '%s'", state);
    568574        if (!strcmp(state, "goto_cleaned")) {
    569575            psStringAppend(&stateCheck, " AND state != 'cleaned'");
     
    571577    }
    572578    if (label) {
    573         psStringAppend(&query, "%c label = '%s'", c, label);
    574         c = ',';
     579        psStringAppend(&query, ", label = '%s'", label);
    575580    }
    576581    if (outProduct) {
    577         psStringAppend(&query, "%c outProduct = '%s'", c, outProduct);
    578         c = ',';
     582        psStringAppend(&query, ", outProduct = '%s'", outProduct);
    579583    }
    580584    if (outdir) {
    581         psStringAppend(&query, "%c outdir = '%s'", c, outdir);
    582         c = ',';
     585        psStringAppend(&query, ", outdir = '%s'", outdir);
    583586    }
    584587    if (clearfault) {
     
    587590            return false;
    588591        }
    589         psStringAppend(&query, "%c fault = 0", c);
    590         c = ',';
     592        psStringAppend(&query, ", fault = 0");
    591593    } else if (fault) {
    592         psStringAppend(&query, "%c fault = %d", c, fault);
    593         c = ',';
     594        psStringAppend(&query, ", fault = %d", fault);
    594595    }
    595596    if (uri) {
    596         psStringAppend(&query, "%c uri = '%s'", c, uri);
    597         c = ',';
     597        psStringAppend(&query, ", uri = '%s'", uri);
    598598    }
    599599    if (name) {
    600         psStringAppend(&query, "%c name = '%s'", c, name);
    601         c = ',';
     600        psStringAppend(&query, ", name = '%s'", name);
    602601    }
    603602    if (reqType) {
    604         psStringAppend(&query, "%c reqType = '%s'", c, reqType);
    605         c = ',';
    606     }
    607     if (c != ',') {
    608         psError(PS_ERR_UNKNOWN, true, "at least one set option is required");
    609         return false;
     603        psStringAppend(&query, ", reqType = '%s'", reqType);
    610604    }
    611605
     
    876870
    877871    PXOPT_LOOKUP_S64(job_id,    config->args, "-job_id", false, false);
     872    PXOPT_LOOKUP_S64(req_id,    config->args, "-req_id", false, false);
    878873    PXOPT_LOOKUP_S64(dep_id,    config->args, "-dep_id", false, false);
    879874
    880     if (!job_id && !dep_id) {
    881         psError(PS_ERR_UNKNOWN, true, "at least -job_id or -dep_id is required");
     875    if (!job_id && !req_id && !dep_id) {
     876        psError(PS_ERR_UNKNOWN, true, "at least one of -job_id -req_id or -dep_id is required");
    882877        return false;
    883878    }
     
    894889
    895890    PXOPT_COPY_S64(config->args, where, "-job_id", "job_id", "==");
     891    PXOPT_COPY_S64(config->args, where, "-req_id", "req_id", "==");
    896892    PXOPT_COPY_S64(config->args, where, "-dep_id", "dep_id", "==");
     893    PXOPT_COPY_STR(config->args, where, "-state",  "pstampJob.state", "==");
    897894
    898895    psString query = pxDataGet("pstamptool_updatejob.sql");
Note: See TracChangeset for help on using the changeset viewer.