IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 7, 2009, 4:25:35 PM (17 years ago)
Author:
watersc1
Message:

Updates to various tools to fix errors in cleanup.

File:
1 edited

Legend:

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

    r25691 r25800  
    4848
    4949static bool setstackRunState(pxConfig *config, psS64 stack_id, const char *state);
     50static bool setstackRunStateByLabel(pxConfig *config, const char *label, const char *state);
    5051
    5152# define MODECASE(caseName, func) \
     
    569570    PS_ASSERT_PTR_NON_NULL(config, false);
    570571
    571     PXOPT_LOOKUP_S64(stack_id, config->args, "-stack_id", true, false);
     572    PXOPT_LOOKUP_S64(stack_id, config->args, "-stack_id", false, false);
    572573    PXOPT_LOOKUP_STR(state, config->args, "-state", true, false);
    573 
    574     if (state) {
     574    PXOPT_LOOKUP_STR(label, config->args, "-label", false, false);
     575
     576    // Hack-y work around to make stacktool more like the other tools, without breaking other stuff (hopefully).
     577
     578    if ((state)&&(stack_id)) {
    575579        // set detRun.state to state
    576580        return setstackRunState(config, stack_id, state);
    577581    }
    578582
    579     return true;
     583    if ((state)&&(label)) {
     584      return setstackRunStateByLabel(config, label, state);
     585    }
     586
     587    psError(PS_ERR_UNKNOWN, false, "Required options not found.");
     588    return false;
    580589}
    581590
     
    10061015}
    10071016
     1017static bool setstackRunStateByLabel(pxConfig *config, const char *label, const char *state)
     1018{
     1019    PS_ASSERT_PTR_NON_NULL(state, false);
     1020
     1021    // check that state is a valid string value
     1022    if (!pxIsValidState(state)) {
     1023        psError(PS_ERR_UNKNOWN, false, "invalid stackRun state: %s", state);
     1024        return false;
     1025    }
     1026
     1027    char *query = "UPDATE stackRun SET state = '%s' WHERE label = '%s'";
     1028    if (!p_psDBRunQueryF(config->dbh, query, state, label)) {
     1029        psError(PS_ERR_UNKNOWN, false,
     1030                "failed to change state for label %s", label);
     1031        return false;
     1032    }
     1033
     1034    return true;
     1035}
     1036
    10081037static bool pendingcleanuprunMode(pxConfig *config)
    10091038{
Note: See TracChangeset for help on using the changeset viewer.