diff options
| author | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-08-08 10:26:26 +0000 |
|---|---|---|
| committer | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-08-08 10:26:26 +0000 |
| commit | a36f295bd55b49054c3b0c1e340c471bea98c055 (patch) | |
| tree | c78076d3e8a97b6b1a8e5dc0d8e4195c8d25fa43 /frontends/php/include | |
| parent | a489ced3012a4f07f928f2a11d904b55e8b96464 (diff) | |
| download | zabbix-a36f295bd55b49054c3b0c1e340c471bea98c055.tar.gz zabbix-a36f295bd55b49054c3b0c1e340c471bea98c055.tar.xz zabbix-a36f295bd55b49054c3b0c1e340c471bea98c055.zip | |
- fixes to SQL statements for pgSQL (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@4522 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include')
| -rw-r--r-- | frontends/php/include/classes/pie.inc.php | 17 | ||||
| -rw-r--r-- | frontends/php/include/screens.inc.php | 2 | ||||
| -rw-r--r-- | frontends/php/include/services.inc.php | 14 |
3 files changed, 18 insertions, 15 deletions
diff --git a/frontends/php/include/classes/pie.inc.php b/frontends/php/include/classes/pie.inc.php index da2a71d4..c33149e8 100644 --- a/frontends/php/include/classes/pie.inc.php +++ b/frontends/php/include/classes/pie.inc.php @@ -98,7 +98,7 @@ function selectData(){ if(($this->period / $this->sizeX) <= (ZBX_MAX_TREND_DIFF / ZBX_GRAPH_MAX_SKIP_CELL)){ array_push($sql_arr, - 'SELECT h.itemid, i.lastvalue as lst, '. + 'SELECT h.itemid, max(i.lastvalue) as lst, '. ' avg(h.value) AS avg,min(h.value) AS min, '. ' max(h.value) AS max,max(h.clock) AS clock '. ' FROM history AS h LEFT JOIN items AS i ON h.itemid = i.itemid'. @@ -108,7 +108,7 @@ function selectData(){ ' GROUP BY h.itemid' , - 'SELECT hu.itemid, i.lastvalue as lst, '. + 'SELECT hu.itemid, max(i.lastvalue) as lst, '. ' avg(hu.value) AS avg,min(hu.value) AS min,'. ' max(hu.value) AS max,max(hu.clock) AS clock'. ' FROM history_uint AS hu LEFT JOIN items AS i ON hu.itemid = i.itemid'. @@ -120,7 +120,7 @@ function selectData(){ } else{ array_push($sql_arr, - 'SELECT t.itemid, i.lastvalue as lst, '. + 'SELECT t.itemid, max(i.lastvalue) as lst, '. ' avg(t.value_avg) AS avg,min(t.value_min) AS min,'. ' max(t.value_max) AS max,max(t.clock) AS clock'. ' FROM trends AS t LEFT JOIN items AS i ON t.itemid = i.itemid'. @@ -384,9 +384,10 @@ function drawElementPie($values){ $anglestart = 0; $angleend = 0; foreach($values as $item => $value){ - $angleend += (int)(360 * $value/$sum)+1; + $angleend += (int)(360 * $value/$sum); $angleend = ($angleend > 360)?(360):($angleend); if(($angleend - $anglestart) < 1) continue; + $angleend++; if($this->type == GRAPH_TYPE_EXPLODED){ list($x,$y) = $this->calcExplodedCenter($anglestart,$angleend,$xc,$yc,count($values)); @@ -439,9 +440,10 @@ function drawElementPie3D($values){ $angleend = 0; foreach($values as $item => $value){ - $angleend += (int)(360 * $value/$sum) +1; + $angleend += (int)(360 * $value/$sum); $angleend = ($angleend > 360)?(360):($angleend); if(($angleend - $anglestart) < 1) continue; + $angleend++; if($this->type == GRAPH_TYPE_3D_EXPLODED){ list($x,$y) = $this->calcExplodedCenter($anglestart,$angleend,$xc,$yc,count($values)); @@ -456,11 +458,12 @@ function drawElementPie3D($values){ $anglestart = 0; $angleend = 0; foreach($values as $item => $value){ - $angleend += (int)(360 * $value/$sum) +1; + $angleend += (int)(360 * $value/$sum); $angleend = ($angleend > 360)?(360):($angleend); if(($angleend - $anglestart) < 1) continue; elseif($this->sum == 0) continue; + $angleend++; if($this->type == GRAPH_TYPE_3D_EXPLODED){ list($x,$y) = $this->calcExplodedCenter($anglestart,$angleend,$xc,$yc,count($values)); @@ -600,4 +603,4 @@ function Draw(){ } } -?>
\ No newline at end of file +?> diff --git a/frontends/php/include/screens.inc.php b/frontends/php/include/screens.inc.php index 664815ba..77e0e56d 100644 --- a/frontends/php/include/screens.inc.php +++ b/frontends/php/include/screens.inc.php @@ -331,7 +331,7 @@ $graphtype = GRAPH_TYPE_NORMAL; - $sql = 'SELECT DISTINCT `graphtype` FROM `graphs` WHERE `graphid`='.$resourceid; + $sql = 'SELECT DISTINCT graphtype FROM graphs WHERE graphid='.$resourceid; $res = DBselect($sql); while($rows = DBfetch($res)){ diff --git a/frontends/php/include/services.inc.php b/frontends/php/include/services.inc.php index 5ed6d872..9399eeb8 100644 --- a/frontends/php/include/services.inc.php +++ b/frontends/php/include/services.inc.php @@ -218,14 +218,14 @@ function clear_parents_from_trigger($serviceid=0){ if($serviceid != 0){ - $sql='UPDATE services as s '. - ' SET s.triggerid = null '. - ' WHERE s.serviceid = '.$serviceid; + $sql='UPDATE services '. + ' SET triggerid = null '. + ' WHERE serviceid = '.$serviceid; DBexecute($sql); return; } - $sql = 'SELECT s.serviceid '. + $sql = 'SELECT max(s.serviceid) as serviceid '. ' FROM services as s, services_links as sl '. ' WHERE s.serviceid = sl.serviceupid '. ' AND NOT(s.triggerid IS NULL) '. @@ -233,9 +233,9 @@ $res = DBselect($sql); while($rows = DBfetch($res)){ - $sql='UPDATE services as s '. - ' SET s.triggerid = null '. - ' WHERE s.serviceid = '.$rows['serviceid']; + $sql='UPDATE services '. + ' SET triggerid = null '. + ' WHERE serviceid = '.$rows['serviceid']; DBexecute($sql); } } |
