diff options
author | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-03-27 11:01:34 +0000 |
---|---|---|
committer | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-03-27 11:01:34 +0000 |
commit | f9f07b4cae6072d0c9c40f02a2b7042c62d5857d (patch) | |
tree | 8708431cc31c83105d8c228e3cbbe2014f58e847 | |
parent | 66065be0e68fdb1e20cef3f142e90efb1a1f5952 (diff) | |
download | zabbix-f9f07b4cae6072d0c9c40f02a2b7042c62d5857d.tar.gz zabbix-f9f07b4cae6072d0c9c40f02a2b7042c62d5857d.tar.xz zabbix-f9f07b4cae6072d0c9c40f02a2b7042c62d5857d.zip |
- replaced "union" command by sql arrays, for compatability of old MySQL (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@2711 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r-- | frontends/php/include/classes/graph.inc.php | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/frontends/php/include/classes/graph.inc.php b/frontends/php/include/classes/graph.inc.php index 9946f3d4..bd4700e4 100644 --- a/frontends/php/include/classes/graph.inc.php +++ b/frontends/php/include/classes/graph.inc.php @@ -548,26 +548,33 @@ $str=substr($str,0,strlen($str)-1); if($str=="") $str=-1; + $sql_arr = array(); if($this->period<=24*3600) { // $sql="select itemid,round(900*((clock+$z)%($p))/($p),0) as i,count(*) as count,avg(value) as avg,min(value) as min,max(value) as max,max(clock) as clock from history where itemid in ($str) and clock>=".$this->from_time." and clock<=".$this->to_time." group by itemid,round(900*((clock+$z)%($p))/($p),0)"; - $sql="select itemid,round(900*((clock+$z)%($p))/($p),0) as i,count(*) as count,avg(value) as avg,min(value) as min,max(value) as max,max(clock) as clock from history where itemid in ($str) and clock>=".$this->from_time." and clock<=".$this->to_time." group by itemid,round(900*((clock+$z)%($p))/($p),0) union select itemid,round(900*((clock+$z)%($p))/($p),0) as i,count(*) as count,avg(value) as avg,min(value) as min,max(value) as max,max(clock) as clock from history_uint where itemid in ($str) and clock>=".$this->from_time." and clock<=".$this->to_time." group by itemid,round(900*((clock+$z)%($p))/($p),0)"; + array_push($sql_arr, + "select itemid,round(900*((clock+$z)%($p))/($p),0) as i,count(*) as count,avg(value) as avg,min(value) as min,max(value) as max,max(clock) as clock from history where itemid in ($str) and clock>=".$this->from_time." and clock<=".$this->to_time." group by itemid,round(900*((clock+$z)%($p))/($p),0)", + "select itemid,round(900*((clock+$z)%($p))/($p),0) as i,count(*) as count,avg(value) as avg,min(value) as min,max(value) as max,max(clock) as clock from history_uint where itemid in ($str) and clock>=".$this->from_time." and clock<=".$this->to_time." group by itemid,round(900*((clock+$z)%($p))/($p),0)"); } else { - $sql="select itemid,round(900*((clock+$z)%($p))/($p),0) as i,sum(num) as count,avg(value_avg) as avg,min(value_min) as min,max(value_max) as max,max(clock) as clock from trends where itemid in ($str) and clock>=".$this->from_time." and clock<=".$this->to_time." group by itemid,round(900*((clock+$z)%($p))/($p),0)"; + sql_push($sql_arr, + "select itemid,round(900*((clock+$z)%($p))/($p),0) as i,sum(num) as count,avg(value_avg) as avg,min(value_min) as min,max(value_max) as max,max(clock) as clock from trends where itemid in ($str) and clock>=".$this->from_time." and clock<=".$this->to_time." group by itemid,round(900*((clock+$z)%($p))/($p),0)"); } // echo "<br>",$sql,"<br>"; - $result=DBselect($sql); - while($row=DBfetch($result)) + foreach($sql_arr as $sql) { - $i=$row["i"]; - $this->count[$this->itemids[$row["itemid"]]][$i]=$row["count"]; - $this->min[$this->itemids[$row["itemid"]]][$i]=$row["min"]; - $this->max[$this->itemids[$row["itemid"]]][$i]=$row["max"]; - $this->avg[$this->itemids[$row["itemid"]]][$i]=$row["avg"]; - $this->clock[$this->itemids[$row["itemid"]]][$i]=$row["clock"]; + $result=DBselect($sql); + while($row=DBfetch($result)) + { + $i=$row["i"]; + $this->count[$this->itemids[$row["itemid"]]][$i]=$row["count"]; + $this->min[$this->itemids[$row["itemid"]]][$i]=$row["min"]; + $this->max[$this->itemids[$row["itemid"]]][$i]=$row["max"]; + $this->avg[$this->itemids[$row["itemid"]]][$i]=$row["avg"]; + $this->clock[$this->itemids[$row["itemid"]]][$i]=$row["clock"]; + } } } |