Changeset 28484 for branches/pap/ippTools/src/pstamptool.c
- Timestamp:
- Jun 24, 2010, 2:59:09 PM (16 years ago)
- Location:
- branches/pap
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
ippTools/src (modified) (1 prop)
-
ippTools/src/pstamptool.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/pap
- Property svn:mergeinfo changed
-
branches/pap/ippTools/src
- Property svn:ignore
-
old new 39 39 warptool 40 40 staticskytool 41 42 41 bgtool 42 diffphottool
-
- Property svn:ignore
-
branches/pap/ippTools/src/pstamptool.c
r28146 r28484 271 271 uri, 272 272 NULL, // outdir 273 NULL, // timestamp 273 274 0 // fault 274 275 )) { … … 547 548 PXOPT_LOOKUP_BOOL(clearfault,config->args, "-clearfault", false); 548 549 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 549 555 psMetadata *where = psMetadataAlloc(); 550 556 PXOPT_COPY_S64(config->args, where, "-req_id", "req_id", "=="); … … 552 558 PXOPT_COPY_S32(config->args, where, "-fault", "fault", "=="); 553 559 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", "<="); 554 562 pxAddLabelSearchArgs(config, where, "-label", "pstampRequest.label", "LIKE"); 555 563 if (!psListLength(where->list)) { … … 559 567 } 560 568 561 psString query = psStringCopy("UPDATE pstampRequest SET ");569 psString query = psStringCopy("UPDATE pstampRequest SET timestamp = UTC_TIMESTAMP()"); 562 570 563 571 psString stateCheck = NULL; 564 char c = ' ';565 572 if (state) { 566 psStringAppend(&query, "%c state = '%s'", c, state); 567 c = ','; 573 psStringAppend(&query, ", state = '%s'", state); 568 574 if (!strcmp(state, "goto_cleaned")) { 569 575 psStringAppend(&stateCheck, " AND state != 'cleaned'"); … … 571 577 } 572 578 if (label) { 573 psStringAppend(&query, "%c label = '%s'", c, label); 574 c = ','; 579 psStringAppend(&query, ", label = '%s'", label); 575 580 } 576 581 if (outProduct) { 577 psStringAppend(&query, "%c outProduct = '%s'", c, outProduct); 578 c = ','; 582 psStringAppend(&query, ", outProduct = '%s'", outProduct); 579 583 } 580 584 if (outdir) { 581 psStringAppend(&query, "%c outdir = '%s'", c, outdir); 582 c = ','; 585 psStringAppend(&query, ", outdir = '%s'", outdir); 583 586 } 584 587 if (clearfault) { … … 587 590 return false; 588 591 } 589 psStringAppend(&query, "%c fault = 0", c); 590 c = ','; 592 psStringAppend(&query, ", fault = 0"); 591 593 } else if (fault) { 592 psStringAppend(&query, "%c fault = %d", c, fault); 593 c = ','; 594 psStringAppend(&query, ", fault = %d", fault); 594 595 } 595 596 if (uri) { 596 psStringAppend(&query, "%c uri = '%s'", c, uri); 597 c = ','; 597 psStringAppend(&query, ", uri = '%s'", uri); 598 598 } 599 599 if (name) { 600 psStringAppend(&query, "%c name = '%s'", c, name); 601 c = ','; 600 psStringAppend(&query, ", name = '%s'", name); 602 601 } 603 602 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); 610 604 } 611 605 … … 876 870 877 871 PXOPT_LOOKUP_S64(job_id, config->args, "-job_id", false, false); 872 PXOPT_LOOKUP_S64(req_id, config->args, "-req_id", false, false); 878 873 PXOPT_LOOKUP_S64(dep_id, config->args, "-dep_id", false, false); 879 874 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"); 882 877 return false; 883 878 } … … 894 889 895 890 PXOPT_COPY_S64(config->args, where, "-job_id", "job_id", "=="); 891 PXOPT_COPY_S64(config->args, where, "-req_id", "req_id", "=="); 896 892 PXOPT_COPY_S64(config->args, where, "-dep_id", "dep_id", "=="); 893 PXOPT_COPY_STR(config->args, where, "-state", "pstampJob.state", "=="); 897 894 898 895 psString query = pxDataGet("pstamptool_updatejob.sql");
Note:
See TracChangeset
for help on using the changeset viewer.
