dbo.ATT_ZAttestationMakeDecisionCD
Stored ProcedureSQL_STORED_PROCEDURESandbox DB
Interpretation
- Database routine. Review parameters, called procedures, DBQueue inserts, and QBM_PJobCreate helper calls before assuming side effects.
- Object-layer bridge detected through QBM_PJobCreate helper usage.
Relations
- HOCallMethod -> AttestationCase.MakeDecision at line 32
- References QBM_PJobCreate*
- References QBM_PJobCreate_HOCallMethod*
Typed Edges
- calls object method AttestationCase.MakeDecision HOCallMethod -> AttestationCase.MakeDecision at line 32
- references source dbo.QBM_PJobCreate source text reference
- references source dbo.QBM_PJobCreate_HOCallMethod source text reference
- references source dbo.QBM_PSessionErrorAdd source text reference
References
Referenced By
- No direct source references extracted.
Complete Source
1CREATE PROCEDURE ATT_ZAttestationMakeDecisionCD(2 @SlotNumber int3)4AS5BEGIN6 DECLARE @UID_AttestationCase varchar(38)7 DECLARE @GenProcID varchar(38)8 DECLARE @Decision nvarchar(16)9 DECLARE @Reason nvarchar(255)10 DECLARE @uid_person varchar(38)11 DECLARE @cond nvarchar(max)12 DECLARE @whereclause nvarchar(max)13 DECLARE @SQLcmd nvarchar(max)14 DECLARE @muster nvarchar(max)15 DECLARE @BasisObjectKey varchar(138)16 DECLARE @DebugLevel char(1) = 'W'17 DECLARE @CountOfRows int18 DECLARE @DecisionLevel int19 DECLARE @ElementBuffer QBM_YCursorBuffer20 DECLARE @ElementCount int21 DECLARE @ElementIndex int22 DECLARE @DBQueueCurrent QBM_YDBQueueCurrent23 SET XACT_ABORT OFF24 BEGIN TRY25 INSERT INTO @DBQueueCurrent(UID_DialogDBQueue,26 UID_Parameter,27 UID_SubParameter,28 GenProcID)29 SELECT30 UID_DialogDBQueue,31 UID_Parameter,32 UID_SubParameter,33 GenProcID34 FROM QBMDBQueueCurrent cu35 WITH(readpast)36 WHERE37 cu.SlotNumber = @SlotNumber38 IF @@rowcount = 039 BEGIN40 GOTO EndLabel41 END42 SELECT43 @muster = '44if exists (select top 1 1 from AttestationCase45 where (46-- die Kundenklausel47@whereclause48 )49 and UID_AttestationCase = ''@UID_AttestationCase''50 )51 begin52 select 153 end54'55 DECLARE @AutomaticReasonTrue nvarchar(128)56 DECLARE @AutomaticReasonFalse nvarchar(128)57 INSERT INTO @ElementBuffer(UID1,58 UID2,59 ContentFull,60 LongIdent1,61 LongIdent2,62 ObjectKey1,63 Int1)64 SELECT65 ac.UID_AttestationCase,66 p.GenprocID,67 isnull(ds.WhereClause,68 N ''),69 isnull(ds.AutomaticReasonTrue,70 ''),71 isnull(ds.AutomaticReasonFalse,72 ''),73 ac.XObjectKey,74 ac.DecisionLevel75 FROM @DBQueueCurrent p76 JOIN AttestationCase ac77 ON p.uid_parameter = ac.UID_AttestationCase78 JOIN AttestationHelper ph79 ON ac.UID_AttestationCase = ph.UID_AttestationCase AND ac.decisionlevel = ph.levelnumber80 JOIN QERWorkingStep ds81 ON ph.UID_QERWorkingStep = ds.UID_QERWorkingStep82 WHERE83 ph.UID_PWODecisionRule = 'ATT-PWODecisionRule-CD' AND isnull(ac.isclosed,84 0) = 085 SELECT @ElementCount = @@ROWCOUNT86 SELECT @ElementIndex = 187 WHILE @ElementIndex <= @ElementCount88 BEGIN89 SELECT90 TOP 1 @UID_AttestationCase = bu.UID1,91 @GenProcID = bu.UID2,92 @whereclause = bu.ContentFull,93 @AutomaticReasonTrue = bu.LongIdent1,94 @AutomaticReasonFalse = bu.LongIdent2,95 @BasisObjectKey = bu.ObjectKey1,96 @DecisionLevel = bu.Int197 FROM @ElementBuffer bu98 WHERE99 bu.ElementIndex = @ElementIndex100 SELECT @SQLcmd = @muster101 SELECT102 @SQLcmd = replace(@SQLcmd,103 N '@whereclause',104 @whereclause)105 SELECT106 @SQLcmd = replace(@SQLcmd,107 N '@UID_AttestationCase',108 @UID_AttestationCase)109 BEGIN TRY110 EXEC sp_executesql @SQLcmd111 SELECT @CountOfRows = @@Rowcount112 END TRY113 BEGIN CATCH114 SELECT @CountOfRows = -1115 END CATCH116 IF @CountOfRows > 0117 BEGIN118 SELECT @decision = 'True'119 IF @AutomaticReasonTrue > ' '120 BEGIN121 SELECT @Reason = @AutomaticReasonTrue122 END123 ELSE124 BEGIN125 SELECT @reason = '#LDS#Automatic system approval with method CD : Condition was met.|'126 END127 END128 IF @CountOfRows = 0129 BEGIN130 SELECT @decision = 'False'131 IF @AutomaticReasonFalse > ' '132 BEGIN133 SELECT @Reason = @AutomaticReasonFalse134 END135 ELSE136 BEGIN137 SELECT138 @reason = '#LDS#Automatic system approval with method CD : Condition was not met.|'139 END140 END141 IF @CountOfRows < 0142 BEGIN143 SELECT @decision = 'False'144 SELECT145 @reason = '#LDS#Automatic system approval: Condition caused runtime error using method CD.|'146 END147 SELECT148 @cond = 'UID_AttestationCase = ''' + rtrim(@UID_AttestationCase) + N ''' and DecisionLevel = ' + STR(@DecisionLevel)149 EXEC QBM_PJobCreate_HOCallMethod @objecttype = 'AttestationCase',150 @whereclause = @cond,151 @save = 1,152 @MethodName = 'MakeDecision',153 @GenProcID = @GenprocID,154 @ObjectKeysAffected = DEFAULT,155 @param1 = 'sa',156 @param2 = @decision,157 @Param3 = @reason,158 @Retries = 3,159 @isToFreezeOnError = 1,160 @BasisObjectKey = @BasisObjectKey,161 @checkForExisting = 1,162 @WhereClauseAdditional = ' IsClosed = 0 '163 SELECT @ElementIndex += 1164 END165 END TRY166 BEGIN CATCH167 EXEC QBM_PSessionErrorAdd DEFAULT,168 @SQLcmd169 RAISERROR('',170 18,171 1)172 WITH nowait173 END CATCH174 endLabel:175 RETURN176END
Open raw exported source
1 create procedure ATT_ZAttestationMakeDecisionCD (@SlotNumber int) as begin declare @UID_AttestationCase varchar(38) declare @GenProcID varchar2(38) declare @Decision nvarchar(16) declare @Reason nvarchar(255) declare @uid_person varchar(38) declare @cond nvarchar(max) declare @whereclause nvarchar3(max) declare @SQLcmd nvarchar(max) declare @muster nvarchar(max) declare @BasisObjectKey varchar(138) declare @DebugLevel char(1) = 'W' declare @CountOfRows4 int declare @DecisionLevel int declare @ElementBuffer QBM_YCursorBuffer declare @ElementCount int declare @ElementIndex int declare @DBQueueCurrent QBM_YDBQueueCurrent5 SET XACT_ABORT OFF BEGIN TRY insert into @DBQueueCurrent(UID_DialogDBQueue, UID_Parameter, UID_SubParameter, GenProcID) select UID_DialogDBQueue, UID_Parameter6, UID_SubParameter, GenProcID from QBMDBQueueCurrent cu with (readpast) where cu.SlotNumber = @SlotNumber if @@rowcount = 0 begin goto EndLabel end select7 @muster = '8if exists (select top 1 1 from AttestationCase9 where (10-- die Kundenklausel11@whereclause12 )13 and UID_AttestationCase = ''@UID_AttestationCase''14 )15 begin16 select 117 end18'19 declare @AutomaticReasonTrue nvarchar(128) declare @AutomaticReasonFalse nvarchar(128) insert into @ElementBuffer (UID1 , UID2 , ContentFull , LongIdent120 , LongIdent2 , ObjectKey1 , Int1 ) select ac.UID_AttestationCase , p.GenprocID, isnull(ds.WhereClause, N'') , isnull(ds.AutomaticReasonTrue, ''), 21isnull(ds.AutomaticReasonFalse, ''), ac.XObjectKey , ac.DecisionLevel from @DBQueueCurrent p join AttestationCase ac on p.uid_parameter = ac.UID_AttestationCase22 join AttestationHelper ph on ac.UID_AttestationCase = ph.UID_AttestationCase and ac.decisionlevel = ph.levelnumber join QERWorkingStep ds on ph.UID_QERWorkingStep23 = ds.UID_QERWorkingStep where ph.UID_PWODecisionRule = 'ATT-PWODecisionRule-CD' and isnull(ac.isclosed,0) = 0 select @ElementCount = @@ROWCOUNT select24 @ElementIndex = 1 while @ElementIndex <= @ElementCount begin select top 1 @UID_AttestationCase = bu.UID1 , @GenProcID = bu.UID2 , @whereclause = bu.ContentFull25 , @AutomaticReasonTrue = bu.LongIdent1 , @AutomaticReasonFalse = bu.LongIdent2 , @BasisObjectKey = bu.ObjectKey1 , @DecisionLevel = bu.Int1 from 26@ElementBuffer bu where bu.ElementIndex = @ElementIndex select @SQLcmd = @muster select @SQLcmd = replace(@SQLcmd , N'@whereclause', @whereclause) select27 @SQLcmd = replace(@SQLcmd, N'@UID_AttestationCase', @UID_AttestationCase) BEGIN TRY exec sp_executesql @SQLcmd select @CountOfRows = @@Rowcount END TRY28 BEGIN CATCH select @CountOfRows = -1 END CATCH if @CountOfRows > 0 begin select @decision = 'True' if @AutomaticReasonTrue > ' ' begin select @Reason29 = @AutomaticReasonTrue end else begin select @reason = '#LDS#Automatic system approval with method CD : Condition was met.|' end end if @CountOfRows =30 0 begin select @decision = 'False' if @AutomaticReasonFalse > ' ' begin select @Reason = @AutomaticReasonFalse end else begin select @reason = '#LDS#Automatic system approval with method CD : Condition was not met.|'31 end end if @CountOfRows < 0 begin select @decision = 'False' select @reason = '#LDS#Automatic system approval: Condition caused runtime error using method CD.|'32 end select @cond = 'UID_AttestationCase = ''' + rtrim(@UID_AttestationCase) + N''' and DecisionLevel = ' + STR(@DecisionLevel) exec QBM_PJobCreate_HOCallMethod33 @objecttype = 'AttestationCase' , @whereclause = @cond , @save = 1 , @MethodName = 'MakeDecision' , @GenProcID = @GenprocID , @ObjectKeysAffected = DEFAULT34 , @param1 = 'sa' , @param2 = @decision , @Param3 = @reason , @Retries = 3 , @isToFreezeOnError = 1 , @BasisObjectKey = @BasisObjectKey , @checkForExisting35 = 1 , @WhereClauseAdditional = ' IsClosed = 0 ' select @ElementIndex += 1 end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default, @SQLcmd raiserror36('', 18, 1) with nowait END CATCH endLabel: return end 37