----------------------------------------------------------------------------
--   combine_triggers.sql
--
--
--   During Spatial DataBlade module registration, triggers are created
--   on the spatial_references table.  If any triggers already exist,
--   registration will fail.  To add your own triggers to the 
--   spatial_references table, you need to do the following:
--
--     1. Drop your own triggers on the spatial_references table.
--     2. Edit this script, adding your own trigger actions in the
--        appropriate places.
--     3. Register the Spatial DataBlade module using blademgr.
--     4. Run this script using DB-Access.
--
--
--   Warning on downgrades:
-- 
--     If you downgrade the Spatial DataBlade module from version 8.11
--     to version 8.10, the triggers on the spatial_references table 
--     will be dropped.   If you have your own triggers, you must
--     recreate them after completing the downgrade.
-------------------------------------------------------------------------

drop trigger SE_SpRefInsTrig;
drop trigger SE_SpRefUpdTrig;
drop trigger SE_SpRefDelTrig;

create trigger SE_SpRefInsTrig
  insert on spatial_references
    before
    (
        execute procedure SE_SpRefBeforeTrig()
        -- add additional "before" actions here
    )

        -- add your own "for each" actions here

    after
    (
        -- add additional "after" actions here
        execute procedure SE_SpRefAfterTrig()
    );


create trigger SE_SpRefUpdTrig
  update on spatial_references
    before
    (
        execute procedure SE_SpRefBeforeTrig()
        -- add additional "before" actions here
    )

        -- add your own "for each" actions here

    after
    (
        -- add additional "after" actions here
        execute procedure SE_SpRefAfterTrig()
    );


create trigger SE_SpRefDelTrig
  delete on spatial_references
    before
    (
        execute procedure SE_SpRefBeforeTrig()
        -- add additional "before" actions here
    )

        -- add your own "for each" actions here

    after
    (
        -- add additional "after" actions here
        execute procedure SE_SpRefAfterTrig()
    );
