IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7299


Ignore:
Timestamp:
Jun 2, 2006, 11:26:36 AM (20 years ago)
Author:
jhoblitt
Message:

make -define mode -exp_id & -det_type required

Location:
trunk/ippTools/src
Files:
2 edited

Legend:

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

    r7293 r7299  
    100100{
    101101    bool status     = false;
    102     psString str    = NULL;
    103102
    104103    PS_ASSERT_PTR_NON_NULL(config, false);
     104
     105    // what type of detRun is this?
     106    psString det_type = psMetadataLookupStr(&status, config->args, "-det_type");
     107    // this flag is required
     108    if (!det_type) {
     109        psError(PS_ERR_UNKNOWN, true, "-det_type is required");
     110        return false;
     111    }   
    105112
    106113    // start a transaction so we don't end up with orphaned det_ids
     
    109116        return false;
    110117    }
    111 
    112     // what type of detRun is this?
    113     // XXX make this flag required
    114     psString det_type = psMetadataLookupStr(&status, config->args, "-det_type");
    115118    detRunInsert(config->dbh, det_type);
    116119    long det_id = psDBLastInsertID(config->dbh);
     
    120123    psMetadata *where = psMetadataAlloc();
    121124
    122     // was more then one exp_id specified?
     125    // make sure that -exp_id was parsed correctly
     126    // XXX this can be removed someday
    123127    if (item->type == PS_DATA_METADATA_MULTI) {
    124         // yes
    125128        psListIterator *iter = psListIteratorAlloc(item->data.list, 0, false);
    126129        psMetadataItem *mItem = NULL;
    127130        while ((mItem = psListGetAndIncrement(iter))) {
    128131            psString exp_id = mItem->data.V;
     132            // if exp_id is NULL then it means that -exp_id has not specified
     133            if (!exp_id) {
     134                psError(PS_ERR_UNKNOWN, true,
     135                        "at least one -exp_id is required");
     136                // rollback
     137                if (!psDBRollback(config->dbh)) {
     138                    psError(PS_ERR_UNKNOWN, false, "database error");
     139                }
     140                psFree(where);
     141                return false;
     142            }
     143
    129144            if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id",
    130145                        PS_META_DUPLICATE_OK, "==", exp_id)) {
     
    139154            }
    140155        }
    141     } else if ((str = psMetadataLookupStr(&status, config->args, "-exp_id"))) {
    142         // no
    143         if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==", str)) {
    144             psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
    145             // rollback
    146             if (!psDBRollback(config->dbh)) {
    147                 psError(PS_ERR_UNKNOWN, false, "database error");
    148             }
    149             psFree(where);
    150             return false;
    151         }
     156    } else {
     157        // rollback
     158        if (!psDBRollback(config->dbh)) {
     159            psError(PS_ERR_UNKNOWN, false, "database error");
     160        }
     161        psAbort(config->argv[0],
     162                "-exp_id was not parsed correctly (this should not happen");
    152163    }
    153164
  • trunk/ippTools/src/dettoolConfig.c

    r7293 r7299  
    2424    psMetadata *defineArgs = psMetadataAlloc();
    2525    psMetadataAddStr(defineArgs, PS_LIST_TAIL, "-exp_id",  PS_META_DUPLICATE_OK,
    26         "include this exposure (XXX more then one)", NULL);
     26        "include this exposure (multiple OK, required)", NULL);
    2727    psMetadataAddStr(defineArgs, PS_LIST_TAIL, "-det_type",  0,
    28         "define the type of detrend run", NULL);
     28        "define the type of detrend run (required)", NULL);
    2929
    3030    // -runs
Note: See TracChangeset for help on using the changeset viewer.