Changeset 25711 for trunk/ippTools/src/pstamptool.c
- Timestamp:
- Oct 1, 2009, 10:06:07 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/pstamptool.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/pstamptool.c
r25558 r25711 544 544 PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false); 545 545 PXOPT_LOOKUP_S64(exp_id, config->args, "-exp_id", false, false); 546 PXOPT_LOOKUP_S64(options, config->args, "-options", false, false); 546 547 547 548 // unless the job is being inserted with stop state require outputBase … … 568 569 fault, 569 570 exp_id, 570 outputBase 571 outputBase, 572 options 571 573 )) { 572 574 psError(PS_ERR_UNKNOWN, false, "database error"); … … 592 594 PS_ASSERT_PTR_NON_NULL(config, false); 593 595 594 PXOPT_LOOKUP_S64(req_id, config->args, "-req_id", false, false); 595 PXOPT_LOOKUP_S64(job_id, config->args, "-job_id", false, false); 596 psMetadata *where = psMetadataAlloc(); 597 PXOPT_COPY_S64(config->args, where, "-job_id", "job_id", "=="); 598 PXOPT_COPY_S64(config->args, where, "-req_id", "req_id", "=="); 599 PXOPT_COPY_S64(config->args, where, "-fault", "fault", "=="); 596 600 597 601 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 598 602 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 599 603 600 psString query = NULL; 601 602 if (!req_id && !job_id) { 603 fprintf(stderr, "either req_id or job_id must be specified\n"); 604 if (!psListLength(where->list)) { 605 fprintf(stderr, "search arguments are required\n"); 604 606 exit (1); 605 607 } 606 608 607 if (req_id) { 608 psStringAppend(&query, 609 "SELECT" 610 " pstampJob.*, pstampRequest.name, pstampRequest.outProduct" 611 " FROM pstampJob" 612 " JOIN pstampRequest USING(req_id)" 613 " WHERE req_id = %" PRId64, req_id 614 ); 615 } else { 616 psStringAppend(&query, 617 "SELECT" 618 " pstampJob.*, pstampRequest.name, pstampRequest.outProduct" 619 " FROM pstampJob" 620 " JOIN pstampRequest USING(req_id)" 621 " WHERE job_id = %" PRId64, job_id 622 ); 623 } 609 psString query = pxDataGet("pstamptool_listjob.sql"); 610 if (!query) { 611 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 612 return false; 613 } 614 615 // use psDBGenerateWhereSQL because the SQL yields an intermediate table 616 if (psListLength(where->list)) { 617 psString whereClause = psDBGenerateWhereConditionSQL(where, "pstampJob"); 618 psStringAppend(&query, " WHERE %s", whereClause); 619 psFree(whereClause); 620 } 621 psFree(where); 624 622 625 623 // treat limit == 0 as "no limit"
Note:
See TracChangeset
for help on using the changeset viewer.
