dbo.DPR_TUDPRNameSpaceHasDialogTab
Database TriggerSQL_TRIGGERSandbox DB
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 -> DPR-K-TriggerCreateMembership / DPR_ZTriggerCreateMembership at line 21
- References QBM_PDBQueueInsert_Bulk
- Trigger parent table: DPRNameSpaceHasDialogTable
Typed Edges
- queues DBQueue task DPR_ZTriggerCreateMembership at line 21 Bulk DBQueue insert -> DPR-K-TriggerCreateMembership / DPR_ZTriggerCreateMembership at line 21
- trigger on table DPRNameSpaceHasDialogTable Trigger parent table: DPRNameSpaceHasDialogTable
- references source dbo.QBM_FGISessionContext source text reference
- references source dbo.QBM_FGITableName source text reference
- references source dbo.QBM_PDBQueueInsert_Bulk source text reference
- references source dbo.QBM_PSessionErrorAdd source text reference
- references source dbo.QBM_PSQLCheckExecutable source text reference
References
- dbo.QBM_FGISessionContext
- dbo.QBM_FGITableName
- dbo.QBM_PDBQueueInsert_Bulk
- dbo.QBM_PSessionErrorAdd
- dbo.QBM_PSQLCheckExecutable
Referenced By
- No direct source references extracted.
Complete Source
1CREATE trigger DPR_TUDPRNameSpaceHasDialogTab2 ON DPRNameSpaceHasDialogTable FOR3UPDATE NOT FOR Replication4AS5BEGIN6 DECLARE @SQLToCheck QBM_YParameterList7 DECLARE @Debugswitch int = 08 BEGIN TRY9 IF EXISTS(10 SELECT TOP 1 111 FROM inserted)12 GOTO start13 IF EXISTS(14 SELECT TOP 1 115 FROM deleted)16 GOTO start17 RETURN start:18 DECLARE @GenProcID varchar(38)19 SELECT @GenProcID = dbo.QBM_FGISessionContext('')20 IF21 UPDATE(IsAdHocSingleMemberShip) OR22 UPDATE(whereclause)23 BEGIN24 IF EXISTS(25 SELECT TOP 1 126 FROM inserted i27 WHERE28 i.IsAdHocSingleMemberShip = 0 AND i.WhereClause > ' ')29 BEGIN30 RAISERROR('#LDS#Whereclauses only allowed for IsAdHocSingleMemberShip = 1.|',31 18,32 1)33 WITH NOWAIT34 END35 IF @Debugswitch > 036 BEGIN37 print 'update whereclause'38 SELECT *39 FROM inserted40 END41 INSERT INTO @SQLToCheck(Parameter1,42 ContentFull)43 SELECT44 x.XObjectKey,45 'select top 1 1 as columnvalue from ' + x.MemberTable + ' as i46 where(47 ' + x.WhereClause + '48 )'49 FROM(50 SELECT51 r.ParentTable AS ContainerTable,52 r.childtable AS MemberTable,53 i.WhereClause,54 i.XObjectKey55 FROM QBM_VQBMRelation r56 JOIN DPRNameSpaceHasDialogTable nht57 ON r.UID_DialogTableChild = nht.UID_DialogTable AND r.IsForUpdateXDateSubItem = 158 JOIN QBM_VQBMRelation rm59 ON r.UID_QBMRelationMN = rm.UID_QBMRelation60 JOIN DialogTable tc61 ON r.ChildTable = tc.TableName AND tc.isMNTable = 162 JOIN inserted i63 ON i.UID_DialogTable = r.UID_DialogTableChild64 WHERE65 r.IsForUpdateXDateSubItem = 1 AND nht.IsAdHocSingleMemberShip = 1 AND i.WhereClause > ' '66 UNION67 SELECT68 r.ParentTable AS ContainerTable,69 dbo.QBM_FGITableName(rm.UID_DialogTableReference) AS MemberTable,70 i.WhereClause,71 i.XObjectKey72 FROM QBM_VQBMRelation r73 JOIN DPRNameSpaceHasDialogTable nht74 ON r.UID_DialogTableChild = nht.UID_DialogTable AND r.IsForUpdateXDateSubItem = 175 JOIN DialogColumn ok76 ON ok.UID_DialogTable = r.UID_DialogTableChild77 JOIN DialogValidDynamicRef rm78 ON ok.UID_DialogColumn = rm.UID_DialogColumn79 JOIN DialogTable tc80 ON ok.UID_DialogTable = tc.UID_DialogTable AND tc.IsMAllTable = 181 JOIN inserted i82 ON i.UID_DialogTable = r.UID_DialogTableChild83 WHERE84 r.IsForUpdateXDateSubItem = 1 AND nht.IsAdHocSingleMemberShip = 1 AND i.WhereClause > ' ') AS x85 IF @Debugswitch > 086 BEGIN87 SELECT c.ContentFull88 FROM @SQLToCheck c89 END90 EXEC QBM_PSQLCheckExecutable @SQLToCheck,91 @RaiseError = 192 DECLARE @DBQueueElements_01 QBM_YDBQueueRaw93 INSERT INTO @DBQueueElements_01(object,94 subobject,95 genprocid)96 SELECT97 dbo.QBM_FGITableName(x.uid),98 NULL,99 @GenProcID100 FROM(101 SELECT i.UID_DialogTable AS UID102 FROM DPRNameSpaceHasDialogTable i103 JOIN deleted d104 ON i.UID_DialogTable = d.UID_DialogTable AND i.UID_DPRNameSpace = d.UID_DPRNameSpace105 WHERE106 isnull(i.IsAdHocSingleMemberShip, 0) <> isnull(d.IsAdHocSingleMemberShip, 0) OR isnull(i.WhereClause,107 '') <> isnull(d.WhereClause, '')) AS x108 EXEC QBM_PDBQueueInsert_Bulk 'DPR-K-TriggerCreateMembership',109 @DBQueueElements_01110 END111 END TRY112 BEGIN CATCH113 EXEC QBM_PSessionErrorAdd DEFAULT114 RAISERROR('',115 18,116 1)117 WITH NOWAIT118 END CATCH119END
Open raw exported source
1 create trigger DPR_TUDPRNameSpaceHasDialogTab on DPRNameSpaceHasDialogTable for Update not for Replication as begin declare @SQLToCheck QBM_YParameterList2 declare @Debugswitch int = 0 BEGIN TRY if exists (select top 1 1 from inserted) goto start if exists (select top 1 1 from deleted) goto start return start:3 declare @GenProcID varchar(38) select @GenProcID = dbo.QBM_FGISessionContext('') if update(IsAdHocSingleMemberShip) or update (whereclause) begin if 4exists (select top 1 1 from inserted i where i.IsAdHocSingleMemberShip = 0 and i.WhereClause > ' ' ) begin RAISERROR ('#LDS#Whereclauses only allowed for IsAdHocSingleMemberShip = 1.|'5, 18, 1) WITH NOWAIT end if @Debugswitch > 0 begin print 'update whereclause' select * from inserted end insert into @SQLToCheck(Parameter1, ContentFull6) select x.XObjectKey, 'select top 1 1 as columnvalue from ' + x.MemberTable + ' as i7 where(8 '+ x.WhereClause + '9 )' from ( select r.ParentTable10 as ContainerTable , r.childtable as MemberTable, i.WhereClause, i.XObjectKey from QBM_VQBMRelation r join DPRNameSpaceHasDialogTable nht on r.UID_DialogTableChild11 = nht.UID_DialogTable and r.IsForUpdateXDateSubItem = 1 join QBM_VQBMRelation rm on r.UID_QBMRelationMN = rm.UID_QBMRelation join DialogTable tc on r.ChildTable12 = tc.TableName and tc.isMNTable = 1 join inserted i on i.UID_DialogTable = r.UID_DialogTableChild where r.IsForUpdateXDateSubItem = 1 and nht.IsAdHocSingleMemberShip13 = 1 and i.WhereClause > ' ' union select r.ParentTable as ContainerTable , dbo.QBM_FGITableName(rm.UID_DialogTableReference) as MemberTable, i.WhereClause14, i.XObjectKey from QBM_VQBMRelation r join DPRNameSpaceHasDialogTable nht on r.UID_DialogTableChild = nht.UID_DialogTable and r.IsForUpdateXDateSubItem15 = 1 join DialogColumn ok on ok.UID_DialogTable = r.UID_DialogTableChild join DialogValidDynamicRef rm on ok.UID_DialogColumn = rm.UID_DialogColumn join16 DialogTable tc on ok.UID_DialogTable = tc.UID_DialogTable and tc.IsMAllTable = 1 join inserted i on i.UID_DialogTable = r.UID_DialogTableChild where r.IsForUpdateXDateSubItem17 = 1 and nht.IsAdHocSingleMemberShip = 1 and i.WhereClause > ' ' ) as x if @Debugswitch > 0 begin select c.ContentFull from @SQLToCheck c end exec QBM_PSQLCheckExecutable18 @SQLToCheck, @RaiseError = 1 declare @DBQueueElements_01 QBM_YDBQueueRaw insert into @DBQueueElements_01 (object, subobject, genprocid) select dbo.QBM_FGITableName19(x.uid), null, @GenProcID from (select i.UID_DialogTable as UID from DPRNameSpaceHasDialogTable i join deleted d on i.UID_DialogTable = d.UID_DialogTable20 and i.UID_DPRNameSpace = d.UID_DPRNameSpace where isnull(i.IsAdHocSingleMemberShip ,0) <> isnull(d.IsAdHocSingleMemberShip ,0) or isnull(i.WhereClause21 , '') <> isnull(d.WhereClause , '') ) as x exec QBM_PDBQueueInsert_Bulk 'DPR-K-TriggerCreateMembership', @DBQueueElements_01 end END TRY BEGIN CATCH 22exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH end 23