From f41889dafec7522293ac186ec4dbf20005a33fdb Mon Sep 17 00:00:00 2001
From: Knut Auvor Grythe <knut@auvor.no>
Date: Fri, 3 Apr 2015 10:40:29 +0200
Subject: Re-sync SQL schema

---
 sql/nms.sql | 50 --------------------------------------------------
 1 file changed, 50 deletions(-)

(limited to 'sql/nms.sql')

diff --git a/sql/nms.sql b/sql/nms.sql
index e676ff0..e81d16b 100644
--- a/sql/nms.sql
+++ b/sql/nms.sql
@@ -246,56 +246,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
 --
-- 
cgit v1.2.3

