- Timestamp:
- Jul 16, 2014, 3:29:41 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20140610/ippTools/src/remotetool.c
r36928 r37026 23 23 24 24 // Update 25 static bool dropcomponentMode(pxConfig *config); 25 26 static bool updaterunMode(pxConfig *config); 26 27 static bool updatepollMode(pxConfig *config); … … 49 50 MODECASE(REMOTETOOL_MODE_LISTRUN, listrunMode); 50 51 MODECASE(REMOTETOOL_MODE_LISTCOMPONENT, listcomponentMode); 52 MODECASE(REMOTETOOL_MODE_DROPCOMPONENT, dropcomponentMode); 51 53 MODECASE(REMOTETOOL_MODE_UPDATERUN, updaterunMode); 52 54 MODECASE(REMOTETOOL_MODE_UPDATEPOLL, updatepollMode); … … 94 96 95 97 // Get a list of the things we can insert into a new component 98 // CZW: these labels no longer need to be linked to the table, as I've split stageRun and remoteRun into sub-queries. 96 99 psString query = NULL; 97 100 psString whereOption = psStringCopy(""); … … 104 107 105 108 if (label) { 106 psStringAppend(& query, " AND (chipRun.label = '%s')", label);109 psStringAppend(&whereOption, "\n AND (label = '%s')", label); 107 110 } 108 111 } … … 115 118 116 119 if (label) { 117 psStringAppend(& query, " AND (camRun.label = '%s')", label);120 psStringAppend(&whereOption, "\n AND (label = '%s')", label); 118 121 } 119 122 } … … 128 131 // Because warp has to check to see if something other than the state is set correctly, I have to use this wonky way to pass the label in. 129 132 // psStringAppend(&query, " AND (warpRun.label = '%s')", label); 130 psStringAppend(&whereOption, "\n AND ( warpRun.label = '%s')", label);133 psStringAppend(&whereOption, "\n AND (label = '%s')", label); 131 134 } 132 135 } … … 139 142 140 143 if (label) { 141 psStringAppend(& query, " AND (stackRun.label = '%s')", label);144 psStringAppend(&whereOption, "\n AND (label = '%s')", label); 142 145 } 143 146 } … … 152 155 psFree(limitString); 153 156 } 154 if (!p_psDBRunQueryF(config->dbh, query,whereOption )) {157 if (!p_psDBRunQueryF(config->dbh, query,whereOption,whereOption)) { // This needs to be here twice because we need to restrict on label twice. 155 158 psError(PS_ERR_UNKNOWN, false, "database error"); 156 159 psFree(query); … … 313 316 // Update 314 317 318 static 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 315 355 static bool updaterunMode(pxConfig *config) 316 356 {
Note:
See TracChangeset
for help on using the changeset viewer.
