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

    r18152 r18336  
    4141static bool revertsumskyfileMode(pxConfig *config);
    4242
    43 static bool setstackRunState(pxConfig *config, const char *stack_id, const char *state);
     43static bool setstackRunState(pxConfig *config, psS64 stack_id, const char *state);
    4444
    4545# define MODECASE(caseName, func) \
     
    486486    PS_ASSERT_PTR_NON_NULL(config, false);
    487487
    488     PXOPT_LOOKUP_STR(stack_id, config->args, "-stack_id", true, false);
     488    PXOPT_LOOKUP_S64(stack_id, config->args, "-stack_id", true, false);
    489489    PXOPT_LOOKUP_STR(state, config->args, "-state", true, false);
    490490
     
    502502    PS_ASSERT_PTR_NON_NULL(config, false);
    503503
    504     PXOPT_LOOKUP_STR(stack_id, config->args, "-stack_id", true, false);
    505     PXOPT_LOOKUP_STR(warp_id, config->args, "-warp_id", true, false);
     504    PXOPT_LOOKUP_S64(stack_id, config->args, "-stack_id", true, false);
     505    PXOPT_LOOKUP_S64(warp_id, config->args, "-warp_id", true, false);
    506506
    507507    // XXX need to validate the warp_id here
     
    509509    // constrants
    510510    if (!stackInputSkyfileInsert(config->dbh,
    511             (psS64)atoll(stack_id),
    512             (psS64)atoll(warp_id)
     511            stack_id,
     512            warp_id
    513513        )) {
    514514        psError(PS_ERR_UNKNOWN, false, "database error");
     
    574574
    575575    if (psArrayLength(output)) {
    576         if (!convertIdToStr(output)) {
    577             psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
    578             psFree(output);
    579             return false;
    580         }
    581 
    582576        // negative simple so the default is true
    583577        if (!ippdbPrintMetadatas(stdout, output, "stackInputSkyfile", !simple)) {
     
    648642
    649643    if (psArrayLength(output)) {
    650         if (!convertIdToStr(output)) {
    651             psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
    652             psFree(output);
    653             return false;
    654         }
    655 
    656644        // negative simple so the default is true
    657645        if (!ippdbPrintMetadatas(stdout, output, "stackSumSkyfile", !simple)) {
     
    673661
    674662    // required
    675     PXOPT_LOOKUP_STR(stack_id, config->args, "-stack_id", true, false);
     663    PXOPT_LOOKUP_S64(stack_id, config->args, "-stack_id", true, false);
    676664
    677665    // optional
     
    696684    // constrants
    697685    if (!stackSumSkyfileInsert(config->dbh,
    698                                (psS64)atoll(stack_id),
     686                               stack_id,
    699687                               uri,
    700688                               path_base,
     
    785773
    786774    if (psArrayLength(output)) {
    787         if (!convertIdToStr(output)) {
    788             psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
    789             psFree(output);
    790             return false;
    791         }
    792 
    793775        if (!ippdbPrintMetadatas(stdout, output, "stackSumSkyfile", !simple)) {
    794776            psError(PS_ERR_UNKNOWN, false, "failed to print array");
     
    836818
    837819
    838 static bool setstackRunState(pxConfig *config, const char *stack_id, const char *state)
    839 {
    840     PS_ASSERT_PTR_NON_NULL(stack_id, false);
     820static bool setstackRunState(pxConfig *config, psS64 stack_id, const char *state)
     821{
    841822    PS_ASSERT_PTR_NON_NULL(state, false);
    842823
     
    853834    }
    854835
    855     char *query = "UPDATE stackRun SET state = '%s' WHERE stack_id = '%s'";
     836    char *query = "UPDATE stackRun SET state = '%s' WHERE stack_id = %"PRId64;
    856837    if (!p_psDBRunQuery(config->dbh, query, state, stack_id)) {
    857838        psError(PS_ERR_UNKNOWN, false,
    858                 "failed to change state for stack_id %s", stack_id);
    859         return false;
    860     }
    861 
    862     return true;
    863 }
     839                "failed to change state for stack_id %"PRId64, stack_id);
     840        return false;
     841    }
     842
     843    return true;
     844}
Note: See TracChangeset for help on using the changeset viewer.