IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10768


Ignore:
Timestamp:
Dec 15, 2006, 5:13:17 PM (20 years ago)
Author:
jhoblitt
Message:

implement -addinputimfile

File:
1 edited

Legend:

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

    r10756 r10768  
    233233    PS_ASSERT_PTR_NON_NULL(config, NULL);
    234234
     235    bool status = false;
     236    psString p4_id = psMetadataLookupStr(&status, config->args, "-p4_id");
     237    if (!status) {
     238        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -p4_id");
     239        return false;
     240    }
     241    if (!p4_id) {
     242        psError(PS_ERR_UNKNOWN, true, "-p4_id is required");
     243        return false;
     244    }
     245
     246    psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
     247    if (!status) {
     248        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
     249        return false;
     250    }
     251    if (!exp_tag) {
     252        psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
     253        return false;
     254    }
     255
     256    psString class_id = psMetadataLookupStr(&status, config->args, "-class_id");
     257    if (!status) {
     258        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -class_id");
     259        return false;
     260    }
     261    if (!class_id) {
     262        psError(PS_ERR_UNKNOWN, true, "-class_id is required");
     263        return false;
     264    }
     265
     266    // defaults to 0
     267    psS32 p3_version = psMetadataLookupS32(&status, config->args, "-p3_version");
     268    if (!status) {
     269        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -p3_version");
     270        return false;
     271    }
     272
     273    // XXX need to validate the p4_id here
     274    if (!p4InputImfileInsert(config->dbh,
     275            (psS32)atoi(p4_id),
     276            exp_tag,
     277            p3_version,
     278            class_id
     279        )) {
     280        psError(PS_ERR_UNKNOWN, false, "database error");
     281        return false;
     282    }
     283
    235284    return true;
    236285}
Note: See TracChangeset for help on using the changeset viewer.