IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 28294


Ignore:
Timestamp:
Jun 10, 2010, 12:16:21 PM (16 years ago)
Author:
bills
Message:

Add timestamp to pstampRequest

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/dbconfig/changes.txt

    r28196 r28294  
    17551755       KEY(minidvodb_id), CONSTRAINT UNIQUE(minidvodb_id), FOREIGN KEY(minidvodb_id) REFERENCES minidvodbRun (minidvodb_id)
    17561756) ENGINE=innodb DEFAULT CHARSET=latin1;
     1757
     1758ALTER TABLE pstampRequest ADD COLUMN timestamp TIMESTAMP AFTER outdir;
  • trunk/dbconfig/pstamp.md

    r28106 r28294  
    3131    uri         STR         255
    3232    outdir      STR         255
     33    timestamp   UTC         0001-01-01T00:00:00Z
    3334    fault       S32         0
    3435END
  • trunk/ippTools/share/pxadmin_create_tables.sql

    r28106 r28294  
    13641364        uri VARCHAR(255),
    13651365        outdir     VARCHAR(255),
     1366        timestamp TIMESTAMP,
    13661367        fault SMALLINT,
    13671368        PRIMARY KEY(req_id),
  • trunk/ippTools/src/pstamptool.c

    r28146 r28294  
    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", "==");
     
    559565    }
    560566
    561     psString query = psStringCopy("UPDATE pstampRequest SET");
     567    psString query = psStringCopy("UPDATE pstampRequest SET timestamp = UTC_TIMESTAMP()");
    562568
    563569    psString stateCheck = NULL;
    564     char c = ' ';
    565570    if (state) {
    566         psStringAppend(&query, "%c state = '%s'", c, state);
    567         c = ',';
     571        psStringAppend(&query, ", state = '%s'", state);
    568572        if (!strcmp(state, "goto_cleaned")) {
    569573            psStringAppend(&stateCheck, " AND state != 'cleaned'");
     
    571575    }
    572576    if (label) {
    573         psStringAppend(&query, "%c label = '%s'", c, label);
    574         c = ',';
     577        psStringAppend(&query, ", label = '%s'", label);
    575578    }
    576579    if (outProduct) {
    577         psStringAppend(&query, "%c outProduct = '%s'", c, outProduct);
    578         c = ',';
     580        psStringAppend(&query, ", outProduct = '%s'", outProduct);
    579581    }
    580582    if (outdir) {
    581         psStringAppend(&query, "%c outdir = '%s'", c, outdir);
    582         c = ',';
     583        psStringAppend(&query, ", outdir = '%s'", outdir);
    583584    }
    584585    if (clearfault) {
     
    587588            return false;
    588589        }
    589         psStringAppend(&query, "%c fault = 0", c);
    590         c = ',';
     590        psStringAppend(&query, ", fault = 0");
    591591    } else if (fault) {
    592         psStringAppend(&query, "%c fault = %d", c, fault);
    593         c = ',';
     592        psStringAppend(&query, ", fault = %d", fault);
    594593    }
    595594    if (uri) {
    596         psStringAppend(&query, "%c uri = '%s'", c, uri);
    597         c = ',';
     595        psStringAppend(&query, ", uri = '%s'", uri);
    598596    }
    599597    if (name) {
    600         psStringAppend(&query, "%c name = '%s'", c, name);
    601         c = ',';
     598        psStringAppend(&query, ", name = '%s'", name);
    602599    }
    603600    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;
     601        psStringAppend(&query, ", reqType = '%s'", reqType);
    610602    }
    611603
Note: See TracChangeset for help on using the changeset viewer.