IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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

Addding dropcomponent ability to remotetool.

File:
1 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{
Note: See TracChangeset for help on using the changeset viewer.