From 61c25ee46f13402add5330f7014f307a4d2065e5 Mon Sep 17 00:00:00 2001 From: ramonn Date: Wed, 15 Jun 2011 09:23:28 +0000 Subject: [PATCH] 2011-06-15 Ramon Novoa * pandoradb.oracle.sql: Removed unneeded code. * operation/events/events_list.php: Do not show duplicate messages when grouping events. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4451 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 7 +++++++ pandora_console/operation/events/events_list.php | 5 +++-- pandora_console/pandoradb.oracle.sql | 1 - 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 5b79ebe036..c41f85e63c 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2011-06-15 Ramon Novoa + + * pandoradb.oracle.sql: Removed unneeded code. + + * operation/events/events_list.php: Do not show duplicate messages when + grouping events. + 2011-06-15 Sergio Martin * include/functions_events.php: Fixed repeated values into diff --git a/pandora_console/operation/events/events_list.php b/pandora_console/operation/events/events_list.php index 25f20d1619..1b3fa5a793 100644 --- a/pandora_console/operation/events/events_list.php +++ b/pandora_console/operation/events/events_list.php @@ -270,7 +270,7 @@ if ($group_rep == 0) { else { switch ($config["dbtype"]) { case "mysql": - $sql = "SELECT *, GROUP_CONCAT(user_comment SEPARATOR '') AS user_comment, + $sql = "SELECT *, GROUP_CONCAT(DISTINCT user_comment SEPARATOR '') AS user_comment, MAX(estado) AS estado, COUNT(*) AS event_rep, MAX(utimestamp) AS timestamp_rep FROM tevento WHERE 1=1 ".$sql_post." @@ -278,7 +278,7 @@ else { ORDER BY timestamp_rep DESC LIMIT ".$offset.",".$pagination; break; case "postgresql": - $sql = "SELECT *, array_to_string(array_agg(user_comment), '') AS user_comment, + $sql = "SELECT *, array_to_string(array_agg(DISTINCT user_comment), '') AS user_comment, MAX(estado) AS estado, COUNT(*) AS event_rep, MAX(utimestamp) AS timestamp_rep FROM tevento WHERE 1=1 ".$sql_post." @@ -289,6 +289,7 @@ else { $set = array(); $set['limit'] = $pagination; $set['offset'] = $offset; + // TODO: Remove duplicate user comments $sql = "SELECT a.*, b.event_rep, b.timestamp_rep FROM (select * from tevento WHERE 1=1 ".$sql_post.") a, (select min(id_evento) as id_evento, to_char(evento) as evento, diff --git a/pandora_console/pandoradb.oracle.sql b/pandora_console/pandoradb.oracle.sql index f226158059..d0eb4693bf 100644 --- a/pandora_console/pandoradb.oracle.sql +++ b/pandora_console/pandoradb.oracle.sql @@ -26,7 +26,6 @@ CREATE OR REPLACE FUNCTION UNIX_TIMESTAMP (oracletime IN DATE DEFAULT SYSDATE) RETURN INTEGER AS unixtime INTEGER; BEGIN unixtime := (oracletime - to_date('19700101','YYYYMMDD')) * 86400; RETURN unixtime; END;; CREATE OR REPLACE FUNCTION NOW RETURN TIMESTAMP AS t_now TIMESTAMP; BEGIN SELECT LOCALTIMESTAMP INTO t_now FROM dual; RETURN t_now; END;; -CREATE AGGREGATE array_agg (anyelement) (sfunc = array_append, stype = anyarray, initcond = '{}');; CREATE TABLE taddress ( id_a NUMBER(10, 0) NOT NULL PRIMARY KEY,