dbo.TSB_ZUNSGroupB3InUNSGroupB3
Stored ProcedureSQL_STORED_PROCEDURESandbox DB
Interpretation
- Database routine. Review parameters, called procedures, DBQueue inserts, and QBM_PJobCreate helper calls before assuming side effects.
- DBQueue relation detected. Follow the task procedure and referenced-by list for async processing.
Relations
- Single DBQueue insert -> TSB-K-UNSGroupB3InUNSGroupB3-C / TSB_ZUNSGroupB3InUNSGroupB3_C at line 25
- References QBM_PDBQueueInsert_Single
Typed Edges
- queues DBQueue task TSB_ZUNSGroupB3InUNSGroupB3_C at line 25 Single DBQueue insert -> TSB-K-UNSGroupB3InUNSGroupB3-C / TSB_ZUNSGroupB3InUNSGroupB3_C at line 25
- references source dbo.QBM_FCVElementToObjectKey2 source text reference
- references source dbo.QBM_FGISessionContext source text reference
- references source dbo.QBM_PDBQueueCalculateDelta source text reference
- references source dbo.QBM_PDBQueueInsert_Single source text reference
- references source dbo.QBM_PSessionContextSet source text reference
- references source dbo.QBM_PSessionErrorAdd source text reference
- queues DBQueue task TSB-K-UNSGroupB3InUNSGroupB3-C -> TSB_ZUNSGroupB3InUNSGroupB3_C QBM_PDBQueueInsert_Single 'TSB-K-UNSGroupB3InUNSGroupB3-C', '', '', @GenProcID select @ElementIndex += 1 end end if @CountDeltaOrigin > 0 begin declare @GenProcIDs_CountDeltaOrigin QBM_YCursorBuffer insert into @GenProcIDs_CountDeltaOrigin…
Complete Source
1CREATE PROCEDURE TSB_ZUNSGroupB3InUNSGroupB3(2 @SlotNumber int3)4AS5BEGIN6 DECLARE @Sourcedata QBM_YDataForDelta,7 @CountDeltaQantity int,8 @CountDeltaOrigin int9 DECLARE @lauf int10 DECLARE @GenProcID varchar(38)11 DECLARE @ElementCount int12 DECLARE @ElementIndex int13 DECLARE @ElementLast int14 DECLARE @GenProcID_R varchar(38) = dbo.QBM_FGISessionContext('')15 DECLARE @DBQueueCurrent QBM_YDBQueueCurrent16 BEGIN TRY17 INSERT INTO @DBQueueCurrent(UID_DialogDBQueue,18 UID_Parameter,19 UID_SubParameter,20 GenProcID)21 SELECT22 UID_DialogDBQueue,23 UID_Parameter,24 UID_SubParameter,25 GenProcID26 FROM QBMDBQueueCurrent cu27 WITH(readpast)28 WHERE29 cu.SlotNumber = @SlotNumber30 IF @@rowcount = 031 BEGIN32 GOTO EndLabel33 END34 INSERT INTO @SourceData(IsUpcommingContent,35 XOriginAfter,36 Element,37 AssignedElement,38 XOriginBefore,39 XIsInEffectBefore,40 XIsInEffectAfter)41 SELECT42 0,43 0,44 UID_UNSGroupB3Parent,45 UID_UNSGroupB3Child,46 Levelnumber + 1,47 1,48 149 FROM UNSGroupB3Collection50 JOIN @DBQueueCurrent x51 ON UID_UNSGroupB3Parent = x.uid_parameter52 DECLARE @QBMDeltaHelper_01 QBM_YDBQueueDeltaHelper53 INSERT INTO @QBMDeltaHelper_01(Element,54 AssignedElement,55 XOrigin)56 SELECT57 uid_parameter,58 uid_parameter,59 160 FROM @DBQueueCurrent p61 SELECT @lauf = 162 WHILE @lauf > 063 BEGIN64 INSERT INTO @QBMDeltaHelper_01(Element,65 AssignedElement,66 XOrigin)67 SELECT68 DISTINCT a.Element,69 gig.uid_UNSGroupB3Child,70 a.XOrigin +171 FROM @QBMDeltaHelper_01 a72 JOIN UNSGroupB3InUNSGroupB3 gig73 ON a.AssignedElement = gig.uid_UNSGroupB3Parent74 WHERE75 NOT EXISTS(76 SELECT TOP 1 177 FROM @QBMDeltaHelper_01 e78 WHERE79 e.Element = a.Element AND e.AssignedElement = gig.uid_UNSGroupB3Child)80 SELECT @lauf = @@rowcount81 END82 INSERT INTO @SourceData(IsUpcommingContent,83 XOriginBefore,84 XOriginAfter,85 Element,86 AssignedElement,87 XIsInEffectBefore,88 XIsInEffectAfter)89 SELECT90 1,91 0,92 p.XOrigin,93 p.Element,94 p.AssignedElement,95 1,96 197 FROM @QBMDeltaHelper_01 p98 EXEC QBM_PDBQueueCalculateDelta @SourceData,99 @DeltaQuantity = 0,100 @DeltaDelete = 1,101 @DeltaInsert = 1,102 @DeltaOrigin = 1,103 @CountDeltaQantity = @CountDeltaQantity OUTPUT,104 @CountDeltaOrigin = @CountDeltaOrigin OUTPUT,105 @UseIsInEffect = 0,106 @SlotNumber = @SlotNumber,107 @DBQueueCurrentExtern = @DBQueueCurrent108 IF @CountDeltaQantity > 0109 BEGIN110 DECLARE @GenProcIDs_CountDeltaQantity QBM_YCursorBuffer111 INSERT INTO @GenProcIDs_CountDeltaQantity(UID1)112 SELECT de.GenProcID113 FROM #QBMDeltaDelete de114 UNION115 SELECT de.GenProcID116 FROM #QBMDeltaInsert de117 SELECT @ElementCount = @@ROWCOUNT118 SELECT @ElementIndex = @@IDENTITY - @ElementCount +1119 SELECT @ElementLast = @@IDENTITY120 WHILE @ElementIndex <= @ElementLast121 BEGIN122 SELECT TOP 1 @GenProcID = bu.UID1123 FROM @GenProcIDs_CountDeltaQantity bu124 WHERE125 bu.ElementIndex = @ElementIndex126 IF EXISTS(127 SELECT TOP 1 1128 FROM #QBMDeltaDelete x129 WHERE130 x.GenProcID = @GenProcID)131 BEGIN132 EXEC QBM_PSessionContextSet 'GenProcID',133 @GenProcID134 DELETE UNSGroupB3Collection135 WHERE136 EXISTS(137 SELECT TOP 1 1138 FROM #QBMDeltaDelete d139 WHERE140 d.AssignedElement = UNSGroupB3Collection.uid_UNSGroupB3Child AND d.Element = UNSGroupB3Collection.uid_UNSGroupB3Parent AND d.GenProcID =141 @GenProcID)142 END143 IF EXISTS(144 SELECT TOP 1 1145 FROM #QBMDeltaInsert x146 WHERE147 x.GenProcID = @GenProcID)148 BEGIN149 EXEC QBM_PSessionContextSet 'GenProcID',150 @GenProcID151 INSERT INTO UNSGroupB3Collection(UID_UNSGroupB3Parent,152 UID_UNSGroupB3Child,153 LevelNumber,154 XObjectKey)155 SELECT156 x.uid_UNSGroupB3Parent,157 x.uid_UNSGroupB3Child,158 x.LevelNumber - 1,159 dbo.QBM_FCVElementToObjectKey2('UNSGroupB3Collection',160 'UID_UNSGroupB3Parent',161 x.UID_UNSGroupB3Parent,162 'UID_UNSGroupB3Child',163 x.UID_UNSGroupB3Child)164 FROM(165 SELECT166 Element AS uid_UNSGroupB3Parent,167 AssignedElement AS uid_UNSGroupB3Child,168 XOrigin AS LevelNumber169 FROM #QBMDeltaInsert170 WHERE171 GenProcID = @GenProcID) AS x172 JOIN UNSGroupB3 p173 ON p.uid_UNSGroupB3 = x.uid_UNSGroupB3Parent174 END175 EXEC QBM_PDBQueueInsert_Single 'TSB-K-UNSGroupB3InUNSGroupB3-C',176 '',177 '',178 @GenProcID179 SELECT @ElementIndex += 1180 END181 END182 IF @CountDeltaOrigin > 0183 BEGIN184 DECLARE @GenProcIDs_CountDeltaOrigin QBM_YCursorBuffer185 INSERT INTO @GenProcIDs_CountDeltaOrigin(UID1)186 SELECT187 DISTINCT de.GenProcID188 FROM #QBMDeltaOrigin de189 SELECT @ElementCount = @@ROWCOUNT190 SELECT @ElementIndex = @@IDENTITY - @ElementCount +1191 SELECT @ElementLast = @@IDENTITY192 WHILE @ElementIndex <= @ElementLast193 BEGIN194 SELECT TOP 1 @GenProcID = bu.UID1195 FROM @GenProcIDs_CountDeltaOrigin bu196 WHERE197 bu.ElementIndex = @ElementIndex198 EXEC QBM_PSessionContextSet 'GenProcID',199 @GenProcID200 UPDATE UNSGroupB3Collection201 SET Levelnumber = x.LevelNumber - 1202 FROM UNSGroupB3Collection co203 JOIN(204 SELECT205 Element AS uid_UNSGroupB3Parent,206 AssignedElement AS uid_UNSGroupB3Child,207 XOrigin AS LevelNumber208 FROM #QBMDeltaOrigin209 WHERE210 GenProcID = @GenProcID) AS x211 ON co.uid_UNSGroupB3Parent = x.uid_UNSGroupB3Parent AND co.UID_UNSGroupB3Child = x.UID_UNSGroupB3Child212 WHERE213 co.LevelNumber <> x.Levelnumber -1214 SELECT @ElementIndex += 1215 END216 END217 END TRY218 BEGIN CATCH219 EXEC QBM_PSessionErrorAdd DEFAULT220 RAISERROR('',221 18,222 1)223 WITH NOWAIT224 END CATCH225 endLabel:226 EXEC QBM_PSessionContextSet 'GenProcID',227 @GenProcID_R228 RETURN229END
Open raw exported source
1 create procedure TSB_ZUNSGroupB3InUNSGroupB3 (@SlotNumber int) AS begin declare @Sourcedata QBM_YDataForDelta , @CountDeltaQantity int2 , @CountDeltaOrigin int declare @lauf int declare @GenProcID varchar(38) declare @ElementCount int declare @ElementIndex int declare @ElementLast int 3declare @GenProcID_R varchar(38) = dbo.QBM_FGISessionContext('') declare @DBQueueCurrent QBM_YDBQueueCurrent BEGIN TRY insert into @DBQueueCurrent(UID_DialogDBQueue4, UID_Parameter, UID_SubParameter, GenProcID) select UID_DialogDBQueue, UID_Parameter, UID_SubParameter, GenProcID from QBMDBQueueCurrent cu with (readpast5) where cu.SlotNumber = @SlotNumber if @@rowcount = 0 begin goto EndLabel end insert into @SourceData( IsUpcommingContent, XOriginAfter , Element, AssignedElement6, XOriginBefore , XIsInEffectBefore, XIsInEffectAfter ) select 0, 0 , UID_UNSGroupB3Parent, UID_UNSGroupB3Child, Levelnumber + 1 , 1,1 from UNSGroupB3Collection7 join @DBQueueCurrent x on UID_UNSGroupB3Parent = x.uid_parameter declare @QBMDeltaHelper_01 QBM_YDBQueueDeltaHelper insert into @QBMDeltaHelper_01(Element8, AssignedElement, XOrigin) select uid_parameter, uid_parameter, 1 from @DBQueueCurrent p select @lauf = 1 while @lauf > 0 begin insert into @QBMDeltaHelper_019 (Element, AssignedElement, XOrigin) select distinct a.Element, gig.uid_UNSGroupB3Child, a.XOrigin +1 from @QBMDeltaHelper_01 a join UNSGroupB3InUNSGroupB310 gig on a.AssignedElement = gig.uid_UNSGroupB3Parent where Not exists (select top 1 1 from @QBMDeltaHelper_01 e where e.Element = a.Element and e.AssignedElement11 = gig.uid_UNSGroupB3Child ) select @lauf = @@rowcount end insert into @SourceData( IsUpcommingContent, XOriginBefore, XOriginAfter , Element, AssignedElement12 , XIsInEffectBefore, XIsInEffectAfter ) select 1, 0, p.XOrigin , p.Element, p.AssignedElement , 1 , 1 from @QBMDeltaHelper_01 p exec QBM_PDBQueueCalculateDelta13 @SourceData, @DeltaQuantity = 0, @DeltaDelete = 1, @DeltaInsert = 1, @DeltaOrigin = 1, @CountDeltaQantity = @CountDeltaQantity output , @CountDeltaOrigin14 = @CountDeltaOrigin output , @UseIsInEffect = 0 , @SlotNumber = @SlotNumber , @DBQueueCurrentExtern = @DBQueueCurrent if @CountDeltaQantity > 0 begin 15declare @GenProcIDs_CountDeltaQantity QBM_YCursorBuffer insert into @GenProcIDs_CountDeltaQantity (UID1) select de.GenProcID from #QBMDeltaDelete de union16 select de.GenProcID from #QBMDeltaInsert de select @ElementCount = @@ROWCOUNT select @ElementIndex = @@IDENTITY - @ElementCount +1 select @ElementLast17 = @@IDENTITY while @ElementIndex <= @ElementLast begin select top 1 @GenProcID = bu.UID1 from @GenProcIDs_CountDeltaQantity bu where bu.ElementIndex =18 @ElementIndex if exists (select top 1 1 from #QBMDeltaDelete x where x.GenProcID = @GenProcID ) begin exec QBM_PSessionContextSet 'GenProcID', @GenProcID19 delete UNSGroupB3Collection where exists (select top 1 1 from #QBMDeltaDelete d where d.AssignedElement = UNSGroupB3Collection.uid_UNSGroupB3Child20 and d.Element = UNSGroupB3Collection.uid_UNSGroupB3Parent and d.GenProcID = @GenProcID ) end if exists (select top 1 1 from #QBMDeltaInsert x where21 x.GenProcID = @GenProcID ) begin exec QBM_PSessionContextSet 'GenProcID', @GenProcID insert into UNSGroupB3Collection ( UID_UNSGroupB3Parent, UID_UNSGroupB3Child22, LevelNumber , XObjectKey ) select x.uid_UNSGroupB3Parent, x.uid_UNSGroupB3Child, x.LevelNumber - 1 ,dbo.QBM_FCVElementToObjectKey2('UNSGroupB3Collection'23, 'UID_UNSGroupB3Parent', x.UID_UNSGroupB3Parent, 'UID_UNSGroupB3Child', x.UID_UNSGroupB3Child) from ( select Element as uid_UNSGroupB3Parent24, AssignedElement as uid_UNSGroupB3Child, XOrigin as LevelNumber from #QBMDeltaInsert where GenProcID = @GenProcID ) as x join UNSGroupB3 p on p.uid_UNSGroupB325 = x.uid_UNSGroupB3Parent end exec QBM_PDBQueueInsert_Single 'TSB-K-UNSGroupB3InUNSGroupB3-C', '', '', @GenProcID select @ElementIndex += 1 end 26 end if @CountDeltaOrigin > 0 begin declare @GenProcIDs_CountDeltaOrigin QBM_YCursorBuffer insert into @GenProcIDs_CountDeltaOrigin (UID1) select distinct27 de.GenProcID from #QBMDeltaOrigin de select @ElementCount = @@ROWCOUNT select @ElementIndex = @@IDENTITY - @ElementCount +1 select @ElementLast = @@IDENTITY28 while @ElementIndex <= @ElementLast begin select top 1 @GenProcID = bu.UID1 from @GenProcIDs_CountDeltaOrigin bu where bu.ElementIndex = @ElementIndex29 exec QBM_PSessionContextSet 'GenProcID', @GenProcID update UNSGroupB3Collection set Levelnumber = x.LevelNumber - 1 from UNSGroupB3Collection co join30 ( select Element as uid_UNSGroupB3Parent, AssignedElement as uid_UNSGroupB3Child, XOrigin as LevelNumber from #QBMDeltaOrigin where GenProcID = @GenProcID31 ) as x on co.uid_UNSGroupB3Parent = x.uid_UNSGroupB3Parent and co.UID_UNSGroupB3Child = x.UID_UNSGroupB3Child where co.LevelNumber <> x.Levelnumber32 -1 select @ElementIndex += 1 end end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH endLabel: exec33 QBM_PSessionContextSet 'GenProcID', @GenProcID_R return end 34