IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 21, 2008, 6:50:18 PM (18 years ago)
Author:
bills
Message:

Various updates

File:
1 edited

Legend:

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

    r16544 r16596  
    106106        return false;
    107107    }
     108    psString outProduct = psMetadataLookupStr(&status, config->args, "-out_product");
     109    if (!status) {
     110        psError(PS_ERR_UNKNOWN, false, "failed to looku value for -out_product");
     111        return false;
     112    }
     113    if (!outProduct) {
     114        psError(PS_ERR_UNKNOWN, true, "-out_product is required");
     115        return false;
     116    }
    108117
    109118    psString lastFileset = psMetadataLookupStr(&status, config->args, "-last_fileset");
     
    115124    if (!pstampDataStoreInsert(config->dbh,
    116125            0,
    117             uri,
     126            state,
    118127            lastFileset,
    119             state
     128            outProduct,
     129            uri
    120130        )) {
    121131        psError(PS_ERR_UNKNOWN, false, "database error");
     
    128138static bool datastoreMode(pxConfig *config)
    129139{
    130     PS_ASSERT_PTR_NON_NULL(config, false);
    131 
    132     if (!p_psDBRunQuery(config->dbh, "SELECT * FROM pstampDataStore")) {
     140    bool status = false;
     141    PS_ASSERT_PTR_NON_NULL(config, false);
     142
     143    psString ds_id = psMetadataLookupStr(&status, config->args, "-ds_id");
     144    if (!status) {
     145        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -ds_id");
     146        return false;
     147    }
     148
     149    psString query = NULL;
     150    psStringAppend(&query, "SELECT * FROM pstampDataStore");
     151    if (ds_id) {
     152        psStringAppend(&query, " WHERE ds_id = '%s'", ds_id);
     153    }
     154    if (!p_psDBRunQuery(config->dbh, query)) {
    133155        psError(PS_ERR_UNKNOWN, false, "database error");
    134156        return false;
     
    194216
    195217    if (!state && !lastFileset) {
    196         psError(PS_ERR_UNKNOWN, true, "one of -last_fileset or -state is required");
     218        psError(PS_ERR_UNKNOWN, true, "at least one of -last_fileset or -state is required");
    197219        return false;
    198220    }
     
    247269        return false;
    248270    }
     271    psString outFileset = psMetadataLookupStr(&status, config->args, "-out_fileset");
     272    if (!status) {
     273        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -out_fileset");
     274        return false;
     275    }
     276    if (!outFileset) {
     277        psError(PS_ERR_UNKNOWN, true, "-out_fileset is required");
     278        return false;
     279    }
    249280
    250281    // Data Store ID is optional
     
    259290
    260291    char *query ="INSERT INTO pstampRequest"
    261                  " (state, uri, ds_id)"
    262                  " VALUES( 'new', '%s', %s)";
    263 
    264     if (!p_psDBRunQuery(config->dbh, query, uri, ds_id)) {
    265         psError(PS_ERR_UNKNOWN, false, "database error");
    266         psFree(query);
     292                 " (state, uri, ds_id, outFileset)"
     293                 " VALUES( 'new', '%s', %s, '%s')";
     294
     295    if (!p_psDBRunQuery(config->dbh, query, uri, ds_id, outFileset)) {
     296        psError(PS_ERR_UNKNOWN, false, "database error");
    267297        return false;
    268298    }
Note: See TracChangeset for help on using the changeset viewer.