summaryrefslogtreecommitdiffstats
path: root/src/libs/zbxdbhigh
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-10-05 19:30:39 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-10-05 19:30:39 +0000
commit830d850cfba9154d3d745eca095860c8d11a6665 (patch)
treebeb6a53732ee1a2f6b9a331fa4f3a2d97ab53c59 /src/libs/zbxdbhigh
parent44ad7e8034505c13f3a3ae9cb3ee93de3a7ad75b (diff)
downloadzabbix-830d850cfba9154d3d745eca095860c8d11a6665.tar.gz
zabbix-830d850cfba9154d3d745eca095860c8d11a6665.tar.xz
zabbix-830d850cfba9154d3d745eca095860c8d11a6665.zip
Minor changes.
git-svn-id: svn://svn.zabbix.com/trunk@2116 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src/libs/zbxdbhigh')
-rw-r--r--src/libs/zbxdbhigh/graph.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/libs/zbxdbhigh/graph.c b/src/libs/zbxdbhigh/graph.c
index 1f56b35f..0e35d322 100644
--- a/src/libs/zbxdbhigh/graph.c
+++ b/src/libs/zbxdbhigh/graph.c
@@ -88,20 +88,27 @@ int DBadd_graph_item_to_linked_hosts(int gitemid,int hostid)
if(hostid==0)
{
- $sql="select hostid,templateid,graphs from hosts_templates where templateid=".$item["hostid"];
+ snprintf(sql,sizeof(sql)-1,"select hostid,templateid,graphs from hosts_templates where templateid=%d", item.hostid);
}
else
{
- $sql="select hostid,templateid,graphs from hosts_templates where hostid=$hostid and templateid=".$item["hostid"];
+ snprintf(sql,sizeof(sql)-1,"select hostid,templateid,graphs from hosts_templates where hostid=%d and templateid=%d", hostid, item.hostid);
}
- $result=DBselect($sql);
- while($row=DBfetch($result))
+
+ result=DBselect(sql);
+ for(i=0;i<DBnum_rows(result);i++)
{
- if($row["graphs"]&1 == 0) continue;
+ if(atoi(DBget_field(result,i,2))&1 == 0) continue;
+
+ snprintf(sql,sizeof(sql)-1,"select i.itemid from items i where i.key_='%s' and i.hostid=%d", item.key, atoi(DBget_field(result,i,0)));
+
+ result2=DBselect(sql);
+ if(DBnum_rows(result2)==0)
+ {
+ DBfree_result(result2);
+ continue;
+ }
- $sql="select i.itemid from items i where i.key_='".$item["key_"]."' and i.hostid=".$row["hostid"];
- $result2=DBselect($sql);
- if(DBnum_rows($result2)==0) continue;
$row2=DBfetch($result2);
$itemid=$row2["itemid"];