Changeset 36968
- Timestamp:
- Jul 2, 2014, 5:28:31 PM (12 years ago)
- Location:
- trunk/ippTools
- Files:
-
- 5 edited
-
share/remotetool_definebyquery_cam.sql (modified) (1 diff)
-
share/remotetool_definebyquery_chip.sql (modified) (1 diff)
-
share/remotetool_definebyquery_stack.sql (modified) (1 diff)
-
share/remotetool_definebyquery_warp.sql (modified) (1 diff)
-
src/remotetool.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/share/remotetool_definebyquery_cam.sql
r36853 r36968 1 SELECT 2 cam_id AS stage_id 3 FROM camRun 4 LEFT JOIN remoteComponent ON (remoteComponent.stage_id = camRun.cam_id) 5 LEFT JOIN remoteRun ON ( 6 remoteComponent.remote_id = remoteRun.remote_id AND 7 remoteRun.label = camRun.label 8 ) 1 SELECT stage_id FROM 2 3 ( SELECT cam_id AS stage_id 4 FROM camRun 9 5 WHERE 10 camRun.state = 'new' AND 11 (remoteRun.stage = 'camera' OR remoteRun.state IS NULL) AND 12 remoteComponent.remote_id IS NULL 6 camRun.state = 'new' 7 -- where hook %s 8 GROUP BY cam_id 9 ) AS W 10 11 LEFT JOIN 12 13 (SELECT remote_id,remoteRun.stage,remoteRun.label,remoteComponent.stage_id,remoteRun.state 14 FROM remoteRun 15 JOIN remoteComponent USING (remote_id) 16 WHERE 17 remoteRun.stage = 'camera' 18 -- where hook %s 19 ) AS R 20 USING (stage_id) 21 WHERE R.remote_id IS NULL -
trunk/ippTools/share/remotetool_definebyquery_chip.sql
r36512 r36968 1 SELECT 2 chip_id AS stage_id 3 FROM chipRun 4 LEFT JOIN remoteComponent ON (remoteComponent.stage_id = chipRun.chip_id) 5 LEFT JOIN remoteRun ON ( 6 remoteComponent.remote_id = remoteRun.remote_id AND 7 remoteRun.label = chipRun.label 8 ) 1 SELECT stage_id FROM 2 3 ( SELECT chip_id AS stage_id 4 FROM chipRun 9 5 WHERE 10 chipRun.state = 'new' AND 11 (remoteRun.stage = 'chip' OR remoteRun.stage IS NULL) AND 12 remoteComponent.remote_id IS NULL 6 chipRun.state = 'new' 7 -- where hook %s 8 GROUP BY chip_id 9 ) AS W 10 11 LEFT JOIN 12 13 (SELECT remote_id,remoteRun.stage,remoteRun.label,remoteComponent.stage_id,remoteRun.state 14 FROM remoteRun 15 JOIN remoteComponent USING (remote_id) 16 WHERE 17 remoteRun.stage = 'chip' 18 -- where hook %s 19 ) AS R 20 USING (stage_id) 21 WHERE R.remote_id IS NULL 22 13 23 14 24 -
trunk/ippTools/share/remotetool_definebyquery_stack.sql
r36853 r36968 1 SELECT 2 stack_id AS stage_id 3 FROM stackRun 4 LEFT JOIN remoteComponent ON (remoteComponent.stage_id = stackRun.stack_id) 5 LEFT JOIN remoteRun ON ( 6 remoteComponent.remote_id = remoteRun.remote_id AND 7 remoteRun.label = stackRun.label 8 ) 1 SELECT stage_id FROM 2 3 ( SELECT stack_id AS stage_id 4 FROM stackRun 9 5 WHERE 10 stackRun.state = 'new' AND 11 (remoteRun.stage = 'stack' OR remoteRun.state IS NULL) AND 12 remoteComponent.remote_id IS NULL 6 stackRun.state = 'new' 7 -- where hook %s 8 GROUP BY stack_id 9 ) AS W 10 11 LEFT JOIN 12 13 (SELECT remote_id,remoteRun.stage,remoteRun.label,remoteComponent.stage_id,remoteRun.state 14 FROM remoteRun 15 JOIN remoteComponent USING (remote_id) 16 WHERE 17 remoteRun.stage = 'stack' 18 -- where hook %s 19 ) AS R 20 USING (stage_id) 21 WHERE R.remote_id IS NULL -
trunk/ippTools/share/remotetool_definebyquery_warp.sql
r36963 r36968 1 SELECT warp_id AS stage_id FROM ( 2 SELECT warp_id, count(warpSkyCellMap.skycell_id) AS N 1 SELECT stage_id FROM 2 3 ( SELECT warp_id AS stage_id, count(warpSkyCellMap.skycell_id) AS N 3 4 FROM warpRun 4 5 LEFT JOIN warpSkyCellMap USING(warp_id) 5 LEFT JOIN remoteComponent ON (remoteComponent.stage_id = warpRun.warp_id) 6 LEFT JOIN remoteRun ON (remoteComponent.remote_id = remoteRun.remote_id 7 AND remoteRun.label = warpRun.label 8 AND (remoteRun.stage = 'warp' OR remoteRun.state IS NULL) 9 ) 10 WHERE warpRun.state = 'new' 11 AND (remoteRun.stage = 'warp' OR remoteRun.state IS NULL) 12 -- AND remoteComponent.remote_id IS NULL 6 WHERE 7 warpRun.state = 'new' 13 8 -- where hook %s 14 9 GROUP BY warp_id 15 ) AS warpTry 16 WHERE N != 0 10 HAVING N != 0 11 ) AS W 17 12 13 LEFT JOIN 14 15 (SELECT remote_id,remoteRun.stage,remoteRun.label,remoteComponent.stage_id,remoteRun.state 16 FROM remoteRun 17 JOIN remoteComponent USING (remote_id) 18 WHERE 19 remoteRun.stage = 'warp' 20 -- where hook %s 21 ) AS R 22 USING (stage_id) 23 WHERE R.remote_id IS NULL 24 -
trunk/ippTools/src/remotetool.c
r36896 r36968 94 94 95 95 // Get a list of the things we can insert into a new component 96 // CZW: these labels no longer need to be linked to the table, as I've split stageRun and remoteRun into sub-queries. 96 97 psString query = NULL; 97 98 psString whereOption = psStringCopy(""); … … 104 105 105 106 if (label) { 106 psStringAppend(& query, " AND (chipRun.label = '%s')", label);107 psStringAppend(&whereOption, "\n AND (label = '%s')", label); 107 108 } 108 109 } … … 115 116 116 117 if (label) { 117 psStringAppend(& query, " AND (camRun.label = '%s')", label);118 psStringAppend(&whereOption, "\n AND (label = '%s')", label); 118 119 } 119 120 } … … 128 129 // 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 130 // psStringAppend(&query, " AND (warpRun.label = '%s')", label); 130 psStringAppend(&whereOption, "\n AND ( warpRun.label = '%s')", label);131 psStringAppend(&whereOption, "\n AND (label = '%s')", label); 131 132 } 132 133 } … … 139 140 140 141 if (label) { 141 psStringAppend(& query, " AND (stackRun.label = '%s')", label);142 psStringAppend(&whereOption, "\n AND (label = '%s')", label); 142 143 } 143 144 } … … 152 153 psFree(limitString); 153 154 } 154 if (!p_psDBRunQueryF(config->dbh, query,whereOption )) {155 if (!p_psDBRunQueryF(config->dbh, query,whereOption,whereOption)) { // This needs to be here twice because we need to restrict on label twice. 155 156 psError(PS_ERR_UNKNOWN, false, "database error"); 156 157 psFree(query);
Note:
See TracChangeset
for help on using the changeset viewer.
