Cover V12, I08

Article
Figure 1
Figure 2
Listing 1
Listing 2
Listing 3
Listing 4
Listing 5
Listing 6
Listing 7
Listing 8
Listing 9
Listing 10

aug2003.tar

Listing 3 Trigger functions

-- Function: auth_prune()
CREATE FUNCTION auth_prune() RETURNS opaque AS '
    BEGIN
        delete from auth where sourceip = NEW.sourceip;
        RETURN NEW;
    END;
'  LANGUAGE 'plpgsql';


- Function: traffic_username()
CREATE FUNCTION traffic_username() RETURNS opaque AS '
    BEGIN
        IF NEW.username ISNULL THEN

                NEW.username := (

                        select distinct auth.username 

                        from  auth

                        where  NEW.sourceip = auth.sourceip
                        );

        END IF;
       RETURN NEW;
    END;
'  LANGUAGE 'plpgsql';