- Timestamp:
- Sep 19, 2014, 4:05:27 PM (12 years ago)
- Location:
- branches/eam_branches/ps2-tc3-20130727
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ippTools/src/remotetool.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ps2-tc3-20130727
- Property svn:mergeinfo changed
-
branches/eam_branches/ps2-tc3-20130727/ippTools/src/remotetool.c
r36680 r37403 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; 100 psString whereOption = psStringCopy(""); 97 101 if (!strcmp(stage,"chip")) { 98 102 query = pxDataGet("remotetool_definebyquery_chip.sql"); … … 103 107 104 108 if (label) { 105 psStringAppend(& query, " AND (chipRun.label = '%s')", label);109 psStringAppend(&whereOption, "\n AND (label = '%s')", label); 106 110 } 107 111 } … … 114 118 115 119 if (label) { 116 psStringAppend(& query, " AND (camRun.label = '%s')", label);120 psStringAppend(&whereOption, "\n AND (label = '%s')", label); 117 121 } 118 122 } … … 125 129 126 130 if (label) { 127 psStringAppend(&query, " AND (warpRun.label = '%s')", label); 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. 132 // psStringAppend(&query, " AND (warpRun.label = '%s')", label); 133 psStringAppend(&whereOption, "\n AND (label = '%s')", label); 128 134 } 129 135 } … … 136 142 137 143 if (label) { 138 psStringAppend(& query, " AND (stackRun.label = '%s')", label);144 psStringAppend(&whereOption, "\n AND (label = '%s')", label); 139 145 } 140 146 } … … 149 155 psFree(limitString); 150 156 } 151 if (!p_psDBRunQuery (config->dbh, query)) {157 if (!p_psDBRunQueryF(config->dbh, query,whereOption,whereOption)) { // This needs to be here twice because we need to restrict on label twice. 152 158 psError(PS_ERR_UNKNOWN, false, "database error"); 153 159 psFree(query); … … 310 316 // Update 311 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 312 355 static bool updaterunMode(pxConfig *config) 313 356 { 314 357 PS_ASSERT_PTR_NON_NULL(config, false); 315 // PXOPT_LOOKUP_S64(remote_id, config->args, "-remote_id", true, false); 316 358 PXOPT_LOOKUP_S64(remote_id, config->args, "-remote_id", true, false); 359 psAssert(remote_id,"This should have failed before this point."); 360 317 361 psMetadata *where = psMetadataAlloc(); 318 362 psMetadata *values = psMetadataAlloc(); … … 341 385 { 342 386 PS_ASSERT_PTR_NON_NULL(config, false); 343 // PXOPT_LOOKUP_S64(remote_id, config->args, "-remote_id", true, false); 344 387 PXOPT_LOOKUP_S64(remote_id, config->args, "-remote_id", true, false); 388 psAssert(remote_id,"This should have failed before this point."); 389 345 390 psMetadata *where = psMetadataAlloc(); 346 391 // Wheres
Note:
See TracChangeset
for help on using the changeset viewer.
