IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 20, 2009, 4:13:39 PM (17 years ago)
Author:
eugene
Message:

updates from head

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20091113/ippTools/src/disttool.c

    r26095 r26236  
    5252static bool definetargetMode(pxConfig *config);
    5353static bool updatetargetMode(pxConfig *config);
    54 static bool listtargetMode(pxConfig *config);
     54static bool listtargetsMode(pxConfig *config);
    5555
    5656static bool definedestinationMode(pxConfig *config);
     
    100100        MODECASE(DISTTOOL_MODE_DEFINETARGET, definetargetMode);
    101101        MODECASE(DISTTOOL_MODE_UPDATETARGET, updatetargetMode);
    102         MODECASE(DISTTOOL_MODE_LISTTARGET, listtargetMode);
     102        MODECASE(DISTTOOL_MODE_LISTTARGETS, listtargetsMode);
    103103        MODECASE(DISTTOOL_MODE_DEFINEDESTINATION, definedestinationMode);
    104104        MODECASE(DISTTOOL_MODE_UPDATEDESTINATION, updatedestinationMode);
     
    13111311}
    13121312
    1313 static bool listtargetMode(pxConfig *config)
     1313static bool listtargetsMode(pxConfig *config)
    13141314{
    13151315    PS_ASSERT_PTR_NON_NULL(config, false);
     
    15511551    PXOPT_COPY_STR(config->args, where, "-dist_group", "dist_group", "LIKE");
    15521552    PXOPT_COPY_STR(config->args, where, "-filter", "filter", "LIKE");
    1553     PXOPT_COPY_STR(config->args, where, "-stage", "stage", "==");
     1553    // if stage is all don't add it to the query (match all stages)
     1554    if (stage && strcmp(stage, "all")) {
     1555        PXOPT_COPY_STR(config->args, where, "-stage", "stage", "==");
     1556    }
    15541557
    15551558    psString query = pxDataGet("disttool_defineinterest.sql");
     
    16111614    PXOPT_COPY_S64(config->args, where, "-dest_id",   "dest_id", "==");
    16121615    PXOPT_COPY_S64(config->args, where, "-target_id", "target_id", "==");
     1616    PXOPT_COPY_STR(config->args, where, "-dest_name", "rcDestination.name", "LIKE");
     1617    PXOPT_COPY_STR(config->args, where, "-filter", "filter", "LIKE");
     1618    PXOPT_COPY_STR(config->args, where, "-dist_group", "dist_group", "LIKE");
    16131619
    16141620    PXOPT_LOOKUP_STR(state, config->args, "-set_state", false, false);
     
    16181624        return false;
    16191625    }
    1620     psString query = NULL;
    1621     psStringAppend(&query, "UPDATE rcInterest SET state = '%s'", state);
     1626    psString query = pxDataGet("disttool_updateinterest.sql");
    16221627
    16231628    if (psListLength(where->list)) {
     
    16331638    psFree(where);
    16341639
    1635     if (!p_psDBRunQuery(config->dbh, query)) {
     1640    if (!p_psDBRunQueryF(config->dbh, query, state)) {
    16361641        psError(PS_ERR_UNKNOWN, false, "database error");
    16371642        psFree(query);
     
    16391644    }
    16401645    psFree(query);
     1646
     1647    psS64 numUpdated = psDBAffectedRows(config->dbh);
     1648    printf("updated %" PRId64 " interests\n", numUpdated);
    16411649
    16421650    return true;
Note: See TracChangeset for help on using the changeset viewer.