Back to OIM Explorer

dbo.CPL_TDComplianceRule

Database TriggerSQL_TRIGGERSandbox DB

Database Trigger on ComplianceRule. Bulk DBQueue insert -> CPL-K-ComplianceCheckMakeProc / CPL_ZComplianceCheckMakeProc at line 7; References QBM_PDBQueueInsert_Bulk; Trigger parent table: ComplianceRule

Source: sandbox-db sys.sql_modules

Source size: 1.782 characters

Interpretation

  • Database trigger. Treat parent table and enqueue/object-layer calls as the main relation points.
  • DBQueue relation detected. Follow the task procedure and referenced-by list for async processing.

Relations

  • Bulk DBQueue insert -> CPL-K-ComplianceCheckMakeProc / CPL_ZComplianceCheckMakeProc at line 7
  • References QBM_PDBQueueInsert_Bulk
  • Trigger parent table: ComplianceRule

Typed Edges

  • queues DBQueue task CPL_ZComplianceCheckMakeProc at line 7 Bulk DBQueue insert -> CPL-K-ComplianceCheckMakeProc / CPL_ZComplianceCheckMakeProc at line 7
  • trigger on table ComplianceRule Trigger parent table: ComplianceRule
  • references source dbo.QBM_FGISessionContext source text reference
  • references source dbo.QBM_PDBQueueInsert_Bulk source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference

References

Referenced By

  • No direct source references extracted.

Complete Source

SQL88 lines
1CREATE trigger CPL_TDComplianceRule2  ON ComplianceRule FOR3DELETE NOT FOR Replication4AS5BEGIN6  IF EXISTS(7    SELECT TOP 1 18    FROM deleted)9  GOTO start10  RETURN start:11  BEGIN TRY12    DECLARE @GenProcID varchar(38)13    SELECT @GenProcID = dbo.QBM_FGISessionContext('')14    DECLARE @errno int15    DECLARE @errmsg nvarchar(255)16    DECLARE @UID_NonCompliance varchar(38)17    DECLARE @whereclause nvarchar(1024)18    IF EXISTS(19      SELECT TOP 1 120      FROM deleted r21      WHERE22        r.IsInactive = 0 AND r.IsWorkingCopy = 0)23    BEGIN24      RAISERROR('#LDS#Enabled compliance rules cannot be deleted.|',25      18,26      3)27        WITH nowait28    END29    IF EXISTS(30      SELECT TOP 1 131      FROM deleted r32      JOIN personInBaseTree pio33        ON r.UID_NonCompliance = pio.uid_org AND pio.XOrigin > 0 AND r.IsWorkingCopy = 0 AND r.IsInactive = 0)34    BEGIN35      RAISERROR('#LDS#Compliance rules cannot be deleted after disabling until there are no more violations.|',36      18,37      3)38        WITH nowait39    END40    DECLARE @DBQueueElements_01 QBM_YDBQueueRaw41    INSERT INTO @DBQueueElements_01(object,42    subobject,43    genprocid)44    SELECT45      x.uid,46      NULL,47      @GenProcID48    FROM(49    SELECT d.uid_ComplianceRule AS uid50    FROM deleted d) AS x51    EXEC QBM_PDBQueueInsert_Bulk 'CPL-K-ComplianceCheckMakeProc',52      @DBQueueElements_0153    UPDATE PersonInBaseTree54    SET XOrigin = 055    WHERE56      uid_org IN(57    SELECT d.UID_NonCompliance58    FROM deleted d59    WHERE60      d.IsWorkingCopy = 0)61    DELETE PersonInBaseTree62    WHERE63      uid_org IN(64    SELECT d.UID_NonCompliance65    FROM deleted d66    WHERE67      d.IsWorkingCopy = 0)68    DELETE BaseTree69    FROM BaseTree b70    JOIN deleted d71      ON b.UID_Org = d.UID_NonCompliance72    LEFT73    OUTER74    JOIN ComplianceRule r75      ON d.UID_NonCompliance = r.UID_NonCompliance AND r.UID_ComplianceRule <> d.UID_ComplianceRule76    WHERE77      r.UID_NonCompliance IS NULL78  END TRY79  BEGIN CATCH80    EXEC QBM_PSessionErrorAdd DEFAULT81    RAISERROR('',82    18,83    1)84      WITH NOWAIT85  END CATCH86  ende:87  RETURN88END
Open raw exported source
SQL ยท Raw12 lines
1create   trigger CPL_TDComplianceRule on ComplianceRule  for Delete not for Replication as begin  if exists (select top 1 1 from deleted) goto start2 return start: BEGIN TRY declare @GenProcID varchar(38) select @GenProcID = dbo.QBM_FGISessionContext('')  declare @errno int declare @errmsg nvarchar(2553) declare @UID_NonCompliance varchar(38) declare @whereclause nvarchar(1024)  if exists (select top 1 1 from deleted r where r.IsInactive = 0 and r.IsWorkingCopy4 = 0 ) begin  raiserror( '#LDS#Enabled compliance rules cannot be deleted.|', 18, 3) with nowait end if exists (select top 1 1 from deleted r join personInBaseTree5 pio on r.UID_NonCompliance = pio.uid_org and pio.XOrigin > 0  and r.IsWorkingCopy = 0 and r.IsInactive = 0 ) begin  raiserror( '#LDS#Compliance rules cannot be deleted after disabling until there are no more violations.|'6, 18, 3) with nowait end  declare @DBQueueElements_01 QBM_YDBQueueRaw insert into @DBQueueElements_01 (object, subobject, genprocid) select x.uid, null7, @GenProcID from ( select d.uid_ComplianceRule as uid from deleted d ) as x exec QBM_PDBQueueInsert_Bulk 'CPL-K-ComplianceCheckMakeProc', @DBQueueElements_018 update PersonInBaseTree set XOrigin = 0 where uid_org in (select d.UID_NonCompliance from deleted d where d.IsWorkingCopy = 0 ) delete PersonInBaseTree9 where uid_org in (select d.UID_NonCompliance from deleted d where d.IsWorkingCopy = 0 ) delete BaseTree from BaseTree b join deleted d on b.UID_Org = 10d.UID_NonCompliance left outer join ComplianceRule r on d.UID_NonCompliance = r.UID_NonCompliance  and r.UID_ComplianceRule <> d.UID_ComplianceRule where11 r.UID_NonCompliance is null    END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH ende: return end 12