IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 10, 2009, 11:56:40 AM (17 years ago)
Author:
bills
Message:

allow pstampRequest.name to be set when adding a request
add -not_req_id option to -listreq mode to aid in discovering whether
a request with a given name already exists

File:
1 edited

Legend:

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

    r25281 r25316  
    226226    PS_ASSERT_PTR_NON_NULL(config, false);
    227227
    228     PXOPT_LOOKUP_STR(uri,         config->args, "-uri",           true, false);
    229     // PXOPT_LOOKUP_STR(outFileset,  config->args, "-out_fileset",   true, false);
    230     PXOPT_LOOKUP_S64(ds_id,       config->args, "-ds_id",         false, false);
    231 
    232     char *query ="INSERT INTO pstampRequest"
    233                      " (state, uri, ds_id, fault)"
    234                      " VALUES( 'new', '%s', %" PRId64 ", 0 )";
    235     if (!p_psDBRunQueryF(config->dbh, query, uri, ds_id)) {
    236         psError(PS_ERR_UNKNOWN, false, "database error");
    237         return false;
    238     }
    239 
    240     psU64 affected = psDBAffectedRows(config->dbh);
    241     if (affected != 1) {
    242         psError(PS_ERR_UNKNOWN, false,
    243             "should have affected one row but %" PRIu64 " rows were modified",
    244             affected);
     228    PXOPT_LOOKUP_STR(uri,         config->args, "-uri",   true, false);
     229    PXOPT_LOOKUP_STR(name,        config->args, "-name",  false, false);
     230    PXOPT_LOOKUP_S64(ds_id,       config->args, "-ds_id", false, false);
     231
     232    if (!pstampRequestInsert(config->dbh,
     233        0,      // req_id
     234        ds_id,
     235        "new",  //state
     236        name,
     237        NULL,   // reqType
     238        NULL,   // outProduct
     239        uri,   
     240        0       // fault
     241        )) {
     242        psError(PS_ERR_UNKNOWN, false, "failed to insert request");
    245243        return false;
    246244    }
     
    319317    psMetadata *where = psMetadataAlloc();
    320318    PXOPT_COPY_S64(config->args, where, "-req_id", "req_id", "==");
     319    PXOPT_COPY_S64(config->args, where, "-not_req_id", "req_id", "!=");
    321320    PXOPT_COPY_STR(config->args, where, "-name", "name", "==");
    322321
Note: See TracChangeset for help on using the changeset viewer.