dbo.CPL_ZSubRuleFillObject
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_FGISessionContext source text reference
- references source dbo.QBM_PDBQueueCalculateDelta source text reference
- references source dbo.QBM_PExecuteSQLWithRetry_LLP source text reference
- references source dbo.QBM_PSessionContextSet source text reference
- references source dbo.QBM_PSessionErrorAdd source text reference
References
- dbo.QBM_FGISessionContext
- dbo.QBM_PDBQueueCalculateDelta
- dbo.QBM_PExecuteSQLWithRetry_LLP
- dbo.QBM_PSessionContextSet
- dbo.QBM_PSessionErrorAdd
Referenced By
- No direct source references extracted.
Complete Source
1CREATE PROCEDURE CPL_ZSubRuleFillObject(2 @Slotnumber int,3 @uid_complianceSubrule varchar(38),4 @Dummy1 varchar(38),5 @GenProcID varchar(38)6)7AS8BEGIN9 DECLARE @Sourcedata QBM_YDataForDelta,10 @CountDeltaQantity int,11 @CountDeltaOrigin int12 DECLARE @SQLcmd nvarchar(max)13 DECLARE @whereclause nvarchar(max)14 DECLARE @uid_ComplianceRule varchar(38)15 DECLARE @isSimpleMode BIT16 DECLARE @IsInactive BIT17 DECLARE @IsWorkingCopy BIT18 DECLARE @ElementCount int19 DECLARE @ElementIndex int20 DECLARE @ElementLast int21 DECLARE @GenProcID_R varchar(38) = dbo.QBM_FGISessionContext('')22 BEGIN TRY23 SELECT24 TOP 1 @whereclause = whereclause,25 @uid_complianceRule = uid_complianceRule26 FROM ComplianceSubRule27 WHERE28 uid_complianceSubrule = @uid_complianceSubrule29 SELECT @isSimpleMode = NULL30 SELECT31 @isSimpleMode = isSimplemode,32 @IsInactive = isnull(IsInactive,33 0),34 @IsWorkingCopy = isnull(IsWorkingCopy,35 0)36 FROM ComplianceRule37 WHERE38 uid_complianceRule = @uid_complianceRule39 IF isnull(@whereclause,40 N '') = '' OR isnull(@isSimpleMode,41 0) = 0 OR @IsInactive = 1 OR @IsWorkingCopy = 142 BEGIN43 EXEC QBM_PSessionContextSet 'GenProcID',44 @GenProcID45 DELETE ComplianceSubRuleObject46 WHERE47 uid_complianceSubrule = @uid_complianceSubrule48 GOTO endLabel49 END50 INSERT INTO @SourceData(IsUpcommingContent,51 XOriginAfter,52 Element,53 AssignedElement,54 XOriginBefore)55 SELECT56 0,57 0,58 uid_complianceSubrule,59 ObjectKeyElement,60 161 FROM ComplianceSubRuleObject62 WHERE63 uid_complianceSubrule = @uid_complianceSubrule64 SELECT65 @SQLcmd = N '66 select 1, 0, 1 67 , uid_complianceSubRule, ObjectKeyElement68 from ( ' + @whereclause + '69 ) as x 70 --where ' + convert71 (nvarchar(16),72 @isinactive) + ' = 073 --and ' + convert(nvarchar(16),74 @isworkingCopy) + ' = 075'76 INSERT INTO @SourceData(IsUpcommingContent,77 XOriginBefore,78 XOriginAfter,79 Element,80 AssignedElement)81 EXEC QBM_PExecuteSQLWithRetry_LLP @SQLStatement = @SQLcmd,82 @LockTimeout_ms = DEFAULT,83 @MaxWaitTimeForLock_s = DEFAULT,84 @ProcIDForJournal = @@procid,85 @HandleErrorSilent = 0 berechnen:86 EXEC QBM_PDBQueueCalculateDelta @SourceData,87 @DeltaQuantity = 0,88 @DeltaDelete = 1,89 @DeltaInsert = 1,90 @DeltaOrigin = 0,91 @CountDeltaQantity = @CountDeltaQantity OUTPUT,92 @CountDeltaOrigin = @CountDeltaOrigin OUTPUT,93 @UseIsInEffect = 0,94 @SlotNumber = @SlotNumber95 IF @CountDeltaQantity > 096 BEGIN97 DECLARE @GenProcIDs_CountDeltaQuantity QBM_YCursorBuffer98 INSERT INTO @GenProcIDs_CountDeltaQuantity(UID1)99 SELECT de.GenProcID100 FROM #QBMDeltaDelete de101 UNION102 SELECT de.GenProcID103 FROM #QBMDeltaInsert de104 SELECT @ElementCount = @@ROWCOUNT105 SELECT @ElementIndex = @@IDENTITY - @ElementCount +1106 SELECT @ElementLast = @@IDENTITY107 WHILE @ElementIndex <= @ElementLast108 BEGIN109 SELECT TOP 1 @GenProcID = bu.UID1110 FROM @GenProcIDs_CountDeltaQuantity bu111 WHERE112 bu.ElementIndex = @ElementIndex113 IF EXISTS(114 SELECT TOP 1 1115 FROM #QBMDeltaDelete x116 WHERE117 x.GenProcID = @GenProcID)118 BEGIN119 EXEC QBM_PSessionContextSet 'GenProcID',120 @GenProcID121 DELETE122 FROM ComplianceSubRuleObject123 WHERE124 EXISTS(125 SELECT TOP 1 1126 FROM #QBMDeltaDelete d127 WHERE128 d.Element = ComplianceSubRuleObject.uid_complianceSubrule AND d.AssignedElement = ComplianceSubRuleObject.ObjectKeyElement AND d.GenProcID129 = @GenProcID)130 END131 IF EXISTS(132 SELECT TOP 1 1133 FROM #QBMDeltaInsert x134 WHERE135 x.GenProcID = @GenProcID)136 BEGIN137 EXEC QBM_PSessionContextSet 'GenProcID',138 @GenProcID139 INSERT INTO ComplianceSubRuleObject(UID_ComplianceSubRuleObject,140 uid_complianceSubrule,141 ObjectKeyElement)142 SELECT143 newid(),144 Element,145 AssignedElement146 FROM #QBMDeltaInsert147 WHERE148 GenProcID = @GenProcID149 END150 SELECT @ElementIndex += 1151 END152 END153 END TRY154 BEGIN CATCH155 EXEC QBM_PSessionErrorAdd DEFAULT156 RAISERROR('',157 18,158 1)159 WITH NOWAIT160 END CATCH161 endLabel:162 EXEC QBM_PSessionContextSet 'GenProcID',163 @GenProcID_R164 RETURN165END
Open raw exported source
1 create procedure CPL_ZSubRuleFillObject ( @Slotnumber int , @uid_complianceSubrule varchar(38) , @Dummy1 varchar(38) , @GenProcID varchar2(38) ) AS begin declare @Sourcedata QBM_YDataForDelta , @CountDeltaQantity int , @CountDeltaOrigin int declare @SQLcmd nvarchar(max) declare @whereclause3 nvarchar(max) declare @uid_ComplianceRule varchar(38) declare @isSimpleMode bit declare @IsInactive bit declare @IsWorkingCopy bit declare @ElementCount4 int declare @ElementIndex int declare @ElementLast int declare @GenProcID_R varchar(38) = dbo.QBM_FGISessionContext('') BEGIN TRY select top 1 @whereclause5 = whereclause, @uid_complianceRule = uid_complianceRule from ComplianceSubRule where uid_complianceSubrule = @uid_complianceSubrule select @isSimpleMode6 = null select @isSimpleMode = isSimplemode, @IsInactive = isnull(IsInactive,0), @IsWorkingCopy = isnull(IsWorkingCopy,0) from ComplianceRule where uid_complianceRule7 = @uid_complianceRule if isnull(@whereclause, N'') = '' or isnull(@isSimpleMode, 0) = 0 or @IsInactive = 1 or @IsWorkingCopy = 1 begin exec QBM_PSessionContextSet8 'GenProcID', @GenProcID delete ComplianceSubRuleObject where uid_complianceSubrule = @uid_complianceSubrule goto endLabel end insert into @SourceData(9 IsUpcommingContent, XOriginAfter , Element, AssignedElement, XOriginBefore ) select 0, 0 , uid_complianceSubrule, ObjectKeyElement, 1 from ComplianceSubRuleObject10 where uid_complianceSubrule = @uid_complianceSubrule select @SQLcmd = N'11 select 1, 0, 1 12 , uid_complianceSubRule, ObjectKeyElement13 from ( '14 + @whereclause + '15 ) as x 16 --where ' + convert(nvarchar(16), @isinactive) + ' = 017 --and ' + convert(nvarchar(16), @isworkingCopy) + ' = 018' 19insert into @SourceData( IsUpcommingContent, XOriginBefore, XOriginAfter , Element, AssignedElement ) exec QBM_PExecuteSQLWithRetry_LLP @SQLStatement =20 @SQLcmd , @LockTimeout_ms = default , @MaxWaitTimeForLock_s = default , @ProcIDForJournal = @@procid , @HandleErrorSilent = 0 berechnen: exec QBM_PDBQueueCalculateDelta21 @SourceData, @DeltaQuantity = 0, @DeltaDelete = 1, @DeltaInsert = 1, @DeltaOrigin = 0, @CountDeltaQantity = @CountDeltaQantity output , @CountDeltaOrigin22 = @CountDeltaOrigin output , @UseIsInEffect = 0 , @SlotNumber = @SlotNumber if @CountDeltaQantity > 0 begin declare @GenProcIDs_CountDeltaQuantity QBM_YCursorBuffer23 insert into @GenProcIDs_CountDeltaQuantity (UID1) select de.GenProcID from #QBMDeltaDelete de union select de.GenProcID from #QBMDeltaInsert de select24 @ElementCount = @@ROWCOUNT select @ElementIndex = @@IDENTITY - @ElementCount +1 select @ElementLast = @@IDENTITY while @ElementIndex <= @ElementLast begin25 select top 1 @GenProcID = bu.UID1 from @GenProcIDs_CountDeltaQuantity bu where bu.ElementIndex = @ElementIndex if exists (select top 1 1 from #QBMDeltaDelete26 x where x.GenProcID = @GenProcID ) begin exec QBM_PSessionContextSet 'GenProcID', @GenProcID delete from ComplianceSubRuleObject where exists (select 27top 1 1 from #QBMDeltaDelete d where d.Element = ComplianceSubRuleObject.uid_complianceSubrule and d.AssignedElement = ComplianceSubRuleObject.ObjectKeyElement28 and d.GenProcID = @GenProcID ) end if exists (select top 1 1 from #QBMDeltaInsert x where x.GenProcID = @GenProcID ) begin exec QBM_PSessionContextSet29 'GenProcID', @GenProcID insert into ComplianceSubRuleObject (UID_ComplianceSubRuleObject, uid_complianceSubrule, ObjectKeyElement ) select newid(), Element30, AssignedElement from #QBMDeltaInsert where GenProcID = @GenProcID end select @ElementIndex += 1 end end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd31 default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH endLabel: exec QBM_PSessionContextSet 'GenProcID', @GenProcID_R return end 32