dbo.QBM_TUJobqueue
Database TriggerSQL_TRIGGERSandbox DB
Interpretation
- Database trigger. Treat parent table and enqueue/object-layer calls as the main relation points.
Relations
- Trigger parent table: JobQueue
Typed Edges
- trigger on table JobQueue Trigger parent table: JobQueue
- references source dbo.QBM_FCVStringToGUID source text reference
- references source dbo.QBM_FGISessionContext source text reference
- references source dbo.QBM_PJobQueueOverviewSetInv source text reference
- references source dbo.QBM_PSessionErrorAdd source text reference
- references source dbo.QBM_TUJob source text reference
References
- dbo.QBM_FCVStringToGUID
- dbo.QBM_FGISessionContext
- dbo.QBM_PJobQueueOverviewSetInv
- dbo.QBM_PSessionErrorAdd
- dbo.QBM_TUJob
Referenced By
- No direct source references extracted.
Complete Source
1CREATE trigger QBM_TUJobqueue2 ON JobQueue FOR3UPDATE NOT FOR Replication4AS5BEGIN6 DECLARE @QueuesToNotify QBM_YParameterList7 DECLARE @Debugswitch int = 08 DECLARE @GenProcID varchar(38) = dbo.QBM_FGISessionContext('')9 BEGIN TRY10 IF EXISTS(11 SELECT TOP 1 112 FROM inserted)13 GOTO start14 IF EXISTS(15 SELECT TOP 1 116 FROM deleted)17 GOTO start18 RETURN start:19 IF20 UPDATE(Ready2EXE)21 BEGIN22 IF @Debugswitch > 023 BEGIN24 print 'Ready2EXE change detected'25 END26 DECLARE @DBQueueElements_01 QBM_YDBQueueRaw27 INSERT INTO @DBQueueElements_01(Object,28 SubObject,29 GenProcID)30 SELECT31 dbo.QBM_FCVStringToGUID('',32 x.QueueName),33 NULL,34 @GenProcID35 FROM(36 SELECT37 DISTINCT a.Queue AS QueueName38 FROM deleted a39 JOIN JobQueue n40 ON a.UID_Job = n.UID_Job41 WHERE42 a.Ready2EXE <> n.Ready2EXE AND n.Ready2EXE = N 'TRUE') AS x43 DELETE @DBQueueElements_0144 FROM @DBQueueElements_01 q45 JOIN QBMJobqueueOverview o46 WITH(readpast)47 ON q.Object = o.UID_QBMJobqueueOverview48 WHERE49 o.IsInvalid = 150 IF EXISTS(51 SELECT TOP 1 152 FROM @DBQueueElements_01)53 BEGIN54 EXEC QBM_PJobQueueOverviewSetInv @DBQueueElements_0155 END56 END57 IF58 UPDATE(ParamIN)59 BEGIN60 IF EXISTS(61 SELECT TOP 1 162 FROM deleted d63 JOIN Jobqueue q64 ON d.UID_Job = q.uid_job65 WHERE66 isnull(d.ParamIN, N '') <> isnull(q.ParamIN, N '') AND d.ParamIN > ' ')67 BEGIN68 RAISERROR('#LDS#Invalid changes of properties in jobqueue.|',69 18,70 2)71 WITH nowait72 END73 END74 IF75 UPDATE(UID_Tree) OR(76 UPDATE(Queue)) OR77 UPDATE(ComponentClass) OR78 UPDATE(ExecutionType) OR79 UPDATE(ComponentAssembly) OR80 UPDATE(TaskName) OR81 UPDATE(UID_JobError) OR82 UPDATE(UID_JobSuccess)83 BEGIN84 IF EXISTS(85 SELECT TOP 1 186 FROM deleted d87 JOIN Jobqueue q88 ON d.UID_Job = q.uid_job89 WHERE90 d.UID_Tree <> q.UID_Tree OR isnull(d.Queue, N '') <> isnull(q.Queue, N '') OR isnull(d.ComponentClass,91 N '') <> isnull(q.ComponentClass, N '') OR isnull(d.ExecutionType, N '') <> isnull(q.ExecutionType, N '') OR isnull(d.ComponentAssembly,92 N '') <> isnull(q.ComponentAssembly, N '') OR isnull(d.TaskName, N '') <> isnull(q.TaskName, N '') OR isnull(d.UID_JobError,93 '') <> isnull(q.UID_JobError, '') OR isnull(d.UID_JobSuccess, '') <> isnull(q.UID_JobSuccess, ''))94 BEGIN95 RAISERROR('#LDS#Invalid changes of properties in jobqueue.|',96 18,97 2)98 WITH nowait99 END100 END101 END TRY102 BEGIN CATCH103 EXEC QBM_PSessionErrorAdd DEFAULT104 RAISERROR('',105 18,106 1)107 WITH NOWAIT108 END CATCH109END
Open raw exported source
1create trigger QBM_TUJobqueue on JobQueue for update not for Replication as begin declare @QueuesToNotify QBM_YParameterList declare @Debugswitch2 int = 0 declare @GenProcID varchar(38) = dbo.QBM_FGISessionContext('') BEGIN TRY if exists (select top 1 1 from inserted) goto start if exists (select3 top 1 1 from deleted) goto start return start: if update(Ready2EXE) begin if @Debugswitch > 0 begin print 'Ready2EXE change detected' end declare4 @DBQueueElements_01 QBM_YDBQueueRaw insert into @DBQueueElements_01(Object, SubObject, GenProcID) select dbo.QBM_FCVStringToGUID('', x.QueueName), null5, @GenProcID from ( select distinct a.Queue as QueueName from deleted a join JobQueue n on a.UID_Job = n.UID_Job where a.Ready2EXE <> n.Ready2EXE and 6n.Ready2EXE = N'TRUE' ) as x delete @DBQueueElements_01 from @DBQueueElements_01 q join QBMJobqueueOverview o with (readpast) on q.Object = o.UID_QBMJobqueueOverview7 where o.IsInvalid = 1 if exists (select top 1 1 from @DBQueueElements_01 ) begin exec QBM_PJobQueueOverviewSetInv @DBQueueElements_01 end end if update8(ParamIN) begin if exists (select top 1 1 from deleted d join Jobqueue q on d.UID_Job = q.uid_job where isnull(d.ParamIN, N'') <> isnull(q.ParamIN, N''9) and d.ParamIN > ' ' ) begin raiserror( '#LDS#Invalid changes of properties in jobqueue.|', 18, 2) with nowait end end if update(UID_Tree) or (update10(Queue) ) or update(ComponentClass) or update(ExecutionType) or update(ComponentAssembly) or update(TaskName) or update(UID_JobError) or update(UID_JobSuccess11) begin if exists (select top 1 1 from deleted d join Jobqueue q on d.UID_Job = q.uid_job where d.UID_Tree <> q.UID_Tree or isnull(d.Queue, N'') <> isnull12(q.Queue, N'') or isnull(d.ComponentClass, N'') <> isnull(q.ComponentClass, N'') or isnull(d.ExecutionType, N'') <> isnull(q.ExecutionType, N'') or isnull13(d.ComponentAssembly, N'') <> isnull(q.ComponentAssembly, N'') or isnull(d.TaskName, N'') <> isnull(q.TaskName, N'') or isnull(d.UID_JobError, '') <> isnull14(q.UID_JobError, '') or isnull(d.UID_JobSuccess, '') <> isnull(q.UID_JobSuccess, '') ) begin raiserror( '#LDS#Invalid changes of properties in jobqueue.|'15, 18, 2) with nowait end end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH end 16