IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 36981 for trunk/ippTools/src


Ignore:
Timestamp:
Jul 8, 2014, 3:30:52 PM (12 years ago)
Author:
watersc1
Message:

Addding dropcomponent ability to remotetool.

Location:
trunk/ippTools/src
Files:
3 edited

Legend:

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

    r36968 r36981  
    2323
    2424// Update
     25static bool dropcomponentMode(pxConfig *config);
    2526static bool updaterunMode(pxConfig *config);
    2627static bool updatepollMode(pxConfig *config);
     
    4950    MODECASE(REMOTETOOL_MODE_LISTRUN,       listrunMode);
    5051    MODECASE(REMOTETOOL_MODE_LISTCOMPONENT, listcomponentMode);
     52    MODECASE(REMOTETOOL_MODE_DROPCOMPONENT, dropcomponentMode);
    5153    MODECASE(REMOTETOOL_MODE_UPDATERUN,     updaterunMode);
    5254    MODECASE(REMOTETOOL_MODE_UPDATEPOLL,    updatepollMode);
     
    314316// Update
    315317
     318static bool dropcomponentMode(pxConfig *config)
     319{
     320  // Assert that we have a unique component to operate on.
     321  PXOPT_LOOKUP_S64(remote_id,config->args, "-remote_id",true, false);
     322  psAssert(remote_id,"This must exist for this mode to be safe.");
     323  PXOPT_LOOKUP_S64(stage_id, config->args, "-stage_id", true, false);
     324  psAssert(stage_id,"This must exist for this mode to be safe.");
     325
     326  psString query = pxDataGet("remotetool_dropcomponent.sql");
     327  if (!query) {
     328    psError(PXTOOLS_ERR_SYS, false, "Failed to retreive SQL statement");
     329    return false;
     330  }
     331 
     332  if (!psDBTransaction(config->dbh)) {
     333    psError(PS_ERR_UNKNOWN, false, "database error");
     334    return false;
     335  }
     336
     337  if (!p_psDBRunQueryF(config->dbh, query, remote_id, stage_id)) {
     338    psError(PS_ERR_UNKNOWN, false, "Database error");
     339    psFree(query);
     340    return false;
     341  }
     342  psFree(query);
     343 
     344 
     345
     346  // point of no return
     347  if (!psDBCommit(config->dbh)) {
     348    psError(PS_ERR_UNKNOWN, false, "database error");
     349    return false;
     350  }
     351 
     352  return true;
     353}
     354
    316355static bool updaterunMode(pxConfig *config)
    317356{
  • trunk/ippTools/src/remotetool.h

    r36511 r36981  
    1313  REMOTETOOL_MODE_LISTRUN,
    1414  REMOTETOOL_MODE_LISTCOMPONENT,
     15  REMOTETOOL_MODE_DROPCOMPONENT,
    1516  REMOTETOOL_MODE_UPDATERUN,
    1617  REMOTETOOL_MODE_UPDATEPOLL,
  • trunk/ippTools/src/remotetoolConfig.c

    r36512 r36981  
    6464  ADD_OPT(S16, listcomponentArgs, "-limit",              "limit to number of runs to display", 0);
    6565  ADD_OPT(Bool, listcomponentArgs, "-simple",            "simple print format", false);
     66
     67  // -dropcomponent
     68  psMetadata *dropcomponentArgs = psMetadataAlloc();
     69  ADD_OPT(S64, dropcomponentArgs, "-remote_id",         "run to update", 0);
     70  ADD_OPT(S64, dropcomponentArgs, "-stage_id",          "stage_id to remote", 0);
     71 
    6672  // -updaterun
    6773  psMetadata *updaterunArgs = psMetadataAlloc();
     
    95101  PXOPT_ADD_MODE("-listrun",           "", REMOTETOOL_MODE_LISTRUN,        listrunArgs);
    96102  PXOPT_ADD_MODE("-listcomponent",     "", REMOTETOOL_MODE_LISTCOMPONENT,  listcomponentArgs);
     103  PXOPT_ADD_MODE("-dropcomponent",     "", REMOTETOOL_MODE_DROPCOMPONENT,  dropcomponentArgs);
    97104  PXOPT_ADD_MODE("-updaterun",         "", REMOTETOOL_MODE_UPDATERUN,      updaterunArgs);
    98105  PXOPT_ADD_MODE("-updatepoll",        "", REMOTETOOL_MODE_UPDATEPOLL,     updatepollArgs);
Note: See TracChangeset for help on using the changeset viewer.