IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 26, 2008, 3:39:54 PM (18 years ago)
Author:
jhoblitt
Message:

consitently handle *_id fields as numeric values instead of converting back of forth between ints and strings

File:
1 edited

Legend:

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

    r18321 r18336  
    106106    PS_ASSERT_PTR_NON_NULL(config, NULL);
    107107
    108     PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false);
     108    PXOPT_LOOKUP_S64(exp_id, config->args, "-exp_id", false, false);
    109109
    110110    psMetadata *where = psMetadataAlloc();
    111     // convert exp_id into a psS64
    112     if (exp_id) {
    113         if (!psMetadataAddS64(where, PS_LIST_TAIL, "exp_id", 0, "==", (psS64)atoll(exp_id))) {
    114             psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
    115             psFree(where);
    116             return false;
    117         }
    118     }
    119 
     111    PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "==");
    120112    PXOPT_COPY_STR(config->args, where, "-exp_name", "exp_name", "==");
    121113    PXOPT_COPY_STR(config->args, where, "-inst", "camera", "==");
     
    263255
    264256    psMetadata *where = psMetadataAlloc();
    265     PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", false, false);
    266     // convert chip_id into a psS64
    267     if (chip_id) {
    268         if (!psMetadataAddS64(where, PS_LIST_TAIL, "chip_id", 0, "==", (psS64)atoll(chip_id))) {
    269             psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id");
    270             psFree(where);
    271             return false;
    272         }
    273     }
    274 
    275     PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false);
    276     // convert exp_id into a psS64
    277     if (exp_id) {
    278         if (!psMetadataAddS64(where, PS_LIST_TAIL, "exp_id", 0, "==", (psS64)atoll(exp_id))) {
    279             psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
    280             psFree(where);
    281             return false;
    282         }
    283     }
    284 
    285     PXOPT_COPY_STR(config->args,  where, "-chip_id", "chip_id", "==");
    286     PXOPT_COPY_STR(config->args,  where, "-exp_id", "exp_id", "==");
     257    PXOPT_COPY_S64(config->args,  where, "-chip_id", "chip_id", "==");
     258    PXOPT_COPY_S64(config->args,  where, "-exp_id", "exp_id", "==");
    287259    PXOPT_COPY_STR(config->args,  where, "-exp_name", "exp_name", "==");
    288260    PXOPT_COPY_STR(config->args,  where, "-inst", "camera", "==");
     
    371343
    372344    psMetadata *where = psMetadataAlloc();
    373     PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", false, false);
    374     // convert chip_id into a psS64
    375     if (chip_id) {
    376         if (!psMetadataAddS64(where, PS_LIST_TAIL, "chipRun.chip_id", 0, "==", (psS64)atoll(chip_id))) {
    377             psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id");
    378             psFree(where);
    379             return false;
    380         }
    381     }
    382 
    383     PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false);
    384     // convert exp_id into a psS64
    385     if (exp_id) {
    386         if (!psMetadataAddS64(where, PS_LIST_TAIL, "rawExp.exp_id", 0, "==", (psS64)atoll(exp_id))) {
    387             psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
    388             psFree(where);
    389             return false;
    390         }
    391     }
    392 
     345    PXOPT_COPY_S64(config->args, where, "-chip_id", "chipRun.chip_id", "==");
     346    PXOPT_COPY_S64(config->args, where, "-exp_id", "rawExp.exp_id", "==");
    393347    PXOPT_COPY_STR(config->args, where, "-class_id", "rawImfile.class_id", "==");
    394348    PXOPT_COPY_STR(config->args, where, "-inst", "rawExp.telescope", "==");
     
    433387    }
    434388
    435     if (!convertIdToStr(output)) {
    436         psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
    437         psFree(output);
    438         return false;
    439     }
    440 
    441389    // negative simple so the default is true
    442390    if (!ippdbPrintMetadatas(stdout, output, "chipPendingImfile", !simple)) {
     
    457405
    458406    // chip_id, ext_tag, class_id are required
    459     PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", true, false);
    460     PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", true, false);
     407    PXOPT_LOOKUP_S64(chip_id, config->args, "-chip_id", true, false);
     408    PXOPT_LOOKUP_S64(exp_id, config->args, "-exp_id", true, false);
    461409    PXOPT_LOOKUP_STR(class_id, config->args, "-class_id", true, false);
    462410
     
    498446
    499447    if (!chipProcessedImfileInsert(config->dbh,
    500                                    (psS64)atoll(chip_id),
    501                                    (psS64)atoll(exp_id),
     448                                   chip_id,
     449                                   exp_id,
    502450                                   class_id,
    503451                                   uri,
     
    569517
    570518    psMetadata *where = psMetadataAlloc();
    571     PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", false, false);
    572     // convert chip_id into a psS64
    573     if (chip_id) {
    574         if (!psMetadataAddS64(where, PS_LIST_TAIL, "chipRun.chip_id", 0, "==", (psS64)atoll(chip_id))) {
    575             psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id");
    576             psFree(where);
    577             return false;
    578         }
    579     }
    580 
    581     PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false);
    582     // convert exp_id into a psS64
    583     if (exp_id) {
    584         if (!psMetadataAddS64(where, PS_LIST_TAIL, "rawExp.exp_id", 0, "==", (psS64)atoll(exp_id))) {
    585             psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
    586             psFree(where);
    587             return false;
    588         }
    589     }
    590 
     519    PXOPT_COPY_S64(config->args, where, "-chip_id", "chipRun.chip_id", "==");
     520    PXOPT_COPY_S64(config->args, where, "-exp_id", "rawExp.chip_id", "==");
    591521    PXOPT_COPY_STR(config->args, where, "-class_id", "rawImfile.class_id", "==");
    592522    PXOPT_COPY_STR(config->args, where, "-inst", "rawExp.telescope", "==");
     
    639569    }
    640570
    641     if (!convertIdToStr(output)) {
    642         psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
    643         psFree(output);
    644         return false;
    645     }
    646 
    647571    // negative simple so the default is true
    648572    if (!ippdbPrintMetadatas(stdout, output, "chipProcessedImfile", !simple)) {
     
    662586
    663587    psMetadata *where = psMetadataAlloc();
    664     PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", false, false);
    665     // convert chip_id into a psS64
    666     if (chip_id) {
    667         if (!psMetadataAddS64(where, PS_LIST_TAIL, "chip_id", 0, "==", (psS64)atoll(chip_id))) {
    668             psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id");
    669             psFree(where);
    670             return false;
    671         }
    672     }
    673 
    674     PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false);
    675     // convert exp_id into a psS64
    676     if (exp_id) {
    677         if (!psMetadataAddS64(where, PS_LIST_TAIL, "exp_id", 0, "==", (psS64)atoll(exp_id))) {
    678             psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
    679             psFree(where);
    680             return false;
    681         }
    682     }
    683 
     588    PXOPT_COPY_S64(config->args, where, "-chip_id", "chip_id", "==");
     589    PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "==");
    684590    PXOPT_COPY_STR(config->args, where, "-exp_name", "exp_name", "==");
    685591    PXOPT_COPY_STR(config->args, where, "-inst", "camera", "==");
     
    832738    }
    833739
    834     if (!convertIdToStr(output)) {
    835         psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
    836         psFree(output);
    837         return false;
    838     }
    839 
    840740    // negative simple so the default is true
    841741    if (!ippdbPrintMetadatas(stdout, output, "chipMask", !simple)) {
     
    905805    }
    906806
    907     if (!convertIdToStr(output)) {
    908         psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
    909         psFree(output);
    910         return false;
    911     }
    912 
    913807    // negative simple so the default is true
    914808    if (!ippdbPrintMetadatas(stdout, output, "chipUnmask", !simple)) {
     
    989883    }
    990884
    991     if (!convertIdToStr(output)) {
    992         psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
    993         psFree(output);
    994         return false;
    995     }
    996 
    997885    // negative simple so the default is true
    998886    if (!ippdbPrintMetadatas(stdout, output, "chipPendingCleanup", !simple)) {
     
    1054942        psFree(output);
    1055943        return true;
    1056     }
    1057 
    1058     if (!convertIdToStr(output)) {
    1059         psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
    1060         psFree(output);
    1061         return false;
    1062944    }
    1063945
Note: See TracChangeset for help on using the changeset viewer.