diff options
author | Knut Auvor Grythe <knut@auvor.no> | 2015-04-03 10:40:29 +0200 |
---|---|---|
committer | root <root@einstein.tg15.gathering.org> | 2015-04-03 10:40:29 +0200 |
commit | f41889dafec7522293ac186ec4dbf20005a33fdb (patch) | |
tree | 83b4587b6015b54e329e825dfc15975251929ba3 | |
parent | f64dff431f8c2d79d2c611defd115c39132d1ce0 (diff) |
Re-sync SQL schema
-rw-r--r-- | sql/nms.sql | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/sql/nms.sql b/sql/nms.sql index e676ff0..e81d16b 100644 --- a/sql/nms.sql +++ b/sql/nms.sql @@ -247,56 +247,6 @@ $$; ALTER FUNCTION public.get_datarate() OWNER TO nms; -- --- Name: get_operstatus(); Type: FUNCTION; Schema: public; Owner: nms --- - -CREATE FUNCTION get_operstatus() RETURNS SETOF operstatuses - LANGUAGE plpgsql - AS $$ -DECLARE - num_entries INTEGER; - poll polls2; - last_poll polls2; - ret operstatuses; -BEGIN - num_entries := 0; - last_poll.switch = -1; - - FOR poll IN select * from polls2 where time >= now() - '15 minutes'::interval and time < now() order by switch,ifdescr,time LOOP - IF poll.switch <> last_poll.switch OR poll.ifdescr <> last_poll.ifdescr THEN - IF num_entries >= 1 THEN - ret.switch := last_poll.switch; - ret.ifdescr := last_poll.ifdescr; - ret.ifoperstatus := last_poll.ifoperstatus; - ret.last_poll_time := last_poll.time; - return next ret; - END IF; - num_entries := 1; - ELSE - num_entries := num_entries + 1; - END IF; - last_poll.switch := poll.switch; - last_poll.ifdescr := poll.ifdescr; - last_poll.time := poll.time; - last_poll.ifoperstatus := poll.ifoperstatus; - END LOOP; - -- pah, and once more, for the last switch/port... - IF num_entries >= 1 THEN - ret.switch := last_poll.switch; - ret.ifdescr := last_poll.ifdescr; - ret.ifoperstatus := last_poll.ifoperstatus; - ret.last_poll_time := last_poll.time; - return next ret; - END IF; - - RETURN; -END; -$$; - - -ALTER FUNCTION public.get_operstatus() OWNER TO nms; - --- -- Name: current_change(sample); Type: AGGREGATE; Schema: public; Owner: postgres -- |