IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 18, 2009, 11:56:59 AM (17 years ago)
Author:
bills
Message:

allow listing of requests by name as well as req_id allow job type 'none'
to help reporting errors

File:
1 edited

Legend:

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

    r25075 r25109  
    315315    PS_ASSERT_PTR_NON_NULL(config, false);
    316316
    317     PXOPT_LOOKUP_S64(req_id,  config->args, "-req_id", false, false);
    318     PXOPT_LOOKUP_STR(name,  config->args, "-name", false, false);
     317    psMetadata *where = psMetadataAlloc();
     318    PXOPT_COPY_S64(config->args, where, "-req_id", "req_id", "==");
     319    PXOPT_COPY_STR(config->args, where, "-name", "name", "==");
     320
    319321    PXOPT_LOOKUP_U64(limit,   config->args, "-limit",  false, false);
    320322    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
    321323
    322     if (!req_id && !name) {
     324    if (!psListLength(where->list)) {
    323325        psError(PS_ERR_UNKNOWN, true, "-req_id or -name must be supplied");
    324326        return false;
    325327    }
    326328
    327     psString query = NULL;
    328     psStringAppend(&query, "SELECT * from pstampRequest WHERE req_id = %" PRId64, req_id);
     329    psString query = psStringCopy("SELECT * from pstampRequest");
     330
     331    psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
     332    psStringAppend(&query, " WHERE %s", whereClause);
     333    psFree(whereClause);
     334    psFree(where);
    329335   
    330336    // treat limit == 0 as "no limit"
     
    523529
    524530    // default value for job_type is defined in pstamptoolConfig.c
    525     if (!strcmp(job_type, "get_image") || !strcmp(job_type, "detect_query")) {
     531    if (!strcmp(job_type, "get_image") || !strcmp(job_type, "detect_query") || !strcmp(job_type, "none")) {
    526532        stampJob = false;
    527533    } else if (!strcmp(job_type, "stamp")) {
Note: See TracChangeset for help on using the changeset viewer.