IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 5, 2007, 3:16:08 PM (19 years ago)
Author:
jhoblitt
Message:

rename exp_id -> exp_name
rename exp_tag -> exp_id
add add rawExp.exp_tag for use as an external name only

File:
1 edited

Legend:

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

    r14018 r14023  
    8080
    8181    bool status = false;
    82     psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
    83     if (!status) {
    84         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
    85         return false;
    86     }
    87     if (!exp_id) {
    88         psError(PS_ERR_UNKNOWN, true, "-exp_id is required");
    89         return false;
    90     }
    91     psString camera = psMetadataLookupStr(&status, config->args, "-inst");
    92     if (!status) {
    93         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -inst");
    94         return false;
    95     }
    96     if (!camera) {
    97         psError(PS_ERR_UNKNOWN, true, "-inst is required");
    98         return false;
    99     }
    100     psString telescope = psMetadataLookupStr(&status, config->args, "-telescope");
    101     if (!status) {
    102         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -telescope");
    103         return false;
    104     }
    105     if (!telescope) {
    106         psError(PS_ERR_UNKNOWN, true, "-telescope is required");
     82    psString tmp_exp_name = psMetadataLookupStr(&status, config->args, "-tmp_exp_name");
     83    if (!status) {
     84        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -tmp_exp_name");
     85        return false;
     86    }
     87    if (!tmp_exp_name) {
     88        psError(PS_ERR_UNKNOWN, true, "-tmp_exp_name is required");
     89        return false;
     90    }
     91    psString tmp_camera = psMetadataLookupStr(&status, config->args, "-tmp_inst");
     92    if (!status) {
     93        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -tmp_inst");
     94        return false;
     95    }
     96    if (!tmp_camera) {
     97        psError(PS_ERR_UNKNOWN, true, "-tmp_inst is required");
     98        return false;
     99    }
     100    psString tmp_telescope = psMetadataLookupStr(&status, config->args, "-tmp_telescope");
     101    if (!status) {
     102        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -tmp_telescope");
     103        return false;
     104    }
     105    if (!tmp_telescope) {
     106        psError(PS_ERR_UNKNOWN, true, "-tmp_telescope is required");
    107107        return false;
    108108    }
     
    127127    }
    128128
    129     psString exp_tag = pxGenExpTag(config, exp_id);
    130     if (!exp_tag) {
    131         psError(PS_ERR_UNKNOWN, false, "database error");
    132         return false;
    133     }
    134 
    135129    if (!newExpInsert(config->dbh,
    136                 exp_tag,
    137                 exp_id,
     130                0x0, // exp_id
     131                tmp_exp_name,
    138132                "reg", // state
    139                 camera,
    140                 telescope,
     133                tmp_camera,
     134                tmp_telescope,
    141135                imfiles,
    142136                workdir,
     
    145139        ) {
    146140        psError(PS_ERR_UNKNOWN, false, "database error");
    147         psFree(exp_tag);
    148         return false;
    149     }
     141        return false;
     142    }
     143
     144    psS64 lastInsertID = psDBLastInsertID(config->dbh);
     145    psString exp_id = psDBIntToString(lastInsertID);
    150146
    151147    psMetadata *md = psMetadataAlloc();
    152     if (!psMetadataAddStr(md, PS_LIST_TAIL, "exp_tag", 0, NULL, exp_tag)) {
    153         psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
     148    if (!psMetadataAddStr(md, PS_LIST_TAIL, "exp_id", 0, NULL, exp_id)) {
     149        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
    154150        psFree(md);
    155         psFree(exp_tag);
    156         psFree(md);
    157     }
    158     psFree(exp_tag);
     151        psFree(exp_id);
     152    }
     153    psFree(exp_id);
    159154
    160155    bool simple = false;
     
    186181
    187182    bool status = false;
    188     psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
    189     if (!status) {
    190         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
    191         return false;
    192     }
    193     if (!exp_tag) {
    194         psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
     183    psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
     184    if (!status) {
     185        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
     186        return false;
     187    }
     188    if (!exp_id) {
     189        psError(PS_ERR_UNKNOWN, true, "-exp_id is required");
    195190        return false;
    196191    }
     
    206201    }
    207202#endif
    208     psString class_id = psMetadataLookupStr(&status, config->args, "-class_id");
    209     if (!status) {
    210         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -class_id");
    211         return false;
    212     }
    213     if (!class_id) {
    214         psError(PS_ERR_UNKNOWN, true, "-class_id is required");
     203    psString tmp_class_id = psMetadataLookupStr(&status, config->args, "-tmp_class_id");
     204    if (!status) {
     205        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -tmp_class_id");
     206        return false;
     207    }
     208    if (!tmp_class_id) {
     209        psError(PS_ERR_UNKNOWN, true, "-tmp_class_id is required");
    215210        return false;
    216211    }
     
    226221
    227222    // insert with error flag state set to 0 (no errors)
    228     if (!newImfileInsert(config->dbh, exp_tag, class_id, uri)) {
     223    if (!newImfileInsert(config->dbh, (psS64)atoll(exp_id), tmp_class_id, uri)) {
    229224        psError(PS_ERR_UNKNOWN, false, "database error");
    230225        return false;
     
    240235
    241236    bool status = false;
    242     psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
    243     if (!status) {
    244         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
    245         return false;
    246     }
    247     if (!exp_tag) {
    248         psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
     237    psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
     238    if (!status) {
     239        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
     240        return false;
     241    }
     242    if (!exp_id) {
     243        psError(PS_ERR_UNKNOWN, true, "-exp_id is required");
    249244        return false;
    250245    }
     
    262257    if (state) {
    263258        // set detRun.state to state
    264         return pxnewExpSetState(config, exp_tag, state);
     259        return pxnewExpSetState(config, exp_id, state);
    265260    }
    266261
Note: See TracChangeset for help on using the changeset viewer.