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/warptool.c

    r18029 r18336  
    111111
    112112    // required options
    113     PXOPT_LOOKUP_STR(fake_id, config->args, "-fake_id", true, false);
     113    PXOPT_LOOKUP_S64(fake_id, config->args, "-fake_id", true, false);
    114114    PXOPT_LOOKUP_STR(mode, config->args, "-mode", true, false);
    115115    // check mode
     
    133133    warpRunRow *warpRun = warpRunRowAlloc(
    134134            0,          // ID
    135             (psS64)atoll(fake_id),
     135            fake_id,
    136136            mode,
    137137            "run",      // state
     
    175175    PS_ASSERT_PTR_NON_NULL(config, false);
    176176
    177     PXOPT_LOOKUP_STR(warp_id, config->args, "-warp_id", false, false);
    178     PXOPT_LOOKUP_STR(fake_id, config->args, "-fake_id", false, false);
    179     PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", false, false);
    180     PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false);
    181 
    182177    psMetadata *where = psMetadataAlloc();
    183     // convert warp_id into a psS64
    184     if (warp_id) {
    185         if (!psMetadataAddS64(where, PS_LIST_TAIL, "warp_id", 0, "==", (psS64)atoll(warp_id))) {
    186             psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id");
    187             psFree(where);
    188             return false;
    189         }
    190     }
    191 
    192     // convert fake_id into a psS64
    193     if (fake_id) {
    194         if (!psMetadataAddS64(where, PS_LIST_TAIL, "fake_id", 0, "==", (psS64)atoll(fake_id))) {
    195             psError(PS_ERR_UNKNOWN, false, "failed to add item fake_id");
    196             psFree(where);
    197             return false;
    198         }
    199     }
    200 
    201     // convert chip_id into a psS64
    202     if (chip_id) {
    203         if (!psMetadataAddS64(where, PS_LIST_TAIL, "chip_id", 0, "==", (psS64)atoll(chip_id))) {
    204             psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id");
    205             psFree(where);
    206             return false;
    207         }
    208     }
    209 
    210     // convert exp_id into a psS64
    211     if (exp_id) {
    212         if (!psMetadataAddS64(where, PS_LIST_TAIL, "exp_id", 0, "==", (psS64)atoll(exp_id))) {
    213             psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
    214             psFree(where);
    215             return false;
    216         }
    217     }
    218 
     178    PXOPT_COPY_S64(config->args, where, "-warp_id", "warp_id", "==");
     179    PXOPT_COPY_S64(config->args, where, "-fake_id", "fake_id", "==");
     180    PXOPT_COPY_S64(config->args, where, "-chip_id", "chip_id", "==");
     181    PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "==");
    219182    PXOPT_COPY_STR(config->args, where, "-exp_name", "exp_name", "==");
    220183    PXOPT_COPY_STR(config->args, where, "-inst", "camera", "==");
     
    350313
    351314    if (psArrayLength(output)) {
    352         if (!convertIdToStr(output)) {
    353             psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
    354             psFree(output);
    355             return false;
    356         }
    357 
    358315        // negative simple so the default is true
    359316        if (!ippdbPrintMetadatas(stdout, output, "warpRun", !simple)) {
     
    425382
    426383    if (psArrayLength(output)) {
    427         if (!convertIdToStr(output)) {
    428             psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
    429             psFree(output);
    430             return false;
    431         }
    432 
    433384        // negative simple so the default is true
    434385        if (!ippdbPrintMetadatas(stdout, output, "warpInputImfile", !simple)) {
     
    500451
    501452    if (psArrayLength(output)) {
    502         if (!convertIdToStr(output)) {
    503             psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
    504             psFree(output);
    505             return false;
    506         }
    507 
    508453        // negative simple so the default is true
    509454        if (!ippdbPrintMetadatas(stdout, output, "warpRun", !simple)) {
     
    525470
    526471    PXOPT_LOOKUP_STR(mapfile, config->args, "-mapfile", false, false);
    527     PXOPT_LOOKUP_STR(warp_id, config->args, "-warp_id", false, false);
     472    PXOPT_LOOKUP_S64(warp_id, config->args, "-warp_id", false, false);
    528473    PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
    529474
     
    544489    } else {
    545490        warpSkyCellMapInsert(config->dbh,
    546             (psS64)atoll(warp_id),
     491            warp_id,
    547492            NULL,   // skycell_id
    548493            NULL,   // tess_id
     
    677622
    678623    if (psArrayLength(output)) {
    679         if (!convertIdToStr(output)) {
    680             psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
    681             psFree(output);
    682             return false;
    683         }
    684 
    685624        // negative simple so the default is true
    686625        if (!ippdbPrintMetadatas(stdout, output, "warpSkyCellMap", !simple)) {
     
    752691
    753692    if (psArrayLength(output)) {
    754         if (!convertIdToStr(output)) {
    755             psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
    756             psFree(output);
    757             return false;
    758         }
    759 
    760693        // negative simple so the default is true
    761694        if (!ippdbPrintMetadatas(stdout, output, "warpPendingSkyCell", !simple)) {
     
    776709    PS_ASSERT_PTR_NON_NULL(config, false);
    777710
    778     PXOPT_LOOKUP_STR(warp_id, config->args, "-warp_id", true, false);
     711    PXOPT_LOOKUP_S64(warp_id, config->args, "-warp_id", true, false);
    779712    PXOPT_LOOKUP_STR(skycell_id, config->args, "-skycell_id", true, false);
    780713    PXOPT_LOOKUP_STR(tess_id, config->args, "-tess_id", true, false);
     
    806739    // XXX need to validate that this coresponds to an warpInputImfile
    807740    if (!warpSkyfileInsert(config->dbh,
    808                            (psS64)atoll(warp_id),
     741                           warp_id,
    809742                           skycell_id,
    810743                           tess_id,
     
    1009942
    1010943    if (psArrayLength(output)) {
    1011         if (!convertIdToStr(output)) {
    1012             psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
    1013             psFree(output);
    1014             return false;
    1015         }
    1016 
    1017944        // negative simple so the default is true
    1018945        if (!ippdbPrintMetadatas(stdout, output, "warpSkyfile", !simple)) {
     
    1033960    PS_ASSERT_PTR_NON_NULL(config, false);
    1034961
    1035     PXOPT_LOOKUP_STR(warp_id, config->args, "-warp_id", false, false);
    1036     PXOPT_LOOKUP_STR(fake_id, config->args, "-fake_id", false, false);
    1037     PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", false, false);
    1038     PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false);
    1039 
    1040962    psMetadata *where = psMetadataAlloc();
    1041     // convert warp_id into a psS64
    1042     if (warp_id) {
    1043         if (!psMetadataAddS64(where, PS_LIST_TAIL, "warpRun.warp_id", 0, "==", (psS64)atoll(warp_id))) {
    1044             psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id");
    1045             psFree(where);
    1046             return false;
    1047         }
    1048     }
    1049 
     963    PXOPT_COPY_S64(config->args, where, "-warp_id", "warp_id", "==");
     964    PXOPT_COPY_S64(config->args, where, "-fake_id", "fake_id", "==");
     965    PXOPT_COPY_S64(config->args, where, "-chip_id", "chip_id", "==");
     966    PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "==");
    1050967    PXOPT_COPY_STR(config->args, where, "-skycell_id", "skycell_id", "==");
    1051968    PXOPT_COPY_STR(config->args, where, "-tess_id", "tess_id", "==");
    1052 
    1053     // convert fake_id into a psS64
    1054     if (fake_id) {
    1055         if (!psMetadataAddS64(where, PS_LIST_TAIL, "fakeRun.fake_id", 0, "==", (psS64)atoll(fake_id))) {
    1056             psError(PS_ERR_UNKNOWN, false, "failed to add item fake_id");
    1057             psFree(where);
    1058             return false;
    1059         }
    1060     }
    1061 
    1062     // convert chip_id into a psS64
    1063     if (chip_id) {
    1064         if (!psMetadataAddS64(where, PS_LIST_TAIL, "chipRun.chip_id", 0, "==", (psS64)atoll(chip_id))) {
    1065             psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id");
    1066             psFree(where);
    1067             return false;
    1068         }
    1069     }
    1070 
    1071     // convert exp_id into a psS64
    1072     if (exp_id) {
    1073         if (!psMetadataAddS64(where, PS_LIST_TAIL, "rawExp.exp_id", 0, "==", (psS64)atoll(exp_id))) {
    1074             psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
    1075             psFree(where);
    1076             return false;
    1077         }
    1078     }
    1079969
    1080970    // XXX These may need to be updated with the table name?
     
    11931083    }
    11941084
    1195     if (!convertIdToStr(output)) {
    1196         psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
    1197         psFree(output);
    1198         return false;
    1199     }
    1200 
    12011085    // negative simple so the default is true
    12021086    if (!ippdbPrintMetadatas(stdout, output, "warpMask", !simple)) {
Note: See TracChangeset for help on using the changeset viewer.