]> git.pld-linux.org Git - packages/cacti.git/blob - cacti-mysql5.patch
- new
[packages/cacti.git] / cacti-mysql5.patch
1 diff -urbB cacti-0.8.6g/data_queries.php cacti/data_queries.php
2 --- cacti-0.8.6g/data_queries.php       2005-09-09 01:56:25.000000000 +0200
3 +++ cacti/data_queries.php      2005-11-24 19:32:45.000000000 +0100
4 @@ -301,7 +301,7 @@
5                 $data_templates = db_fetch_assoc("select
6                         data_template.id,
7                         data_template.name
8 -                       from data_template, data_template_rrd, graph_templates_item
9 +                       from (data_template, data_template_rrd, graph_templates_item)
10                         where graph_templates_item.task_item_id=data_template_rrd.id
11                         and data_template_rrd.data_template_id=data_template.id
12                         and data_template_rrd.local_data_id=0
13 @@ -596,7 +596,7 @@
14                                 graph_templates.name as graph_template_name,
15                                 snmp_query_graph.name
16                                 from snmp_query_graph
17 -                               left join graph_templates on snmp_query_graph.graph_template_id=graph_templates.id
18 +                               left join graph_templates on (snmp_query_graph.graph_template_id=graph_templates.id)
19                                 where snmp_query_graph.snmp_query_id=" . $snmp_query["id"] . "
20                                 order by snmp_query_graph.name");
21  
22 @@ -643,7 +643,7 @@
23                         snmp_query.id,
24                         snmp_query.name,
25                         data_input.name AS data_input_method
26 -                       FROM snmp_query INNER JOIN data_input ON snmp_query.data_input_id = data_input.id
27 +                       FROM snmp_query INNER JOIN data_input ON (snmp_query.data_input_id = data_input.id)
28                         ORDER BY snmp_query.name");
29  
30         $i = 0;
31 diff -urbB cacti-0.8.6g/data_sources.php cacti/data_sources.php
32 --- cacti-0.8.6g/data_sources.php       2005-09-09 01:56:25.000000000 +0200
33 +++ cacti/data_sources.php      2005-11-24 19:32:45.000000000 +0100
34 @@ -137,8 +137,8 @@
35                         data_input_fields.allow_nulls,
36                         data_input_fields.type_code
37                         from data_template_data
38 -                       left join data_input_fields on data_input_fields.data_input_id=data_template_data.data_input_id
39 -                       left join data_local on data_template_data.local_data_id=data_local.id
40 +                       left join data_input_fields on (data_input_fields.data_input_id=data_template_data.data_input_id)
41 +                       left join data_local on (data_template_data.local_data_id=data_local.id)
42                         where data_template_data.id=" . $_POST["data_template_data_id"] . "
43                         and data_input_fields.input_output='in'");
44  
45 @@ -331,7 +331,7 @@
46                                 case '3': /* delete all graphs tied to this data source */
47                                         $graphs = db_fetch_assoc("select
48                                                 graph_templates_graph.local_graph_id
49 -                                               from data_template_rrd,graph_templates_item,graph_templates_graph
50 +                                               from (data_template_rrd,graph_templates_item,graph_templates_graph)
51                                                 where graph_templates_item.task_item_id=data_template_rrd.id
52                                                 and graph_templates_item.local_graph_id=graph_templates_graph.local_graph_id
53                                                 and " . array_to_sql_or($selected_items, "data_template_rrd.local_data_id") . "
54 @@ -435,7 +435,7 @@
55                         $graphs = db_fetch_assoc("select
56                                 graph_templates_graph.local_graph_id,
57                                 graph_templates_graph.title_cache
58 -                               from data_template_rrd,graph_templates_item,graph_templates_graph
59 +                               from (data_template_rrd,graph_templates_item,graph_templates_graph)
60                                 where graph_templates_item.task_item_id=data_template_rrd.id
61                                 and graph_templates_item.local_graph_id=graph_templates_graph.local_graph_id
62                                 and " . array_to_sql_or($ds_array, "data_template_rrd.local_data_id") . "
63 @@ -562,7 +562,7 @@
64                 $data = db_fetch_row("select id,data_input_id,data_template_id,name,local_data_id from data_template_data where local_data_id=" . $_GET["id"]);
65                 $template_data = db_fetch_row("select id,data_input_id from data_template_data where data_template_id=" . $data["data_template_id"] . " and local_data_id=0");
66  
67 -               $host = db_fetch_row("select host.id,host.hostname from data_local,host where data_local.host_id=host.id and data_local.id=" . $_GET["id"]);
68 +               $host = db_fetch_row("select host.id,host.hostname from (data_local,host) where data_local.host_id=host.id and data_local.id=" . $_GET["id"]);
69  
70                 $header_label = "[edit: " . $data["name"] . "]";
71         }else{
72 @@ -574,7 +574,7 @@
73         $i = 0;
74         if (!empty($data["data_input_id"])) {
75                 /* get each INPUT field for this data input source */
76 -               $fields = db_fetch_assoc("select * from data_input_fields where data_input_id=" . $data["data_input_id"] . " and input_output='in' order by name");
77 +               $fields = db_fetch_assoc("select * from data_input_fields where data_input_id=" . $data["data_input_id"] . " and input_output='in' order by sequence");
78  
79                 html_start_box("<strong>Custom Data</strong> [data input: " . db_fetch_cell("select name from data_input where id=" . $data["data_input_id"]) . "]", "98%", $colors["header"], "3", "center", "");
80  
81 @@ -992,7 +992,7 @@
82  
83         $total_rows = sizeof(db_fetch_assoc("select
84                 data_local.id
85 -               from data_local,data_template_data
86 +               from (data_local,data_template_data)
87                 where data_local.id=data_template_data.local_data_id
88                 $sql_where"));
89         $data_sources = db_fetch_assoc("select
90 @@ -1002,11 +1002,11 @@
91                 data_input.name as data_input_name,
92                 data_template.name as data_template_name,
93                 data_local.host_id
94 -               from data_local,data_template_data
95 +               from (data_local,data_template_data)
96                 left join data_input
97 -               on data_input.id=data_template_data.data_input_id
98 +               on (data_input.id=data_template_data.data_input_id)
99                 left join data_template
100 -               on data_local.data_template_id=data_template.id
101 +               on (data_local.data_template_id=data_template.id)
102                 where data_local.id=data_template_data.local_data_id
103                 $sql_where
104                 order by data_template_data.name_cache,data_local.host_id
105 diff -urbB cacti-0.8.6g/data_templates.php cacti/data_templates.php
106 --- cacti-0.8.6g/data_templates.php     2005-09-09 01:56:25.000000000 +0200
107 +++ cacti/data_templates.php    2005-11-24 19:32:45.000000000 +0100
108 @@ -556,7 +556,7 @@
109         $i = 0;
110         if (!empty($_GET["id"])) {
111                 /* get each INPUT field for this data input source */
112 -               $fields = db_fetch_assoc("select * from data_input_fields where data_input_id=" . $template_data["data_input_id"] . " and input_output='in' order by name");
113 +               $fields = db_fetch_assoc("select * from data_input_fields where data_input_id=" . $template_data["data_input_id"] . " and input_output='in' order by sequence");
114  
115                 html_start_box("<strong>Custom Data</strong> [data input: " . db_fetch_cell("select name from data_input where id=" . $template_data["data_input_id"]) . "]", "98%", $colors["header"], "3", "center", "");
116  
117 @@ -607,8 +607,8 @@
118                 data_template.name,
119                 data_input.name as data_input_method,
120                 data_template_data.active as active
121 -               from data_template,data_template_data
122 -               left join data_input on data_template_data.data_input_id = data_input.id
123 +               from (data_template,data_template_data)
124 +               left join data_input on (data_template_data.data_input_id = data_input.id)
125                 where data_template.id = data_template_data.data_template_id
126                 and data_template_data.local_data_id = 0
127                 order by data_template.name");
128 Tylko w cacti: dev
129 Tylko w cacti/docs: build
130 diff -urbB cacti-0.8.6g/graph.php cacti/graph.php
131 --- cacti-0.8.6g/graph.php      2005-09-09 01:56:25.000000000 +0200
132 +++ cacti/graph.php     2005-11-24 19:32:45.000000000 +0100
133 @@ -132,7 +132,7 @@
134         /* find the step and how often this graph is updated with new data */
135         $ds_step = db_fetch_cell("select
136                 data_template_data.rrd_step
137 -               from data_template_data,data_template_rrd,graph_templates_item
138 +               from (data_template_data,data_template_rrd,graph_templates_item)
139                 where graph_templates_item.task_item_id=data_template_rrd.id
140                 and data_template_rrd.local_data_id=data_template_data.local_data_id
141                 and graph_templates_item.local_graph_id=" . $_GET["local_graph_id"] .
142 diff -urbB cacti-0.8.6g/graphs_items.php cacti/graphs_items.php
143 --- cacti-0.8.6g/graphs_items.php       2005-09-09 01:56:25.000000000 +0200
144 +++ cacti/graphs_items.php      2005-11-24 19:32:45.000000000 +0100
145 @@ -243,8 +243,8 @@
146                 $struct_graph_item["task_item_id"]["sql"] = "select
147                         CONCAT_WS('',data_template_data.name_cache,' (',data_template_rrd.data_source_name,')') as name,
148                         data_template_rrd.id
149 -                       from data_template_data,data_template_rrd,data_local
150 -                       left join host on data_local.host_id=host.id
151 +                       from (data_template_data,data_template_rrd,data_local)
152 +                       left join host on (data_local.host_id=host.id)
153                         where data_template_rrd.local_data_id=data_local.id
154                         and data_template_data.local_data_id=data_local.id
155                         " . (((!empty($host_id)) || (!empty($_REQUEST["host_id"]))) ? (!empty($host_id) ? " and data_local.host_id=$host_id" : " and data_local.host_id=" . $_REQUEST["host_id"]) : "") . "
156 diff -urbB cacti-0.8.6g/graphs_new.php cacti/graphs_new.php
157 --- cacti-0.8.6g/graphs_new.php 2005-09-09 01:56:25.000000000 +0200
158 +++ cacti/graphs_new.php        2005-11-24 19:32:45.000000000 +0100
159 @@ -264,7 +264,7 @@
160                                 data_template.name as data_template_name,
161                                 data_template_rrd.data_source_name,
162                                 data_template_data.*
163 -                               from data_template, data_template_rrd, data_template_data, graph_templates_item
164 +                               from (data_template, data_template_rrd, data_template_data, graph_templates_item)
165                                 where graph_templates_item.task_item_id=data_template_rrd.id
166                                 and data_template_rrd.data_template_id=data_template.id
167                                 and data_template_data.data_template_id=data_template.id
168 @@ -277,7 +277,7 @@
169                         $graph_template = db_fetch_row("select
170                                 graph_templates.name as graph_template_name,
171                                 graph_templates_graph.*
172 -                               from graph_templates, graph_templates_graph
173 +                               from (graph_templates, graph_templates_graph)
174                                 where graph_templates.id=graph_templates_graph.graph_template_id
175                                 and graph_templates.id=" . $graph_template_id . "
176                                 and graph_templates_graph.local_graph_id=0");
177 @@ -441,14 +441,14 @@
178         $graph_templates = db_fetch_assoc("select
179                 graph_templates.id as graph_template_id,
180                 graph_templates.name as graph_template_name
181 -               from host_graph,graph_templates
182 +               from (host_graph,graph_templates)
183                 where host_graph.graph_template_id=graph_templates.id
184                 and host_graph.host_id=" . $_REQUEST["host_id"] . "
185                 order by graph_templates.name");
186  
187         $template_graphs = db_fetch_assoc("select
188                 graph_local.graph_template_id
189 -               from graph_local,host_graph
190 +               from (graph_local,host_graph)
191                 where graph_local.graph_template_id=host_graph.graph_template_id
192                 and graph_local.host_id=host_graph.host_id
193                 and graph_local.host_id=" . $host["id"] . "
194 @@ -496,7 +496,7 @@
195         $available_graph_templates = db_fetch_assoc("SELECT
196                 graph_templates.id, graph_templates.name
197                 FROM snmp_query_graph RIGHT JOIN graph_templates
198 -               ON snmp_query_graph.graph_template_id = graph_templates.id
199 +               ON (snmp_query_graph.graph_template_id = graph_templates.id)
200                 WHERE (((snmp_query_graph.name) Is Null)) ORDER BY graph_templates.name");
201  
202         /* create a row at the bottom that lets the user create any graph they choose */
203 @@ -513,7 +513,7 @@
204                 snmp_query.id,
205                 snmp_query.name,
206                 snmp_query.xml_path
207 -               from snmp_query,host_snmp_query
208 +               from (snmp_query,host_snmp_query)
209                 where host_snmp_query.snmp_query_id=snmp_query.id
210                 and host_snmp_query.host_id=" . $host["id"] . "
211                 order by snmp_query.name");
212 @@ -562,9 +562,9 @@
213                         foreach ($snmp_query_graphs as $snmp_query_graph) {
214                                 $created_graphs = db_fetch_assoc("select distinct
215                                         data_local.snmp_index
216 -                                       from data_local,data_template_data
217 -                                       left join data_input_data on data_template_data.id=data_input_data.data_template_data_id
218 -                                       left join data_input_fields on data_input_data.data_input_field_id=data_input_fields.id
219 +                                       from (data_local,data_template_data)
220 +                                       left join data_input_data on (data_template_data.id=data_input_data.data_template_data_id)
221 +                                       left join data_input_fields on (data_input_data.data_input_field_id=data_input_fields.id)
222                                         where data_local.id=data_template_data.local_data_id
223                                         and data_input_fields.type_code='output_type'
224                                         and data_input_data.value='" . $snmp_query_graph["id"] . "'
225 diff -urbB cacti-0.8.6g/graphs.php cacti/graphs.php
226 --- cacti-0.8.6g/graphs.php     2005-09-09 01:56:25.000000000 +0200
227 +++ cacti/graphs.php    2005-11-24 19:32:45.000000000 +0100
228 @@ -218,7 +218,7 @@
229                         /* we need to find out which graph items will be affected by saving this particular item */
230                         $item_list = db_fetch_assoc("select
231                                 graph_templates_item.id
232 -                               from graph_template_input_defs,graph_templates_item
233 +                               from (graph_template_input_defs,graph_templates_item)
234                                 where graph_template_input_defs.graph_template_item_id=graph_templates_item.local_graph_template_item_id
235                                 and graph_templates_item.local_graph_id=" . $_POST["local_graph_id"] . "
236                                 and graph_template_input_defs.graph_template_input_id=" . $input["id"]);
237 @@ -279,7 +279,7 @@
238                                         case '2': /* delete all data sources referenced by this graph */
239                                                 $data_sources = db_fetch_assoc("select
240                                                         data_template_data.local_data_id
241 -                                                       from data_template_rrd,data_template_data,graph_templates_item
242 +                                                       from (data_template_rrd,data_template_data,graph_templates_item)
243                                                         where graph_templates_item.task_item_id=data_template_rrd.id
244                                                         and data_template_rrd.local_data_id=data_template_data.local_data_id
245                                                         and " . array_to_sql_or($selected_items, "graph_templates_item.local_graph_id") . "
246 @@ -399,7 +399,7 @@
247                         $data_sources = db_fetch_assoc("select
248                                 data_template_data.local_data_id,
249                                 data_template_data.name_cache
250 -                               from data_template_rrd,data_template_data,graph_templates_item
251 +                               from (data_template_rrd,data_template_data,graph_templates_item)
252                                 where graph_templates_item.task_item_id=data_template_rrd.id
253                                 and data_template_rrd.local_data_id=data_template_data.local_data_id
254                                 and " . array_to_sql_or($graph_array, "graph_templates_item.local_graph_id") . "
255 @@ -551,11 +551,11 @@
256                         cdef.name as cdef_name,
257                         colors.hex
258                         from graph_templates_item
259 -                       left join data_template_rrd on graph_templates_item.task_item_id=data_template_rrd.id
260 -                       left join data_local on data_template_rrd.local_data_id=data_local.id
261 -                       left join data_template_data on data_local.id=data_template_data.local_data_id
262 -                       left join cdef on cdef_id=cdef.id
263 -                       left join colors on color_id=colors.id
264 +                       left join data_template_rrd on (graph_templates_item.task_item_id=data_template_rrd.id)
265 +                       left join data_local on (data_template_rrd.local_data_id=data_local.id)
266 +                       left join data_template_data on (data_local.id=data_template_data.local_data_id)
267 +                       left join cdef on (cdef_id=cdef.id)
268 +                       left join colors on (color_id=colors.id)
269                         where graph_templates_item.local_graph_id=" . $_GET["id"] . "
270                         order by graph_templates_item.sequence");
271  
272 @@ -598,11 +598,12 @@
273                 CONCAT_WS(' - ',data_template_data.name,data_template_rrd.data_source_name) as task_item_id,
274                 cdef.name as cdef_id,
275                 colors.hex as color_id
276 -               from graph_templates_item left join data_template_rrd on graph_templates_item.task_item_id=data_template_rrd.id
277 -               left join data_local on data_template_rrd.local_data_id=data_local.id
278 -               left join data_template_data on data_local.id=data_template_data.local_data_id
279 -               left join cdef on cdef_id=cdef.id
280 -               left join colors on color_id=colors.id";
281 +               from graph_templates_item
282 +               left join data_template_rrd on (graph_templates_item.task_item_id=data_template_rrd.id)
283 +               left join data_local on (data_template_rrd.local_data_id=data_local.id)
284 +               left join data_template_data on (data_local.id=data_template_data.local_data_id)
285 +               left join cdef on (cdef_id=cdef.id)
286 +               left join colors on (color_id=colors.id)";
287  
288         /* first, get information about the graph template as that's what we're going to model this
289         graph after */
290 @@ -621,7 +622,7 @@
291         $graph_template_inputs = db_fetch_assoc("select
292                 graph_template_input.column_name,
293                 graph_template_input_defs.graph_template_item_id
294 -               from graph_template_input,graph_template_input_defs
295 +               from (graph_template_input,graph_template_input_defs)
296                 where graph_template_input.id=graph_template_input_defs.graph_template_input_id
297                 and graph_template_input.graph_template_id=" . $_GET["graph_template_id"]);
298  
299 @@ -1037,7 +1038,7 @@
300  
301         $total_rows = db_fetch_cell("select
302                 COUNT(graph_templates_graph.id)
303 -               from graph_local,graph_templates_graph
304 +               from (graph_local,graph_templates_graph)
305                 where graph_local.id=graph_templates_graph.local_graph_id
306                 $sql_where");
307  
308 @@ -1049,8 +1050,8 @@
309                 graph_templates_graph.title_cache,
310                 graph_templates.name,
311                 graph_local.host_id
312 -               from graph_local,graph_templates_graph
313 -               left join graph_templates on graph_local.graph_template_id=graph_templates.id
314 +               from (graph_local,graph_templates_graph)
315 +               left join graph_templates on (graph_local.graph_template_id=graph_templates.id)
316                 where graph_local.id=graph_templates_graph.local_graph_id
317                 $sql_where
318                 order by graph_templates_graph.title_cache,graph_local.host_id
319 diff -urbB cacti-0.8.6g/graph_templates_inputs.php cacti/graph_templates_inputs.php
320 --- cacti-0.8.6g/graph_templates_inputs.php     2005-09-09 01:56:25.000000000 +0200
321 +++ cacti/graph_templates_inputs.php    2005-11-24 19:32:45.000000000 +0100
322 @@ -181,9 +181,9 @@
323                 graph_template_input_defs.graph_template_input_id
324                 from graph_templates_item
325                 left join graph_template_input_defs on (graph_template_input_defs.graph_template_item_id=graph_templates_item.id and graph_template_input_defs.graph_template_input_id=" . $_GET["id"] . ")
326 -               left join data_template_rrd on graph_templates_item.task_item_id=data_template_rrd.id
327 -               left join data_local on data_template_rrd.local_data_id=data_local.id
328 -               left join data_template_data on data_local.id=data_template_data.local_data_id
329 +               left join data_template_rrd on (graph_templates_item.task_item_id=data_template_rrd.id)
330 +               left join data_local on (data_template_rrd.local_data_id=data_local.id)
331 +               left join data_template_data on (data_local.id=data_template_data.local_data_id)
332                 where graph_templates_item.local_graph_id=0
333                 and graph_templates_item.graph_template_id=" . $_GET["graph_template_id"] . "
334                 order by graph_templates_item.sequence");
335 diff -urbB cacti-0.8.6g/graph_templates_items.php cacti/graph_templates_items.php
336 --- cacti-0.8.6g/graph_templates_items.php      2005-09-09 01:56:25.000000000 +0200
337 +++ cacti/graph_templates_items.php     2005-11-24 19:32:45.000000000 +0100
338 @@ -135,7 +135,7 @@
339                                         graph_template_input.id,
340                                         graph_template_input.name,
341                                         graph_templates_item.task_item_id
342 -                                       from graph_template_input,graph_template_input_defs,graph_templates_item
343 +                                       from (graph_template_input,graph_template_input_defs,graph_templates_item)
344                                         where graph_template_input.id=graph_template_input_defs.graph_template_input_id
345                                         and graph_template_input_defs.graph_template_item_id=graph_templates_item.id
346                                         and graph_template_input.graph_template_id=" . $save["graph_template_id"] . "
347 @@ -271,7 +271,7 @@
348         /* delete the graph item input if it is empty */
349         $graph_item_inputs = db_fetch_assoc("select
350                 graph_template_input.id
351 -               from graph_template_input,graph_template_input_defs
352 +               from (graph_template_input,graph_template_input_defs)
353                 where graph_template_input.id=graph_template_input_defs.graph_template_input_id
354                 and graph_template_input.graph_template_id=" . $_GET["graph_template_id"] . "
355                 and graph_template_input_defs.graph_template_item_id=" . $_GET["id"] . "
356 @@ -319,7 +319,7 @@
357         $struct_graph_item["task_item_id"]["sql"] = "select
358                 CONCAT_WS('',data_template.name,' - ',' (',data_template_rrd.data_source_name,')') as name,
359                 data_template_rrd.id
360 -               from data_template_data,data_template_rrd,data_template
361 +               from (data_template_data,data_template_rrd,data_template)
362                 where data_template_rrd.data_template_id=data_template.id
363                 and data_template_data.data_template_id=data_template.id
364                 and data_template_data.local_data_id=0
365 @@ -341,7 +341,7 @@
366                 $graph_item_input_fields = db_fetch_assoc("select
367                         graph_template_input.id,
368                         graph_template_input.column_name
369 -                       from graph_template_input,graph_template_input_defs
370 +                       from (graph_template_input,graph_template_input_defs)
371                         where graph_template_input.id=graph_template_input_defs.graph_template_input_id
372                         and graph_template_input.graph_template_id=" . $_GET["graph_template_id"] . "
373                         and graph_template_input_defs.graph_template_item_id=" . $_GET["id"] . "
374 diff -urbB cacti-0.8.6g/graph_templates.php cacti/graph_templates.php
375 --- cacti-0.8.6g/graph_templates.php    2005-09-09 01:56:25.000000000 +0200
376 +++ cacti/graph_templates.php   2005-11-24 19:32:45.000000000 +0100
377 @@ -292,11 +292,11 @@
378                         cdef.name as cdef_name,
379                         colors.hex
380                         from graph_templates_item
381 -                       left join data_template_rrd on graph_templates_item.task_item_id=data_template_rrd.id
382 -                       left join data_local on data_template_rrd.local_data_id=data_local.id
383 -                       left join data_template_data on data_local.id=data_template_data.local_data_id
384 -                       left join cdef on cdef_id=cdef.id
385 -                       left join colors on color_id=colors.id
386 +                       left join data_template_rrd on (graph_templates_item.task_item_id=data_template_rrd.id)
387 +                       left join data_local on (data_template_rrd.local_data_id=data_local.id)
388 +                       left join data_template_data on (data_local.id=data_template_data.local_data_id)
389 +                       left join cdef on (cdef_id=cdef.id)
390 +                       left join colors on (color_id=colors.id)
391                         where graph_templates_item.graph_template_id=" . $_GET["id"] . "
392                         and graph_templates_item.local_graph_id=0
393                         order by graph_templates_item.sequence");
394 diff -urbB cacti-0.8.6g/graph_view.php cacti/graph_view.php
395 --- cacti-0.8.6g/graph_view.php 2005-09-09 01:56:25.000000000 +0200
396 +++ cacti/graph_view.php        2005-11-24 19:32:45.000000000 +0100
397 @@ -156,8 +156,8 @@
398         if (read_config_option("global_auth") == "on") {
399                 $sql_where = "where " . get_graph_permissions_sql($current_user["policy_graphs"], $current_user["policy_hosts"], $current_user["policy_graph_templates"]);
400  
401 -               $sql_join = "left join host on host.id=graph_local.host_id
402 -                       left join graph_templates on graph_templates.id=graph_local.graph_template_id
403 +               $sql_join = "left join host on (host.id=graph_local.host_id)
404 +                       left join graph_templates on (graph_templates.id=graph_local.graph_template_id)
405                         left join user_auth_perms on ((graph_templates_graph.local_graph_id=user_auth_perms.item_id and user_auth_perms.type=1 and user_auth_perms.user_id=" . $_SESSION["sess_user_id"] . ") OR (host.id=user_auth_perms.item_id and user_auth_perms.type=3 and user_auth_perms.user_id=" . $_SESSION["sess_user_id"] . ") OR (graph_templates.id=user_auth_perms.item_id and user_auth_perms.type=4 and user_auth_perms.user_id=" . $_SESSION["sess_user_id"] . "))";
406         }else{
407                 $sql_where = "";
408 @@ -207,7 +207,7 @@
409                 }
410         }
411  
412 -       $sql_base = "from graph_templates_graph,graph_local
413 +       $sql_base = "from (graph_templates_graph,graph_local)
414                 $sql_join
415                 $sql_where
416                 " . (empty($sql_where) ? "where" : "and") . " graph_templates_graph.local_graph_id > 0
417 @@ -426,8 +426,8 @@
418         if (read_config_option("global_auth") == "on") {
419                 /* get policy information for the sql where clause */
420                 $sql_where = "where " . get_graph_permissions_sql($current_user["policy_graphs"], $current_user["policy_hosts"], $current_user["policy_graph_templates"]);
421 -               $sql_join = "left join host on host.id=graph_local.host_id
422 -                       left join graph_templates on graph_templates.id=graph_local.graph_template_id
423 +               $sql_join = "left join host on (host.id=graph_local.host_id)
424 +                       left join graph_templates on (graph_templates.id=graph_local.graph_template_id)
425                         left join user_auth_perms on ((graph_templates_graph.local_graph_id=user_auth_perms.item_id and user_auth_perms.type=1 and user_auth_perms.user_id=" . $_SESSION["sess_user_id"] . ") OR (host.id=user_auth_perms.item_id and user_auth_perms.type=3 and user_auth_perms.user_id=" . $_SESSION["sess_user_id"] . ") OR (graph_templates.id=user_auth_perms.item_id and user_auth_perms.type=4 and user_auth_perms.user_id=" . $_SESSION["sess_user_id"] . "))";
426  
427         }else{
428 @@ -435,7 +435,7 @@
429                 $sql_join = "";
430         }
431  
432 -       $sql_base = "from graph_templates_graph,graph_local
433 +       $sql_base = "from (graph_templates_graph,graph_local)
434                 $sql_join
435                 $sql_where
436                 " . (empty($sql_where) ? "where" : "and") . " graph_templates_graph.local_graph_id > 0
437 diff -urbB cacti-0.8.6g/host.php cacti/host.php
438 --- cacti-0.8.6g/host.php       2005-09-09 01:56:25.000000000 +0200
439 +++ cacti/host.php      2005-11-24 19:32:45.000000000 +0100
440 @@ -509,7 +514,7 @@
441                 $selected_graph_templates = db_fetch_assoc("select
442                         graph_templates.id,
443                         graph_templates.name
444 -                       from graph_templates,host_graph
445 +                       from (graph_templates,host_graph)
446                         where graph_templates.id=host_graph.graph_template_id
447                         and host_graph.host_id=" . $_GET["id"] . "
448                         order by graph_templates.name");
449 @@ -517,7 +522,7 @@
450                 $available_graph_templates = db_fetch_assoc("SELECT
451                         graph_templates.id, graph_templates.name
452                         FROM snmp_query_graph RIGHT JOIN graph_templates
453 -                       ON snmp_query_graph.graph_template_id = graph_templates.id
454 +                       ON (snmp_query_graph.graph_template_id = graph_templates.id)
455                         WHERE (((snmp_query_graph.name) Is Null)) ORDER BY graph_templates.name");
456  
457                 $i = 0;
458 @@ -569,7 +574,7 @@
459                         snmp_query.id,
460                         snmp_query.name,
461                         host_snmp_query.reindex_method
462 -                       from snmp_query,host_snmp_query
463 +                       from (snmp_query,host_snmp_query)
464                         where snmp_query.id=host_snmp_query.snmp_query_id
465                         and host_snmp_query.host_id=" . $_GET["id"] . "
466                         order by snmp_query.name");
467 diff -urbB cacti-0.8.6g/host_templates.php cacti/host_templates.php
468 --- cacti-0.8.6g/host_templates.php     2005-09-09 01:56:25.000000000 +0200
469 +++ cacti/host_templates.php    2005-11-24 19:32:45.000000000 +0100
470 @@ -261,7 +261,7 @@
471                 $selected_graph_templates = db_fetch_assoc("select
472                         graph_templates.id,
473                         graph_templates.name
474 -                       from graph_templates,host_template_graph
475 +                       from (graph_templates,host_template_graph)
476                         where graph_templates.id=host_template_graph.graph_template_id
477                         and host_template_graph.host_template_id=" . $_GET["id"] . "
478                         order by graph_templates.name");
479 @@ -311,7 +311,7 @@
480                 $selected_data_queries = db_fetch_assoc("select
481                         snmp_query.id,
482                         snmp_query.name
483 -                       from snmp_query,host_template_snmp_query
484 +                       from (snmp_query,host_template_snmp_query)
485                         where snmp_query.id=host_template_snmp_query.snmp_query_id
486                         and host_template_snmp_query.host_template_id=" . $_GET["id"] . "
487                         order by snmp_query.name");
488 diff -urbB cacti-0.8.6g/include/config_form.php cacti/include/config_form.php
489 --- cacti-0.8.6g/include/config_form.php        2005-09-09 01:56:25.000000000 +0200
490 +++ cacti/include/config_form.php       2005-11-24 19:32:42.000000000 +0100
491 @@ -243,7 +243,7 @@
492                 "form_id" => "|arg1:id|",
493                 "sql" => "select rra_id as id,data_template_data_id from data_template_data_rra where data_template_data_id=|arg1:id|",
494                 "sql_all" => "select rra.id from rra order by id",
495 -               "sql_print" => "select rra.name from data_template_data_rra,rra where data_template_data_rra.rra_id=rra.id and data_template_data_rra.data_template_data_id=|arg1:id|",
496 +               "sql_print" => "select rra.name from (data_template_data_rra,rra) where data_template_data_rra.rra_id=rra.id and data_template_data_rra.data_template_data_id=|arg1:id|",
497                 "flags" => "ALWAYSTEMPLATE"
498                 ),
499         "rrd_step" => array(
500 @@ -474,8 +474,8 @@
501                 "sql" => "select
502                         CONCAT_WS('',case when host.description is null then 'No Host' when host.description is not null then host.description end,' - ',data_template_data.name,' (',data_template_rrd.data_source_name,')') as name,
503                         data_template_rrd.id
504 -                       from data_template_data,data_template_rrd,data_local
505 -                       left join host on data_local.host_id=host.id
506 +                       from (data_template_data,data_template_rrd,data_local)
507 +                       left join host on (data_local.host_id=host.id)
508                         where data_template_rrd.local_data_id=data_local.id
509                         and data_template_data.local_data_id=data_local.id
510                         order by name",
511 @@ -628,7 +628,7 @@
512                 "description" => "Choose what type of host, host template this is. The host template will govern what kinds of data should be gathered from this type of host.",
513                 "value" => "|arg1:host_template_id|",
514                 "none_value" => "None",
515 -               "sql" => "select id,name from host_template",
516 +               "sql" => "select id,name from host_template order by name",
517                 ),
518         "disabled" => array(
519                 "method" => "checkbox",
520 diff -urbB cacti-0.8.6g/install/0_8_6_to_0_8_6a.php cacti/install/0_8_6_to_0_8_6a.php
521 --- cacti-0.8.6g/install/0_8_6_to_0_8_6a.php    2005-09-09 01:56:25.000000000 +0200
522 +++ cacti/install/0_8_6_to_0_8_6a.php   2005-11-24 19:32:44.000000000 +0100
523 @@ -56,7 +56,7 @@
524                         /* find non-templated graph template items */
525                         $non_templated_items = array_rekey(db_fetch_assoc("select
526                                 graph_template_input_defs.graph_template_item_id
527 -                               from graph_template_input,graph_template_input_defs
528 +                               from (graph_template_input,graph_template_input_defs)
529                                 where graph_template_input_defs.graph_template_input_id=graph_template_input.id
530                                 and graph_template_input.column_name = 'task_item_id'
531                                 and graph_template_input.graph_template_id = '" . $graph_template["id"] . "'"), "graph_template_item_id", "graph_template_item_id");
532 diff -urbB cacti-0.8.6g/lib/auth.php cacti/lib/auth.php
533 --- cacti-0.8.6g/lib/auth.php   2005-09-09 01:56:25.000000000 +0200
534 +++ cacti/lib/auth.php  2005-11-24 19:32:36.000000000 +0100
535 @@ -130,9 +130,9 @@
536         
537         $graphs = db_fetch_assoc("select
538                 graph_templates_graph.local_graph_id
539 -               from graph_templates_graph,graph_local
540 -               left join host on host.id=graph_local.host_id
541 -               left join graph_templates on graph_templates.id=graph_local.graph_template_id
542 +               from (graph_templates_graph,graph_local)
543 +               left join host on (host.id=graph_local.host_id)
544 +               left join graph_templates on (graph_templates.id=graph_local.graph_template_id)
545                 left join user_auth_perms on ((graph_templates_graph.local_graph_id=user_auth_perms.item_id and user_auth_perms.type=1 and user_auth_perms.user_id=" . $_SESSION["sess_user_id"] . ") OR (host.id=user_auth_perms.item_id and user_auth_perms.type=3 and user_auth_perms.user_id=" . $_SESSION["sess_user_id"] . ") OR (graph_templates.id=user_auth_perms.item_id and user_auth_perms.type=4 and user_auth_perms.user_id=" . $_SESSION["sess_user_id"] . "))
546                 where graph_templates_graph.local_graph_id=graph_local.id
547                 " . (empty($sql_where) ? "" : "and $sql_where") . "
548 diff -urbB cacti-0.8.6g/lib/data_query.php cacti/lib/data_query.php
549 --- cacti-0.8.6g/lib/data_query.php     2005-09-09 01:56:25.000000000 +0200
550 +++ cacti/lib/data_query.php    2005-11-24 19:32:36.000000000 +0100
551 @@ -31,7 +31,7 @@
552         include_once($config["library_path"] . "/utility.php");
553  
554         debug_log_insert("data_query", "Running data query [$snmp_query_id].");
555 -       $type_id = db_fetch_cell("select data_input.type_id from snmp_query,data_input where snmp_query.data_input_id=data_input.id and snmp_query.id=$snmp_query_id");
556 +       $type_id = db_fetch_cell("select data_input.type_id from (snmp_query,data_input) where snmp_query.data_input_id=data_input.id and snmp_query.id=$snmp_query_id");
557  
558         if ($type_id == DATA_INPUT_TYPE_SNMP_QUERY) {
559                 debug_log_insert("data_query", "Found type = '3' [snmp query].");
560 @@ -301,7 +301,7 @@
561         $field = db_fetch_assoc("select
562                 data_input_fields.type_code,
563                 data_input_data.value
564 -               from data_input_fields,data_input_data
565 +               from (data_input_fields,data_input_data)
566                 where data_input_fields.id=data_input_data.data_input_field_id
567                 and data_input_data.data_template_data_id=$data_template_data_id
568                 and (data_input_fields.type_code='index_type' or data_input_fields.type_code='index_value' or data_input_fields.type_code='output_type')");
569 @@ -372,7 +372,7 @@
570  
571         $field = data_query_field_list(db_fetch_cell("select
572                 data_template_data.id
573 -               from graph_templates_item,data_template_rrd,data_template_data
574 +               from (graph_templates_item,data_template_rrd,data_template_data)
575                 where graph_templates_item.task_item_id=data_template_rrd.id
576                 and data_template_rrd.local_data_id=data_template_data.local_data_id
577                 and graph_templates_item.local_graph_id=$local_graph_id
578 @@ -441,7 +441,7 @@
579         $sort_field_data = array_rekey(db_fetch_assoc("select
580                 graph_local.snmp_index,
581                 host_snmp_cache.field_value
582 -               from graph_local,host_snmp_cache
583 +               from (graph_local,host_snmp_cache)
584                 where graph_local.host_id=host_snmp_cache.host_id
585                 and graph_local.snmp_query_id=host_snmp_cache.snmp_query_id
586                 and graph_local.snmp_index=host_snmp_cache.snmp_index
587 diff -urbB cacti-0.8.6g/lib/export.php cacti/lib/export.php
588 --- cacti-0.8.6g/lib/export.php 2005-09-09 01:56:25.000000000 +0200
589 +++ cacti/lib/export.php        2005-11-24 19:32:36.000000000 +0100
590 @@ -646,7 +646,7 @@
591                 /* dep: data template */
592                 $graph_template_items = db_fetch_assoc("select
593                         data_template_rrd.data_template_id
594 -                       from graph_templates_item,data_template_rrd
595 +                       from (graph_templates_item,data_template_rrd)
596                         where graph_templates_item.task_item_id=data_template_rrd.id
597                         and graph_templates_item.graph_template_id=$id
598                         and graph_templates_item.local_graph_id=0
599 diff -urbB cacti-0.8.6g/lib/functions.php cacti/lib/functions.php
600 --- cacti-0.8.6g/lib/functions.php      2005-09-09 01:56:25.000000000 +0200
601 +++ cacti/lib/functions.php     2005-11-24 19:32:36.000000000 +0100
602 @@ -678,7 +678,7 @@
603                 data_template_data.data_input_id,
604                 data_input.type_id,
605                 data_input.input_string
606 -               from data_template_data,data_input
607 +               from (data_template_data,data_input)
608                 where data_template_data.data_input_id=data_input.id
609                 and data_template_data.local_data_id=$local_data_id");
610  
611 @@ -692,7 +692,7 @@
612                 data_input_data.value
613                 from data_input_fields
614                 left join data_input_data
615 -               on data_input_fields.id=data_input_data.data_input_field_id
616 +               on (data_input_fields.id=data_input_data.data_input_field_id)
617                 where data_input_fields.data_input_id=" . $data_source["data_input_id"] . "
618                 and data_input_data.data_template_data_id=" . $data_source["id"] . "
619                 and data_input_fields.input_output='in'");
620 @@ -726,7 +726,7 @@
621         $data_source = db_fetch_row("select
622                 data_template_rrd.data_source_name,
623                 data_template_data.name
624 -               from data_template_rrd,data_template_data
625 +               from (data_template_rrd,data_template_data)
626                 where data_template_rrd.local_data_id=data_template_data.local_data_id
627                 and data_template_rrd.id=$data_template_rrd_id");
628  
629 @@ -830,7 +830,7 @@
630                 data_local.snmp_query_id,
631                 data_local.snmp_index,
632                 data_template_data.name
633 -               from data_template_data,data_local
634 +               from (data_template_data,data_local)
635                 where data_template_data.local_data_id=data_local.id
636                 and data_local.id=$local_data_id");
637  
638 @@ -850,7 +850,7 @@
639                 graph_local.snmp_query_id,
640                 graph_local.snmp_index,
641                 graph_templates_graph.title
642 -               from graph_templates_graph,graph_local
643 +               from (graph_templates_graph,graph_local)
644                 where graph_templates_graph.local_graph_id=graph_local.id
645                 and graph_local.id=$local_graph_id");
646  
647 @@ -869,7 +869,7 @@
648         $host_part = ""; $ds_part = "";
649  
650         /* try any prepend the name with the host description */
651 -       $host_name = db_fetch_cell("select host.description from host,data_local where data_local.host_id=host.id and data_local.id=$local_data_id");
652 +       $host_name = db_fetch_cell("select host.description from (host,data_local) where data_local.host_id=host.id and data_local.id=$local_data_id");
653  
654         if (!empty($host_name)) {
655                 $host_part = strtolower(clean_up_name($host_name)) . "_";
656 @@ -1424,7 +1420,7 @@
657                 rra.name,
658                 rra.timespan,
659                 data_template_data.rrd_step
660 -               from graph_templates_item,data_template_data_rra,data_template_rrd,data_template_data,rra
661 +               from (graph_templates_item,data_template_data_rra,data_template_rrd,data_template_data,rra)
662                 where graph_templates_item.task_item_id=data_template_rrd.id
663                 and data_template_rrd.local_data_id=data_template_data.local_data_id
664                 and data_template_data.id=data_template_data_rra.data_template_data_id
665 diff -urbB cacti-0.8.6g/lib/graph_export.php cacti/lib/graph_export.php
666 --- cacti-0.8.6g/lib/graph_export.php   2005-09-09 01:56:25.000000000 +0200
667 +++ cacti/lib/graph_export.php  2005-11-24 19:32:36.000000000 +0100
668 @@ -332,8 +339,9 @@
669                         graph_templates_graph.title_cache,
670                         graph_templates.name,
671                         graph_local.host_id
672 -                       from graph_templates_graph left join graph_templates on graph_templates_graph.graph_template_id=graph_templates.id
673 -                       left join graph_local on graph_templates_graph.local_graph_id=graph_local.id
674 +                       from graph_templates_graph
675 +                       left join graph_templates on (graph_templates_graph.graph_template_id=graph_templates.id)
676 +                       left join graph_local on (graph_templates_graph.local_graph_id=graph_local.id)
677                         where graph_templates_graph.local_graph_id!=0 and graph_templates_graph.export='on'
678                         order by graph_templates_graph.title_cache");
679  
680 @@ -550,8 +558,8 @@
681                                 graph_templates.name,
682                                 graph_local.host_id
683                         from graph_templates_graph
684 -                               left join graph_templates on graph_templates_graph.graph_template_id=graph_templates.id
685 -                           left join graph_local on graph_templates_graph.local_graph_id=graph_local.id
686 +                               left join graph_templates on (graph_templates_graph.graph_template_id=graph_templates.id)
687 +                           left join graph_local on (graph_templates_graph.local_graph_id=graph_local.id)
688                         where graph_local.host_id=".get_host_id($parent_tree_item_id)."
689                           and graph_templates_graph.local_graph_id!=0
690                           and graph_templates_graph.export='on'
691 @@ -568,9 +576,9 @@
692                                 graph_local.host_id,
693                                 graph_tree_items.id as gtid
694                         from graph_templates_graph
695 -                               left join graph_tree_items on graph_templates_graph.local_graph_id=graph_tree_items.local_graph_id
696 -                           left join graph_templates on graph_templates_graph.graph_template_id=graph_templates.id
697 -                           left join graph_local on graph_templates_graph.local_graph_id=graph_local.id
698 +                               left join graph_tree_items on (graph_templates_graph.local_graph_id=graph_tree_items.local_graph_id)
699 +                           left join graph_templates on (graph_templates_graph.graph_template_id=graph_templates.id)
700 +                           left join graph_local on (graph_templates_graph.local_graph_id=graph_local.id)
701                         where graph_tree_items.graph_tree_id =".$tree_id."
702                           and graph_templates_graph.local_graph_id!=0
703                           and graph_templates_graph.export='on'
704 @@ -776,7 +784,7 @@
705                 graph_tree_items.host_grouping_type,
706                 host.description as hostname
707                 from graph_tree_items
708 -               left join host on host.id=graph_tree_items.host_id
709 +               left join host on (host.id=graph_tree_items.host_id)
710                 where graph_tree_items.graph_tree_id=" . $tree_id . "
711                 and graph_tree_items.local_graph_id = 0
712                 order by graph_tree_items.order_key");
713 @@ -796,7 +804,7 @@
714                                         $graph_templates = db_fetch_assoc("select
715                                                 graph_templates.id,
716                                                 graph_templates.name
717 -                                               from graph_local,graph_templates,graph_templates_graph
718 +                                               from (graph_local,graph_templates,graph_templates_graph)
719                                                 where graph_local.id=graph_templates_graph.local_graph_id
720                                                 and graph_templates_graph.graph_template_id=graph_templates.id
721                                                 and graph_local.host_id=" . $leaf["host_id"] . "
722 @@ -813,7 +821,7 @@
723                                         $data_queries = db_fetch_assoc("select
724                                                 snmp_query.id,
725                                                 snmp_query.name
726 -                                               from graph_local,snmp_query
727 +                                               from (graph_local,snmp_query)
728                                                 where graph_local.snmp_query_id=snmp_query.id
729                                                 and graph_local.host_id=" . $leaf["host_id"] . "
730                                                 group by snmp_query.id
731 diff -urbB cacti-0.8.6g/lib/html_form_template.php cacti/lib/html_form_template.php
732 --- cacti-0.8.6g/lib/html_form_template.php     2005-09-09 01:56:25.000000000 +0200
733 +++ cacti/lib/html_form_template.php    2005-11-24 19:32:36.000000000 +0100
734 @@ -125,8 +125,8 @@
735                         when host.description is not null then ''
736                         end,data_template_data.name_cache,' (',data_template_rrd.data_source_name,')') as name,
737                         data_template_rrd.id
738 -                       from data_template_data,data_template_rrd,data_local
739 -                       left join host on data_local.host_id=host.id
740 +                       from (data_template_data,data_template_rrd,data_local)
741 +                       left join host on (data_local.host_id=host.id)
742                         where data_template_rrd.local_data_id=data_local.id
743                         and data_template_data.local_data_id=data_local.id
744                         " . (empty($host_id) ? "" : " and data_local.host_id=$host_id") . "
745 @@ -139,7 +139,7 @@
746                                 $current_def_value = db_fetch_row("select
747                                         graph_templates_item." . $item["column_name"] . ",
748                                         graph_templates_item.id
749 -                                       from graph_templates_item,graph_template_input_defs
750 +                                       from (graph_templates_item,graph_template_input_defs)
751                                         where graph_template_input_defs.graph_template_item_id=graph_templates_item.local_graph_template_item_id
752                                         and graph_template_input_defs.graph_template_input_id=" . $item["id"] . "
753                                         and graph_templates_item.local_graph_id=$local_graph_id
754 @@ -148,7 +148,7 @@
755                                 $current_def_value = db_fetch_row("select
756                                         graph_templates_item." . $item["column_name"] . ",
757                                         graph_templates_item.id
758 -                                       from graph_templates_item,graph_template_input_defs
759 +                                       from (graph_templates_item,graph_template_input_defs)
760                                         where graph_template_input_defs.graph_template_item_id=graph_templates_item.id
761                                         and graph_template_input_defs.graph_template_input_id=" . $item["id"] . "
762                                         and graph_templates_item.graph_template_id=" . $graph_template_id . "
763 @@ -397,13 +397,13 @@
764         global $colors;
765  
766         $data = db_fetch_row("select id,data_input_id,data_template_id,name,local_data_id from data_template_data where id=$data_template_data_id");
767 -       $host_id = db_fetch_cell("select host.id from data_local,host where data_local.host_id=host.id and data_local.id=" . $data["local_data_id"]);
768 +       $host_id = db_fetch_cell("select host.id from (data_local,host) where data_local.host_id=host.id and data_local.id=" . $data["local_data_id"]);
769         $template_data = db_fetch_row("select id,data_input_id from data_template_data where data_template_id=" . $data["data_template_id"] . " and local_data_id=0");
770  
771         $draw_any_items = false;
772  
773         /* get each INPUT field for this data input source */
774 -       $fields = db_fetch_assoc("select * from data_input_fields where data_input_id=" . $data["data_input_id"] . " and input_output='in' order by name");
775 +       $fields = db_fetch_assoc("select * from data_input_fields where data_input_id=" . $data["data_input_id"] . " and input_output='in' order by sequence");
776  
777         /* loop through each field found */
778         $i = 0;
779 @@ -481,7 +481,7 @@
780         if (($field["type_code"] == "index_type") && (db_fetch_cell("select local_data_id from data_template_data where id=$data_template_data_id") > 0)) {
781                 $index_type = db_fetch_assoc("select
782                         host_snmp_cache.field_name
783 -                       from data_template_data,data_local,host_snmp_cache
784 +                       from (data_template_data,data_local,host_snmp_cache)
785                         where data_template_data.local_data_id=data_local.id
786                         and data_local.snmp_query_id=host_snmp_cache.snmp_query_id
787                         and data_template_data.id=$data_template_data_id
788 @@ -496,7 +496,7 @@
789                 $output_type = db_fetch_assoc("select
790                         snmp_query_graph.id,
791                         snmp_query_graph.name
792 -                       from data_template_data,data_local,snmp_query_graph
793 +                       from (data_template_data,data_local,snmp_query_graph)
794                         where data_template_data.local_data_id=data_local.id
795                         and data_local.snmp_query_id=snmp_query_graph.snmp_query_id
796                         and data_template_data.id=$data_template_data_id
797 diff -urbB cacti-0.8.6g/lib/html_tree.php cacti/lib/html_tree.php
798 --- cacti-0.8.6g/lib/html_tree.php      2005-09-09 01:56:25.000000000 +0200
799 +++ cacti/lib/html_tree.php     2005-11-24 19:32:36.000000000 +0100
800 @@ -49,8 +49,8 @@
801                 /* get policy information for the sql where clause */
802                 $sql_where = get_graph_permissions_sql($current_user["policy_graphs"], $current_user["policy_hosts"], $current_user["policy_graph_templates"]);
803                 $sql_where = (empty($sql_where) ? "" : "and (" . $sql_where . " OR graph_tree_items.local_graph_id=0)");
804 -               $sql_join = "left join graph_local on graph_templates_graph.local_graph_id=graph_local.id
805 -                       left join graph_templates on graph_templates.id=graph_local.graph_template_id
806 +               $sql_join = "left join graph_local on (graph_templates_graph.local_graph_id=graph_local.id)
807 +                       left join graph_templates on (graph_templates.id=graph_local.graph_template_id)
808                         left join user_auth_perms on ((graph_templates_graph.local_graph_id=user_auth_perms.item_id and user_auth_perms.type=1 and user_auth_perms.user_id=" . $_SESSION["sess_user_id"] . ") OR (host.id=user_auth_perms.item_id and user_auth_perms.type=3 and user_auth_perms.user_id=" . $_SESSION["sess_user_id"] . ") OR (graph_templates.id=user_auth_perms.item_id and user_auth_perms.type=4 and user_auth_perms.user_id=" . $_SESSION["sess_user_id"] . "))";
809         }
810  
811 @@ -75,7 +75,7 @@
812                 from graph_tree_items
813                 left join graph_templates_graph on (graph_tree_items.local_graph_id=graph_templates_graph.local_graph_id and graph_tree_items.local_graph_id>0)
814                 left join settings_tree on (graph_tree_items.id=settings_tree.graph_tree_item_id and settings_tree.user_id=$user_id)
815 -               left join host on graph_tree_items.host_id=host.id
816 +               left join host on (graph_tree_items.host_id=host.id)
817                 $sql_join
818                 where graph_tree_items.graph_tree_id=$tree_id
819                 and graph_tree_items.order_key like '$search_key%'
820 @@ -118,7 +118,7 @@
821                                 $graph_templates = db_fetch_assoc("select
822                                         graph_templates.id,
823                                         graph_templates.name
824 -                                       from graph_local,graph_templates,graph_templates_graph
825 +                                       from (graph_local,graph_templates,graph_templates_graph)
826                                         where graph_local.id=graph_templates_graph.local_graph_id
827                                         and graph_templates_graph.graph_template_id=graph_templates.id
828                                         and graph_local.host_id=" . $leaf["host_id"] . "
829 @@ -133,7 +133,7 @@
830                                         $graphs = db_fetch_assoc("select
831                                                 graph_templates_graph.title_cache,
832                                                 graph_templates_graph.local_graph_id
833 -                                               from graph_local,graph_templates,graph_templates_graph
834 +                                               from (graph_local,graph_templates,graph_templates_graph)
835                                                 where graph_local.id=graph_templates_graph.local_graph_id
836                                                 and graph_templates_graph.graph_template_id=graph_templates.id
837                                                 and graph_local.graph_template_id=" . $graph_template["id"] . "
838 @@ -202,7 +202,7 @@
839                 CONCAT_WS('',description,' (',hostname,')') as hostname
840                 from graph_tree_items
841                 left join graph_templates_graph on (graph_tree_items.local_graph_id=graph_templates_graph.local_graph_id and graph_tree_items.local_graph_id>0)
842 -               left join host on host.id=graph_tree_items.host_id
843 +               left join host on (host.id=graph_tree_items.host_id)
844                 where graph_tree_items.graph_tree_id=$tree_id
845                 order by graph_tree_items.order_key");
846  
847 @@ -370,7 +370,7 @@
848                                 graph_tree_items.host_grouping_type,
849                                 host.description as hostname
850                                 from graph_tree_items
851 -                               left join host on host.id=graph_tree_items.host_id
852 +                               left join host on (host.id=graph_tree_items.host_id)
853                                 $sql_join
854                                 where graph_tree_items.graph_tree_id=" . $tree["id"] . "
855                                 $sql_where
856 @@ -392,7 +392,7 @@
857                                                                 $graph_templates = db_fetch_assoc("select
858                                                                         graph_templates.id,
859                                                                         graph_templates.name
860 -                                                                       from graph_local,graph_templates,graph_templates_graph
861 +                                                                       from (graph_local,graph_templates,graph_templates_graph)
862                                                                         where graph_local.id=graph_templates_graph.local_graph_id
863                                                                         and graph_templates_graph.graph_template_id=graph_templates.id
864                                                                         and graph_local.host_id=" . $leaf["host_id"] . "
865 @@ -409,7 +409,7 @@
866                                                                 $data_queries = db_fetch_assoc("select
867                                                                         snmp_query.id,
868                                                                         snmp_query.name
869 -                                                                       from graph_local,snmp_query
870 +                                                                       from (graph_local,snmp_query)
871                                                                         where graph_local.snmp_query_id=snmp_query.id
872                                                                         and graph_local.host_id=" . $leaf["host_id"] . "
873                                                                         group by snmp_query.id
874 @@ -477,15 +477,15 @@
875                 $sql_where = get_graph_permissions_sql($current_user["policy_graphs"], $current_user["policy_hosts"], $current_user["policy_graph_templates"]);
876                 $sql_where = (empty($sql_where) ? "" : "and $sql_where");
877                 $sql_join = "
878 -                       left join host on host.id=graph_local.host_id
879 -                       left join graph_templates on graph_templates.id=graph_local.graph_template_id
880 +                       left join host on (host.id=graph_local.host_id)
881 +                       left join graph_templates on (graph_templates.id=graph_local.graph_template_id)
882                         left join user_auth_perms on ((graph_templates_graph.local_graph_id=user_auth_perms.item_id and user_auth_perms.type=1 and user_auth_perms.user_id=" . $_SESSION["sess_user_id"] . ") OR (host.id=user_auth_perms.item_id and user_auth_perms.type=3 and user_auth_perms.user_id=" . $_SESSION["sess_user_id"] . ") OR (graph_templates.id=user_auth_perms.item_id and user_auth_perms.type=4 and user_auth_perms.user_id=" . $_SESSION["sess_user_id"] . "))";
883         }
884  
885         /* get information for the headers */
886         if (!empty($tree_id)) { $tree_name = db_fetch_cell("select name from graph_tree where id=$tree_id"); }
887         if (!empty($leaf_id)) { $leaf_name = $leaf["title"]; }
888 -       if (!empty($leaf_id)) { $host_name = db_fetch_cell("select host.description from graph_tree_items,host where graph_tree_items.host_id=host.id and graph_tree_items.id=$leaf_id"); }
889 +       if (!empty($leaf_id)) { $host_name = db_fetch_cell("select host.description from (graph_tree_items,host) where graph_tree_items.host_id=host.id and graph_tree_items.id=$leaf_id"); }
890  
891         $host_group_data_array = explode(":", $host_group_data);
892  
893 @@ -528,7 +528,7 @@
894                         graph_tree_items.rra_id,
895                         graph_tree_items.order_key,
896                         graph_templates_graph.title_cache as title_cache
897 -                       from graph_tree_items,graph_local
898 +                       from (graph_tree_items,graph_local)
899                         left join graph_templates_graph on (graph_tree_items.local_graph_id=graph_templates_graph.local_graph_id and graph_tree_items.local_graph_id>0)
900                         $sql_join
901                         where graph_tree_items.graph_tree_id=$tree_id
902 @@ -550,7 +550,7 @@
903                         $graph_templates = db_fetch_assoc("select
904                                 graph_templates.id,
905                                 graph_templates.name
906 -                               from graph_local,graph_templates,graph_templates_graph
907 +                               from (graph_local,graph_templates,graph_templates_graph)
908                                 where graph_local.id=graph_templates_graph.local_graph_id
909                                 and graph_templates_graph.graph_template_id=graph_templates.id
910                                 and graph_local.host_id=" . $leaf["host_id"] . "
911 @@ -569,7 +569,7 @@
912                                 $graphs = db_fetch_assoc("select
913                                         graph_templates_graph.title_cache,
914                                         graph_templates_graph.local_graph_id
915 -                                       from graph_local,graph_templates_graph
916 +                                       from (graph_local,graph_templates_graph)
917                                         $sql_join
918                                         where graph_local.id=graph_templates_graph.local_graph_id
919                                         and graph_local.graph_template_id=" . $graph_template["id"] . "
920 @@ -589,7 +589,7 @@
921                         $data_queries = db_fetch_assoc("select
922                                 snmp_query.id,
923                                 snmp_query.name
924 -                               from graph_local,snmp_query
925 +                               from (graph_local,snmp_query)
926                                 where graph_local.snmp_query_id=snmp_query.id
927                                 and graph_local.host_id=" . $leaf["host_id"] . "
928                                 " . (!isset($data_query_id) ? "" : "and snmp_query.id=$data_query_id") . "
929 @@ -614,7 +614,7 @@
930                                         graph_templates_graph.title_cache,
931                                         graph_templates_graph.local_graph_id,
932                                         graph_local.snmp_index
933 -                                       from graph_local,graph_templates_graph
934 +                                       from (graph_local,graph_templates_graph)
935                                         $sql_join
936                                         where graph_local.id=graph_templates_graph.local_graph_id
937                                         and graph_local.snmp_query_id=" . $data_query["id"] . "
938 diff -urbB cacti-0.8.6g/lib/import.php cacti/lib/import.php
939 --- cacti-0.8.6g/lib/import.php 2005-09-09 01:56:25.000000000 +0200
940 +++ cacti/lib/import.php        2005-11-24 19:32:36.000000000 +0100
941 @@ -114,7 +114,7 @@
942  
943         /* import into: graph_templates_graph */
944         unset($save);
945 -       $save["id"] = (empty($_graph_template_id) ? "0" : db_fetch_cell("select graph_templates_graph.id from graph_templates,graph_templates_graph where graph_templates.id=graph_templates_graph.graph_template_id and graph_templates.id=$graph_template_id and graph_templates_graph.local_graph_id=0"));
946 +       $save["id"] = (empty($_graph_template_id) ? "0" : db_fetch_cell("select graph_templates_graph.id from (graph_templates,graph_templates_graph) where graph_templates.id=graph_templates_graph.graph_template_id and graph_templates.id=$graph_template_id and graph_templates_graph.local_graph_id=0"));
947         $save["graph_template_id"] = $graph_template_id;
948  
949         /* parse information from the hash */
950 @@ -251,7 +251,7 @@
951  
952         /* import into: data_template_data */
953         unset($save);
954 -       $save["id"] = (empty($_data_template_id) ? "0" : db_fetch_cell("select data_template_data.id from data_template,data_template_data where data_template.id=data_template_data.data_template_id and data_template.id=$data_template_id and data_template_data.local_data_id=0"));
955 +       $save["id"] = (empty($_data_template_id) ? "0" : db_fetch_cell("select data_template_data.id from (data_template,data_template_data) where data_template.id=data_template_data.data_template_id and data_template.id=$data_template_id and data_template_data.local_data_id=0"));
956         $save["data_template_id"] = $data_template_id;
957  
958         reset($struct_data_source);
959 diff -urbB cacti-0.8.6g/lib/poller.php cacti/lib/poller.php
960 --- cacti-0.8.6g/lib/poller.php 2005-09-09 01:56:25.000000000 +0200
961 +++ cacti/lib/poller.php        2005-11-24 19:32:36.000000000 +0100
962 @@ -167,7 +203,7 @@
963  
964         $host = db_fetch_row("select hostname,snmp_community,snmp_version,snmp_username,snmp_password,snmp_port,snmp_timeout from host where id=$host_id");
965         $data_query = db_fetch_row("select reindex_method,sort_field from host_snmp_query where host_id=$host_id and snmp_query_id=$data_query_id");
966 -       $data_query_type = db_fetch_cell("select data_input.type_id from data_input,snmp_query where data_input.id=snmp_query.data_input_id and snmp_query.id=$data_query_id");
967 +       $data_query_type = db_fetch_cell("select data_input.type_id from (data_input,snmp_query) where data_input.id=snmp_query.data_input_id and snmp_query.id=$data_query_id");
968         $data_query_xml = get_data_query_array($data_query_id);
969  
970         switch ($data_query["reindex_method"]) {
971 @@ -252,7 +288,7 @@
972                 poller_item.rrd_path,
973                 poller_item.rrd_name,
974                 poller_item.rrd_num
975 -               from poller_output,poller_item
976 +               from (poller_output,poller_item)
977                 where (poller_output.local_data_id=poller_item.local_data_id and poller_output.rrd_name=poller_item.rrd_name)");
978  
979         if (sizeof($results) > 0) {
980 @@ -273,7 +309,7 @@
981                                 $rrd_field_names = array_rekey(db_fetch_assoc("select
982                                         data_template_rrd.data_source_name,
983                                         data_input_fields.data_name
984 -                                       from data_template_rrd,data_input_fields
985 +                                       from (data_template_rrd,data_input_fields)
986                                         where data_template_rrd.data_input_field_id=data_input_fields.id
987                                         and data_template_rrd.local_data_id=" . $item["local_data_id"]), "data_name", "data_source_name");
988  
989 diff -urbB cacti-0.8.6g/lib/rrd.php cacti/lib/rrd.php
990 --- cacti-0.8.6g/lib/rrd.php    2005-09-09 01:56:25.000000000 +0200
991 +++ cacti/lib/rrd.php   2005-11-24 19:32:36.000000000 +0100
992 @@ -167,9 +167,9 @@
993                 rra_cf.consolidation_function_id,
994                 (rra.rows*rra.steps) as rra_order
995                 from data_template_data
996 -               left join data_template_data_rra on data_template_data.id=data_template_data_rra.data_template_data_id
997 -               left join rra on data_template_data_rra.rra_id=rra.id
998 -               left join rra_cf on rra.id=rra_cf.rra_id
999 +               left join data_template_data_rra on (data_template_data.id=data_template_data_rra.data_template_data_id)
1000 +               left join rra on (data_template_data_rra.rra_id=rra.id)
1001 +               left join rra_cf on (rra.id=rra_cf.rra_id)
1002                 where data_template_data.local_data_id=$local_data_id
1003                 and (rra.steps is not null or rra.rows is not null)
1004                 order by rra_cf.consolidation_function_id,rra_order");
1005 @@ -460,7 +461,7 @@
1006         /* find the step and how often this graph is updated with new data */
1007         $ds_step = db_fetch_cell("select
1008                 data_template_data.rrd_step
1009 -               from data_template_data,data_template_rrd,graph_templates_item
1010 +               from (data_template_data,data_template_rrd,graph_templates_item)
1011                 where graph_templates_item.task_item_id=data_template_rrd.id
1012                 and data_template_rrd.local_data_id=data_template_data.local_data_id
1013                 and graph_templates_item.local_graph_id=$local_graph_id
1014 @@ -526,7 +527,7 @@
1015                 graph_templates_graph.unit_value,
1016                 graph_templates_graph.unit_exponent_value,
1017                 graph_templates_graph.export
1018 -               from graph_templates_graph,graph_local
1019 +               from (graph_templates_graph,graph_local)
1020                 where graph_local.id=graph_templates_graph.local_graph_id
1021                 and graph_templates_graph.local_graph_id=$local_graph_id");
1022  
1023 @@ -548,9 +549,9 @@
1024                 data_template_rrd.data_source_name,
1025                 data_template_rrd.local_data_template_rrd_id
1026                 from graph_templates_item
1027 -               left join data_template_rrd on graph_templates_item.task_item_id=data_template_rrd.id
1028 -               left join colors on graph_templates_item.color_id=colors.id
1029 -               left join graph_templates_gprint on graph_templates_item.gprint_id=graph_templates_gprint.id
1030 +               left join data_template_rrd on (graph_templates_item.task_item_id=data_template_rrd.id)
1031 +               left join colors on (graph_templates_item.color_id=colors.id)
1032 +               left join graph_templates_gprint on (graph_templates_item.gprint_id=graph_templates_gprint.id)
1033                 where graph_templates_item.local_graph_id=$local_graph_id
1034                 order by graph_templates_item.sequence");
1035  
1036 diff -urbB cacti-0.8.6g/lib/template.php cacti/lib/template.php
1037 --- cacti-0.8.6g/lib/template.php       2005-09-09 01:56:25.000000000 +0200
1038 +++ cacti/lib/template.php      2005-11-24 19:32:36.000000000 +0100
1039 @@ -54,7 +54,7 @@
1040                 data_input_data.value,
1041                 data_input_data.t_value
1042                 from data_input_fields left join data_input_data
1043 -               on data_input_fields.id=data_input_data.data_input_field_id
1044 +               on (data_input_fields.id=data_input_data.data_input_field_id)
1045                 where data_input_data.data_template_data_id=" . $data_template["id"] . "
1046                 and data_input_fields.input_output='in'");
1047  
1048 @@ -349,7 +349,7 @@
1049         $graph_item_inputs = db_fetch_assoc("select
1050                 graph_template_input.column_name,
1051                 graph_template_input_defs.graph_template_item_id
1052 -               from graph_template_input, graph_template_input_defs
1053 +               from (graph_template_input, graph_template_input_defs)
1054                 where graph_template_input.graph_template_id=" . $graph_template_item["graph_template_id"] . "
1055                 and graph_template_input.id=graph_template_input_defs.graph_template_input_id
1056                 and graph_template_input_defs.graph_template_item_id=$graph_template_item_id");
1057 @@ -418,7 +418,7 @@
1058         $graph_template_inputs = db_fetch_assoc("select
1059                 graph_template_input.column_name,
1060                 graph_template_input_defs.graph_template_item_id
1061 -               from graph_template_input,graph_template_input_defs
1062 +               from (graph_template_input,graph_template_input_defs)
1063                 where graph_template_input.id=graph_template_input_defs.graph_template_input_id
1064                 and graph_template_input.graph_template_id=$graph_template_id");
1065  
1066 @@ -609,7 +609,7 @@
1067                 data_template.id,
1068                 data_template.name,
1069                 data_template_rrd.data_source_name
1070 -               from data_template, data_template_rrd, graph_templates_item
1071 +               from (data_template, data_template_rrd, graph_templates_item)
1072                 where graph_templates_item.task_item_id=data_template_rrd.id
1073                 and data_template_rrd.data_template_id=data_template.id
1074                 and data_template_rrd.local_data_id=0
1075 @@ -657,7 +657,7 @@
1076                         $data_input_field = array_rekey(db_fetch_assoc("select
1077                                 data_input_fields.id,
1078                                 data_input_fields.type_code
1079 -                               from snmp_query,data_input,data_input_fields
1080 +                               from (snmp_query,data_input,data_input_fields)
1081                                 where snmp_query.data_input_id=data_input.id
1082                                 and data_input.id=data_input_fields.data_input_id
1083                                 and (data_input_fields.type_code='index_type' or data_input_fields.type_code='index_value' or data_input_fields.type_code='output_type')
1084 @@ -714,7 +714,7 @@
1085                 graph_templates_item.id,
1086                 data_template_rrd.id as data_template_rrd_id,
1087                 data_template_rrd.data_template_id
1088 -               from graph_templates_item,data_template_rrd
1089 +               from (graph_templates_item,data_template_rrd)
1090                 where graph_templates_item.task_item_id=data_template_rrd.id
1091                 and graph_templates_item.graph_template_id=$graph_template_id
1092                 and local_graph_id=0
1093 diff -urbB cacti-0.8.6g/lib/tree.php cacti/lib/tree.php
1094 --- cacti-0.8.6g/lib/tree.php   2005-09-09 01:56:25.000000000 +0200
1095 +++ cacti/lib/tree.php  2005-11-24 19:32:36.000000000 +0100
1096 @@ -213,7 +213,7 @@
1097                 CONCAT_WS('',description,' (',hostname,')') as hostname
1098                 from graph_tree_items
1099                 left join graph_templates_graph on (graph_tree_items.local_graph_id=graph_templates_graph.local_graph_id and graph_tree_items.local_graph_id>0)
1100 -               left join host on host.id=graph_tree_items.host_id
1101 +               left join host on (host.id=graph_tree_items.host_id)
1102                 $sql_where
1103                 order by graph_tree_items.order_key");
1104  
1105 diff -urbB cacti-0.8.6g/lib/utility.php cacti/lib/utility.php
1106 --- cacti-0.8.6g/lib/utility.php        2005-09-09 01:56:25.000000000 +0200
1107 +++ cacti/lib/utility.php       2005-11-24 19:32:36.000000000 +0100
1108 @@ -58,7 +58,7 @@
1109                 data_template_data.id as data_template_data_id,
1110                 data_template_data.data_template_id,
1111                 data_template_data.active
1112 -               from data_template_data,data_input
1113 +               from (data_template_data,data_input)
1114                 where data_template_data.data_input_id=data_input.id
1115                 and data_template_data.local_data_id=$local_data_id");
1116  
1117 @@ -82,7 +81,7 @@
1118                 $outputs = db_fetch_assoc("select
1119                         snmp_query_graph_rrd.snmp_field_name,
1120                         data_template_rrd.id as data_template_rrd_id
1121 -                       from snmp_query_graph_rrd,data_template_rrd
1122 +                       from (snmp_query_graph_rrd,data_template_rrd)
1123                         where snmp_query_graph_rrd.data_template_rrd_id=data_template_rrd.local_data_template_rrd_id
1124                         and snmp_query_graph_rrd.snmp_query_graph_id=" . $field["output_type"] . "
1125                         and snmp_query_graph_rrd.data_template_id=" . $data_input["data_template_id"] . "
1126 @@ -201,7 +200,7 @@
1127                 data_template_data.data_input_id,
1128                 data_template_data.local_data_id,
1129                 data_template_data.local_data_template_data_id
1130 -               from data_local,data_template_data
1131 +               from (data_local,data_template_data)
1132                 where " . (empty($local_data_id) ? "data_local.host_id=$host_id" : "data_local.id=$local_data_id") . "
1133                 and data_local.id=data_template_data.local_data_id
1134                 and data_template_data.data_input_id>0");
1135 diff -urbB cacti-0.8.6g/tree.php cacti/tree.php
1136 --- cacti-0.8.6g/tree.php       2005-09-09 01:56:25.000000000 +0200
1137 +++ cacti/tree.php      2005-11-24 19:32:45.000000000 +0100
1138 @@ -250,7 +250,7 @@
1139                                 Choose a graph from this list to add it to the tree.
1140                         </td>
1141                         <td>
1142 -                               <?php form_dropdown("local_graph_id", db_fetch_assoc("select graph_templates_graph.local_graph_id as id,graph_templates_graph.title_cache as name from graph_templates_graph,graph_local where graph_local.id=graph_templates_graph.local_graph_id and local_graph_id != 0 order by title_cache"), "name", "id", (isset($tree_item["local_graph_id"]) ? $tree_item["local_graph_id"] : ""), "", "");?>
1143 +                               <?php form_dropdown("local_graph_id", db_fetch_assoc("select graph_templates_graph.local_graph_id as id,graph_templates_graph.title_cache as name from (graph_templates_graph,graph_local) where graph_local.id=graph_templates_graph.local_graph_id and local_graph_id != 0 order by title_cache"), "name", "id", (isset($tree_item["local_graph_id"]) ? $tree_item["local_graph_id"] : ""), "", "");?>
1144                         </td>
1145                 </tr>
1146                 <?php form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],1); ?>
1147 diff -urbB cacti-0.8.6g/user_admin.php cacti/user_admin.php
1148 --- cacti-0.8.6g/user_admin.php 2005-09-09 01:56:25.000000000 +0200
1149 +++ cacti/user_admin.php        2005-11-24 19:32:45.000000000 +0100
1150 @@ -729,7 +729,7 @@
1151  
1152         html_header(array("User Name", "Full Name", "Realm", "Default Graph Policy", "Last Login"), 2);
1153  
1154 -       $user_list = db_fetch_assoc("select id, user_auth.username, full_name, realm, policy_graphs, DATE_FORMAT(max(time),'%M %e %Y %H:%i:%s') as time from user_auth left join user_log on user_auth.id = user_log.user_id group by id");
1155 +       $user_list = db_fetch_assoc("select id, user_auth.username, full_name, realm, policy_graphs, DATE_FORMAT(max(time),'%M %e %Y %H:%i:%s') as time from user_auth left join user_log on (user_auth.id = user_log.user_id) group by id");
1156  
1157         $i = 0;
1158         if (sizeof($user_list) > 0) {
1159 diff -urbB cacti-0.8.6g/utilities.php cacti/utilities.php
1160 --- cacti-0.8.6g/utilities.php  2005-09-09 01:56:25.000000000 +0200
1161 +++ cacti/utilities.php 2005-11-24 19:32:45.000000000 +0100
1162 @@ -203,7 +203,7 @@
1163         $snmp_cache = db_fetch_assoc("select host_snmp_cache.*,
1164                 host.description,
1165                 snmp_query.name
1166 -               from host_snmp_cache,snmp_query,host
1167 +               from (host_snmp_cache,snmp_query,host)
1168                 where host_snmp_cache.host_id=host.id
1169                 and host_snmp_cache.snmp_query_id=snmp_query.id
1170                 order by host_snmp_cache.host_id,host_snmp_cache.snmp_query_id,host_snmp_cache.snmp_index");
1171 @@ -247,7 +247,7 @@
1172                 poller_item.*,
1173                 data_template_data.name_cache,
1174                 data_local.host_id
1175 -               from poller_item,data_template_data,data_local
1176 +               from (poller_item,data_template_data,data_local)
1177                 where poller_item.local_data_id=data_template_data.local_data_id
1178                 and data_template_data.local_data_id=data_local.id");
1179  
This page took 0.148388 seconds and 3 git commands to generate.