dbo.QBM_PJobUnfreeze
Stored ProcedureSQL_STORED_PROCEDURESandbox DB
Interpretation
- Database routine. Review parameters, called procedures, DBQueue inserts, and QBM_PJobCreate helper calls before assuming side effects.
Relations
- No extracted relations.
Typed Edges
- references source dbo.QBM_FGIJobQueueMessageAdd source text reference
- references source dbo.QBM_FGISessionErrorRethrow source text reference
- references source dbo.QBM_PJobQueueSetSameServer source text reference
- references source dbo.QBM_PJobUpdateState source text reference
- references source dbo.QBM_PSessionErrorAdd source text reference
- references source dbo.QBM_PWriteDialogJournal source text reference
References
- dbo.QBM_FGIJobQueueMessageAdd
- dbo.QBM_FGISessionErrorRethrow
- dbo.QBM_PJobQueueSetSameServer
- dbo.QBM_PJobUpdateState
- dbo.QBM_PSessionErrorAdd
- dbo.QBM_PWriteDialogJournal
Referenced By
- No direct source references extracted.
Complete Source
1CREATE PROCEDURE QBM_PJobUnfreeze(2 @uid_job varchar(38),3 @ReactivationOf varchar(16),4 @ApplicationName nvarchar(64) = '',5 @LogonUser nvarchar(64) = ''6)7AS8BEGIN9 DECLARE @uid_tree varchar(38)10 DECLARE @uid_JobToActivate varchar(38)11 DECLARE @Retries int12 DECLARE @nextIsSuccessor BIT13 DECLARE @JobqueueMessage nvarchar(1000) = CONCAT('#LDS#Reactivation of frozen Job {0} with parameter {1}.|',14 @uid_job,15 '|',16 @ReactivationOf,17 '|')18 DECLARE @XUser nvarchar(64) = object_name(@@procid)19 DECLARE @Xdate datetime = getutcdate()20 SET XACT_ABORT OFF21 BEGIN TRY22 SELECT @uid_tree = NULL23 SELECT @uid_tree = uid_tree24 FROM jobqueue25 WHERE26 uid_job = @uid_job AND ready2exe = N 'FROZEN'27 IF @uid_tree IS NULL28 BEGIN29 RAISERROR('#LDS#Process step to unfreeze was not found.|',30 18,31 2)32 WITH nowait33 RETURN34 END35 IF @ReactivationOf NOT IN('SUCCESS',36 'ERROR',37 'SELF',38 'ROOT')39 BEGIN40 RAISERROR('#LDS#Invalid parameter ''ReactivationOf''. Permitted values are SUCCESS, ERROR, SELF and ROOT.|',41 18,42 2)43 WITH nowait44 RETURN45 END46 IF @ReactivationOf = 'ROOT'47 BEGIN48 SELECT49 @JobqueueMessage = CONCAT('#LDS#Reactivation of process containing frozen process step {0}.|',50 @uid_job,51 '|')52 UPDATE JobQueue53 SET ErrorMessages = dbo.QBM_FGIJobQueueMessageAdd(ErrorMessages,54 @JobqueueMessage),55 XDateUpdated = @Xdate,56 XUserUpdated = @XUser57 WHERE58 UID_Tree = @uid_tree AND Ready2EXE <> N 'FALSE'59 UPDATE JobQueue60 SET Ready2EXE = N 'FALSE',61 UID_JobSameServer = UID_Job,62 WasError = 0,63 XDateUpdated = @Xdate,64 XUserUpdated = @XUser65 WHERE66 UID_Tree = @uid_tree67 UPDATE JobQueue68 SET Retries = 1,69 XDateUpdated = @Xdate,70 XUserUpdated = @XUser71 WHERE72 UID_Tree = @uid_tree AND DeferOnError = 173 UPDATE JobQueue74 SET Ready2EXE = N 'TRUE',75 XDateUpdated = @Xdate,76 XUserUpdated = @XUser77 WHERE78 UID_Tree = @uid_tree AND IsRootJob = 179 GOTO ende80 END81 UPDATE jobqueue82 SET ready2exe = N 'FALSE',83 XDateUpdated = @Xdate,84 XUserUpdated = @XUser85 WHERE86 uid_tree = @uid_tree AND ready2exe = N 'LOADED'87 SELECT @uid_JobToActivate = NULL88 IF @ReactivationOf IN('SUCCESS',89 'ERROR')90 BEGIN91 UPDATE jobqueue92 SET ready2exe= N 'FINISHED',93 xdateupdated = getutcdate(),94 XUserUpdated = @XUser,95 ErrorMessages = dbo.QBM_FGIJobQueueMessageAdd(ErrorMessages,96 @JobqueueMessage)97 WHERE98 uid_job = @uid_Job99 IF @ReactivationOf = 'SUCCESS'100 BEGIN101 SELECT102 TOP 1 @uid_JobToActivate = q.UID_JobSuccess,103 @Retries = isnull(f.Retries,104 0)105 FROM Jobqueue q106 LEFT107 OUTER108 JOIN JobQueue f109 ON q.UID_JobSuccess = f.UID_Job110 WHERE111 q.UID_Job = @uid_job112 SELECT @nextIsSuccessor = 1113 END114 ELSE115 BEGIN116 SELECT117 TOP 1 @uid_JobToActivate = q.UID_JobError,118 @Retries = isnull(f.Retries,119 0)120 FROM JobQueue q121 LEFT122 OUTER123 JOIN JobQueue f124 ON q.UID_JobError = f.UID_Job125 WHERE126 q.UID_Job = @uid_job127 SELECT @nextIsSuccessor = 0128 END129 IF isnull(@uid_JobToActivate,130 '') = ''131 BEGIN132 UPDATE jobqueue133 SET ready2exe = N 'LOADED',134 isToFreezeOnError = 0,135 DeferOnError = CASE @ReactivationOf136 WHEN 'SUCCESS' THEN137 DeferOnError138 ELSE 0139 END,140 retries = CASE @ReactivationOf141 WHEN 'SUCCESS' THEN142 1143 ELSE 0144 END,145 XDateUpdated = @Xdate,146 XUserUpdated = @XUser147 WHERE148 uid_Job = @uid_job149 EXEC QBM_PJobUpdateState @uid_job,150 'FINISHED',151 @nextIsSuccessor,152 @JobqueueMessage153 END154 END155 IF @ReactivationOf = 'SELF'156 BEGIN157 SELECT @uid_jobToActivate = @uid_job158 SELECT @Retries = 1159 END160 IF @uid_JobToActivate > ' '161 BEGIN162 UPDATE jobqueue163 SET retries = @Retries,164 ready2exe= N 'TRUE',165 startat = GetUTCDate(),166 xdateupdated = getutcdate(),167 ErrorMessages = CASE168 WHEN @ReactivationOf = 'SELF' THEN169 dbo.QBM_FGIJobQueueMessageAdd(ErrorMessages,170 @JobqueueMessage)171 END,172 XUserUpdated = @XUser173 WHERE174 uid_job = @uid_jobToActivate175 EXEC QBM_PJobQueueSetSameServer @uid_jobToActivate176 END177 END TRY178 BEGIN CATCH179 EXEC QBM_PSessionErrorAdd DEFAULT180 DECLARE @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow()181 RAISERROR(@Rethrow,182 18,183 1)184 WITH NOWAIT185 END CATCH186 ende:187 EXEC QBM_PWriteDialogJournal @JobqueueMessage,188 @ApplicationName,189 @LogonUser,190 'W'191 RETURN192END
Open raw exported source
1 create procedure QBM_PJobUnfreeze (@uid_job varchar(38) , @ReactivationOf varchar(16) , @ApplicationName nvarchar(64) = '' , @LogonUser nvarchar2(64) = '' ) as begin declare @uid_tree varchar(38) declare @uid_JobToActivate varchar(38) declare @Retries int declare @nextIsSuccessor bit declare @JobqueueMessage3 nvarchar(1000) = concat('#LDS#Reactivation of frozen Job {0} with parameter {1}.|' , @uid_job , '|' , @ReactivationOf , '|' ) declare @XUser nvarchar(644) = object_name(@@procid) declare @Xdate datetime = getutcdate() SET XACT_ABORT OFF BEGIN TRY select @uid_tree = null select @uid_tree = uid_tree from 5jobqueue where uid_job = @uid_job and ready2exe = N'FROZEN' if @uid_tree is null begin raiserror('#LDS#Process step to unfreeze was not found.|', 18, 26) with nowait return end if @ReactivationOf not in ('SUCCESS', 'ERROR', 'SELF', 'ROOT') begin raiserror('#LDS#Invalid parameter ''ReactivationOf''. Permitted values are SUCCESS, ERROR, SELF and ROOT.|'7, 18, 2) with nowait return end if @ReactivationOf = 'ROOT' begin select @JobqueueMessage = concat('#LDS#Reactivation of process containing frozen process step {0}.|'8 , @uid_job , '|' ) update JobQueue set ErrorMessages = dbo.QBM_FGIJobQueueMessageAdd(ErrorMessages, @JobqueueMessage) , XDateUpdated = @Xdate , XUserUpdated9 = @XUser where UID_Tree = @uid_tree and Ready2EXE <> N'FALSE' update JobQueue set Ready2EXE = N'FALSE' , UID_JobSameServer = UID_Job , WasError = 0 ,10 XDateUpdated = @Xdate , XUserUpdated = @XUser where UID_Tree = @uid_tree update JobQueue set Retries = 1 , XDateUpdated = @Xdate , XUserUpdated = @XUser11 where UID_Tree = @uid_tree and DeferOnError = 1 update JobQueue set Ready2EXE = N'TRUE' , XDateUpdated = @Xdate , XUserUpdated = @XUser where UID_Tree12 = @uid_tree and IsRootJob = 1 goto ende end update jobqueue set ready2exe = N'FALSE' , XDateUpdated = @Xdate , XUserUpdated = @XUser where uid_tree13 = @uid_tree and ready2exe = N'LOADED' select @uid_JobToActivate = null if @ReactivationOf in( 'SUCCESS', 'ERROR') begin update jobqueue set ready2exe=14 N'FINISHED', xdateupdated = getutcdate() , XUserUpdated = @XUser , ErrorMessages = dbo.QBM_FGIJobQueueMessageAdd(ErrorMessages, @JobqueueMessage) where15 uid_job = @uid_Job if @ReactivationOf = 'SUCCESS' begin select top 1 @uid_JobToActivate = q.UID_JobSuccess, @Retries = isnull(f.Retries, 0) from Jobqueue16 q left outer join JobQueue f on q.UID_JobSuccess = f.UID_Job where q.UID_Job = @uid_job select @nextIsSuccessor = 1 end else begin select top 1 @uid_JobToActivate17 = q.UID_JobError, @Retries = isnull(f.Retries, 0) from JobQueue q left outer join JobQueue f on q.UID_JobError = f.UID_Job where q.UID_Job = @uid_job 18select @nextIsSuccessor = 0 end if isnull(@uid_JobToActivate, '') = '' begin update jobqueue set ready2exe = N'LOADED' , isToFreezeOnError = 0 , DeferOnError19 = case @ReactivationOf when 'SUCCESS' then DeferOnError else 0 end , retries = case @ReactivationOf when 'SUCCESS' then 1 else 0 end , XDateUpdated20 = @Xdate , XUserUpdated = @XUser where uid_Job = @uid_job exec QBM_PJobUpdateState @uid_job, 'FINISHED', @nextIsSuccessor, @JobqueueMessage end end 21if @ReactivationOf = 'SELF' begin select @uid_jobToActivate = @uid_job select @Retries = 1 end if @uid_JobToActivate > ' ' begin update jobqueue set retries22 = @Retries, ready2exe= N'TRUE', startat = GetUTCDate(), xdateupdated = getutcdate() , ErrorMessages = case when @ReactivationOf = 'SELF' then dbo.QBM_FGIJobQueueMessageAdd23(ErrorMessages, @JobqueueMessage) end , XUserUpdated = @XUser where uid_job = @uid_jobToActivate exec QBM_PJobQueueSetSameServer @uid_jobToActivate end24 END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default declare @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow() RAISERROR (@Rethrow, 18, 1) WITH25 NOWAIT END CATCH ende: exec QBM_PWriteDialogJournal @JobqueueMessage, @ApplicationName, @LogonUser, 'W' return end 26