FCLT#84105 Notificatie trigger optimalisatie
svn path=/Database/trunk/; revision=65043
This commit is contained in:
@@ -26,6 +26,8 @@ CREATE UNIQUE INDEX fac_i_srtnotificatie_code2 on fac_srtnotificatie(fac_srtnoti
|
||||
|
||||
CREATE INDEX fac_i_notificatie1 ON fac_notificatie(prs_perslid_key_receiver, fac_notificatie_status);
|
||||
CREATE INDEX fac_i_notificatie2 ON fac_notificatie(fac_srtnotificatie_key);
|
||||
-- voor ontdubbelingen:
|
||||
CREATE INDEX fac_i_notificatie3 ON fac_notificatie(fac_notificatie_refkey);
|
||||
|
||||
CREATE INDEX fac_i_fac_session1 ON fac_session(prs_perslid_key);
|
||||
CREATE UNIQUE INDEX fac_i_fac_session2 ON fac_session(fac_session_sessionid_hash);
|
||||
|
||||
@@ -127,6 +127,7 @@ CREATE OR REPLACE PACKAGE fac
|
||||
PROCEDURE clrnotifications (pcode VARCHAR2, pref NUMBER, psubject VARCHAR2, preceiver NUMBER, pextrakey NUMBER);
|
||||
PROCEDURE clrnotifications_xmlnode (pxmlnode VARCHAR2, prefkey NUMBER);
|
||||
PROCEDURE clrtracking_xmlnode (pxmlnode VARCHAR2, prefkey NUMBER);
|
||||
PROCEDURE cleannotifications;
|
||||
FUNCTION hasColumn(ptableview VARCHAR2, pcolumname VARCHAR2, pdatatype VARCHAR2 DEFAULT NULL) RETURN VARCHAR2;
|
||||
PROCEDURE putnotificationjobs (pqueue VARCHAR2 DEFAULT 'DEFAULT');
|
||||
PROCEDURE putjobnotifications (pviewname VARCHAR2, pmode NUMBER, pflags NUMBER, pqueue VARCHAR2 DEFAULT 'DEFAULT');
|
||||
@@ -2623,6 +2624,7 @@ CREATE OR REPLACE PACKAGE BODY fac AS
|
||||
AND fac_notificatie_job_queue = pqueue;
|
||||
tnextrun fac_notificatie_job.fac_notificatie_job_nextrun%TYPE;
|
||||
BEGIN
|
||||
fac.cleannotifications(); // Eens per uur beetje opruimen is aardig
|
||||
FOR rec1 IN c1
|
||||
LOOP
|
||||
-- Voer de job uit
|
||||
@@ -2706,6 +2708,16 @@ CREATE OR REPLACE PACKAGE BODY fac AS
|
||||
END IF;
|
||||
END;
|
||||
|
||||
PROCEDURE cleannotifications
|
||||
AS
|
||||
BEGIN
|
||||
-- Ruim alle totaal verwerkte notificaties op.
|
||||
DELETE FROM fac_notificatie
|
||||
WHERE fac_notificatie_status IN (0, 16)
|
||||
AND fac_notificatie_systeemadres IS NULL
|
||||
AND prs_bedrijfadres_key IS NULL;
|
||||
END;
|
||||
|
||||
-- Voer nu job met pviewname uit, die kennelijk nu aan de beurt is
|
||||
PROCEDURE putjobnotifications (pviewname VARCHAR2, pmode NUMBER, pflags NUMBER, pqueue VARCHAR2 DEFAULT 'DEFAULT')
|
||||
AS
|
||||
@@ -5799,8 +5811,6 @@ CREATE OR REPLACE PACKAGE BODY fac AS
|
||||
DELETE FROM aut_client_perslid WHERE aut_client_perslid_login < SYSDATE - 60;
|
||||
DELETE FROM fac_bookmark WHERE fac_bookmark_expire < SYSDATE - 2;
|
||||
DELETE FROM web_user_messages WHERE web_user_mess_action_datum < SYSDATE - 60;
|
||||
DELETE FROM fac_notificatie WHERE fac_notificatie_status=0
|
||||
AND fac_notificatie_systeemadres IS NULL;
|
||||
DELETE fac_result WHERE fac_result_aanmaak < SYSDATE - 7;
|
||||
|
||||
DELETE fac_rapport WHERE fac_rapport_datum < SYSDATE - 90;
|
||||
@@ -5820,6 +5830,8 @@ CREATE OR REPLACE PACKAGE BODY fac AS
|
||||
SET n.fac_notificatie_status = BITAND(n.fac_notificatie_status, 255 - 8)
|
||||
WHERE BITAND (n.fac_notificatie_status, 8) = 8
|
||||
AND TRUNC (n.fac_notificatie_datum) < TRUNC (SYSDATE);
|
||||
-- nu records deleten die niets meer doen
|
||||
fac.cleannotifications();
|
||||
|
||||
-- Import opschonen.
|
||||
DECLARE
|
||||
|
||||
@@ -327,14 +327,6 @@ BEGIN
|
||||
END;
|
||||
/
|
||||
|
||||
CREATE_TRIGGER(fac_t_fac_notificatie_B_IU)
|
||||
BEFORE INSERT OR UPDATE ON fac_notificatie
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
UPDATE_PRIMARY_KEY(fac_notificatie_key, fac_s_fac_notificatie_key);
|
||||
END;
|
||||
/
|
||||
|
||||
CREATE_TRIGGER(fac_t_fac_notificatie_B_I)
|
||||
BEFORE INSERT
|
||||
ON fac_notificatie
|
||||
@@ -344,6 +336,8 @@ DECLARE
|
||||
lxmlnode fac_srtnotificatie.fac_srtnotificatie_xmlnode%TYPE;
|
||||
lparamkey web_user_messages.web_user_mess_action_params%TYPE;
|
||||
BEGIN
|
||||
UPDATE_PRIMARY_KEY(fac_notificatie_key, fac_s_fac_notificatie_key);
|
||||
|
||||
-- Kopieer direct naar statusinformatie op de portal indien van toepassing
|
||||
-- Daarbij worden alle oude berichten (eerst) verwijderd
|
||||
IF BITAND (:NEW.fac_notificatie_status, 1) = 1 AND :new.prs_perslid_key_receiver IS NOT NULL
|
||||
@@ -403,17 +397,6 @@ BEGIN
|
||||
END;
|
||||
/
|
||||
|
||||
CREATE_TRIGGER(fac_t_fac_notificatie_A_U)
|
||||
AFTER UPDATE ON fac_notificatie
|
||||
BEGIN
|
||||
-- Ruim alle totaal verwerkte notificaties op.
|
||||
DELETE FROM fac_notificatie
|
||||
WHERE fac_notificatie_status IN (0,16)
|
||||
AND fac_notificatie_systeemadres IS NULL
|
||||
AND prs_bedrijfadres_key IS NULL;
|
||||
END;
|
||||
/
|
||||
|
||||
CREATE_TRIGGER(fac_t_fac_notificatie_job_B_IU)
|
||||
BEFORE INSERT OR UPDATE ON fac_notificatie_job
|
||||
FOR EACH ROW
|
||||
|
||||
@@ -406,6 +406,13 @@ UPDATE fac_setting
|
||||
/////////////////////////////////////////////////////////////////////////////////////////// TWYN#83949
|
||||
ALTER TABLE prs_kostensoortgrp ADD prs_kostensoortgrp_verwijder DATE;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////// FCLT#84105
|
||||
DROP TRIGGER fac_t_fac_notificatie_B_IU;
|
||||
DROP TRIGGER fac_t_fac_notificatie_A_U;
|
||||
CREATE INDEX fac_i_notificatie3 ON fac_notificatie(fac_notificatie_refkey);
|
||||
|
||||
ALTER PACKAGE fac COMPILE; // anders (nog) invalid en lukt het volgende niet niet
|
||||
ALTER PACKAGE fac COMPILE BODY;
|
||||
/////////////////////////////////////////////////////////////////////////////////////////// FCLT#00000
|
||||
|
||||
REGISTERONCE('$Id$')
|
||||
|
||||
Reference in New Issue
Block a user