dbo.QER_ZOrgInherite
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 -> QER-K-OrgROOT / QER_ZOrgRoot at line 16
- Bulk DBQueue insert -> QER-K-OrgSubTree / QER_ZOrgSubTree at line 16
- Bulk DBQueue insert -> QER-K-OrgSubTree / QER_ZOrgSubTree at line 19
- References QBM_PDBQueueInsert_Single
- References QBM_PDBQueueInsert_Bulk
Typed Edges
- queues DBQueue task QER_ZOrgRoot at line 16 single DBQueue insert -> QER-K-OrgROOT / QER_ZOrgRoot at line 16
- queues DBQueue task QER_ZOrgSubTree at line 16 Bulk DBQueue insert -> QER-K-OrgSubTree / QER_ZOrgSubTree at line 16
- queues DBQueue task QER_ZOrgSubTree at line 19 Bulk DBQueue insert -> QER-K-OrgSubTree / QER_ZOrgSubTree at line 19
- references source dbo.QBM_PDBQueueInsert_Bulk source text reference
- references source dbo.QBM_PDBQueueInsert_Single source text reference
- references source dbo.QBM_PSessionErrorAdd source text reference
- queues DBQueue task QER-K-OrgROOT -> QER_ZOrgRoot QBM_PDBQueueInsert_single 'QER-K-OrgROOT', @uid_OrgRoot, null, @GenProcID end else begin declare @DBQueueElements_01 QBM_YDBQueueRaw insert into @DBQueueElements_01 (object, subobject, genprocid) select x.uid, null, x.GenProcID from ( sele…
- queues DBQueue task QER-K-OrgSubTree -> QER_ZOrgSubTree QBM_PDBQueueInsert_Bulk 'QER-K-OrgSubTree', @DBQueueElements_01 end select @ElementIndex += 1 end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH endLabel: end
References
Referenced By
- No direct source references extracted.
Complete Source
1CREATE PROCEDURE QER_ZOrgInherite(2 @SlotNumber int3)4AS5BEGIN6 DECLARE @CurrentBulkRoot int7 DECLARE @CurrentBulkSubTree int8 DECLARE @uid_orgroot varchar(38)9 DECLARE @CountItems int10 DECLARE @CountOfSubtree int11 DECLARE @IsTopDown BIT12 DECLARE @RootRechnen int13 DECLARE @GenProcID varchar(38)14 DECLARE @ElementBuffer QBM_YCursorBuffer15 DECLARE @ElementCount int16 DECLARE @ElementIndex int17 DECLARE @DBQueueCurrent QBM_YDBQueueCurrent18 BEGIN TRY19 INSERT INTO @DBQueueCurrent(UID_DialogDBQueue,20 UID_Parameter,21 UID_SubParameter,22 GenProcID)23 SELECT24 UID_DialogDBQueue,25 UID_Parameter,26 UID_SubParameter,27 GenProcID28 FROM QBMDBQueueCurrent cu29 WITH(readpast)30 WHERE31 cu.SlotNumber = @SlotNumber32 IF @@rowcount = 033 BEGIN34 GOTO EndLabel35 END36 SELECT @CurrentBulkRoot = m.CurrentBulk37 FROM QBMDBQueueTaskMetric m38 WITH(readpast)39 WHERE40 UID_Task = 'QER-K-OrgROOT'41 SELECT @CurrentBulkSubTree = m.CurrentBulk42 FROM QBMDBQueueTaskMetric m43 WITH(readpast)44 WHERE45 UID_Task = 'QER-K-OrgSubTree'46 INSERT INTO @ElementBuffer(UID1,47 Int1,48 Bit1,49 UID2)50 SELECT51 b.uid_orgroot,52 count(*) AS CountItems,53 r.isTopdown,54 max(p.Genprocid)55 FROM @DBQueueCurrent p56 JOIN BaseTree b57 ON p.uid_parameter = b.uid_org58 JOIN Orgroot r59 ON r.uid_orgroot = b.uid_orgroot60 GROUP BY b.uid_orgroot,61 r.istopdown62 SELECT @ElementCount = @@ROWCOUNT63 SELECT @ElementIndex = 164 WHILE @ElementIndex <= @ElementCount65 BEGIN66 SELECT67 TOP 1 @uid_OrgRoot = bu.UID1,68 @CountItems = bu.Int1,69 @IsTopDown = bu.Bit1,70 @GenprocID = bu.UID271 FROM @ElementBuffer bu72 WHERE73 bu.ElementIndex = @ElementIndex74 SELECT @RootRechnen = 075 IF EXISTS(76 SELECT TOP 1 177 FROM DialogDBQueue q78 WITH(nolock)79 WHERE80 q.UID_Task = 'QER-K-OrgROOT' AND q.Object = @uid_OrgRoot AND q.Generation >= 0)81 BEGIN82 SELECT @RootRechnen = 183 GOTO einstellen84 END85 IF @IsTopDown = 086 BEGIN87 SELECT @RootRechnen = 188 GOTO einstellen89 END90 SELECT @CountOfSubtree = count(*)91 FROM dialogdbqueue q92 WITH(nolock)93 JOIN BaseTree bq94 ON q.object = bq.uid_org AND q.UID_Task = 'QER-K-OrgSubTree' AND bq.uid_Orgroot = @uid_orgroot95 WHERE96 q.Generation >= 097 IF @CountItems + @CountOfSubtree < 4598 BEGIN99 GOTO einstellen100 END101 ELSE102 BEGIN103 IF @CurrentBulkRoot < 2104 BEGIN105 SELECT @RootRechnen = 1106 GOTO einstellen107 END108 IF @CountOfSubtree > @CurrentBulkSubTree109 BEGIN110 SELECT @RootRechnen = 1111 GOTO einstellen112 END113 ELSE114 BEGIN115 SELECT @RootRechnen = 0116 GOTO einstellen117 END118 END119 einstellen:120 IF @RootRechnen = 1121 BEGIN122 EXEC QBM_PDBQueueInsert_single 'QER-K-OrgROOT',123 @uid_OrgRoot,124 NULL,125 @GenProcID126 END127 ELSE128 BEGIN129 DECLARE @DBQueueElements_01 QBM_YDBQueueRaw130 INSERT INTO @DBQueueElements_01(object,131 subobject,132 genprocid)133 SELECT134 x.uid,135 NULL,136 x.GenProcID137 FROM(138 SELECT139 DISTINCT p.uid_Parameter AS uid,140 p.GenProcID141 FROM @DBQueueCurrent p142 JOIN BaseTree b143 ON p.uid_parameter = b.uid_org144 WHERE145 b.uid_OrgRoot = @uid_OrgRoot) AS x146 EXEC QBM_PDBQueueInsert_Bulk 'QER-K-OrgSubTree',147 @DBQueueElements_01148 END149 SELECT @ElementIndex += 1150 END151 END TRY152 BEGIN CATCH153 EXEC QBM_PSessionErrorAdd DEFAULT154 RAISERROR('',155 18,156 1)157 WITH NOWAIT158 END CATCH159 endLabel:160END
Open raw exported source
1 create procedure QER_ZOrgInherite (@SlotNumber int) AS begin declare @CurrentBulkRoot int declare @CurrentBulkSubTree int declare @uid_orgroot2 varchar(38) declare @CountItems int declare @CountOfSubtree int declare @IsTopDown bit declare @RootRechnen int declare @GenProcID varchar(38) declare3 @ElementBuffer QBM_YCursorBuffer declare @ElementCount int declare @ElementIndex int declare @DBQueueCurrent QBM_YDBQueueCurrent BEGIN TRY insert into4 @DBQueueCurrent(UID_DialogDBQueue, UID_Parameter, UID_SubParameter, GenProcID) select UID_DialogDBQueue, UID_Parameter, UID_SubParameter, GenProcID from5 QBMDBQueueCurrent cu with (readpast) where cu.SlotNumber = @SlotNumber if @@rowcount = 0 begin goto EndLabel end select @CurrentBulkRoot = m.CurrentBulk6 from QBMDBQueueTaskMetric m with (readpast) where UID_Task = 'QER-K-OrgROOT' select @CurrentBulkSubTree = m.CurrentBulk from QBMDBQueueTaskMetric m with7 (readpast) where UID_Task = 'QER-K-OrgSubTree' insert into @ElementBuffer (UID1 , Int1 , Bit1 , UID2 ) select b.uid_orgroot, count(*) as CountItems8 , r.isTopdown, max(p.Genprocid) from @DBQueueCurrent p join BaseTree b on p.uid_parameter = b.uid_org join Orgroot r on r.uid_orgroot = b.uid_orgroot 9group by b.uid_orgroot, r.istopdown select @ElementCount = @@ROWCOUNT select @ElementIndex = 1 while @ElementIndex <= @ElementCount begin select top 1 10@uid_OrgRoot = bu.UID1 , @CountItems = bu.Int1 , @IsTopDown = bu.Bit1 , @GenprocID = bu.UID2 from @ElementBuffer bu where bu.ElementIndex = @ElementIndex11 select @RootRechnen = 0 if exists (select top 1 1 from DialogDBQueue q with (nolock) where q.UID_Task = 'QER-K-OrgROOT' and q.Object = @uid_OrgRoot 12 and q.Generation >= 0 ) begin select @RootRechnen = 1 goto einstellen end if @IsTopDown = 0 begin select @RootRechnen = 1 goto einstellen end select13 @CountOfSubtree = count(*) from dialogdbqueue q with (nolock) join BaseTree bq on q.object = bq.uid_org and q.UID_Task = 'QER-K-OrgSubTree' and bq.uid_Orgroot14 = @uid_orgroot where q.Generation >= 0 if @CountItems + @CountOfSubtree < 45 begin goto einstellen end else begin if @CurrentBulkRoot < 2 begin 15select @RootRechnen = 1 goto einstellen end if @CountOfSubtree > @CurrentBulkSubTree begin select @RootRechnen = 1 goto einstellen end else begin select16 @RootRechnen = 0 goto einstellen end end einstellen: if @RootRechnen = 1 begin exec QBM_PDBQueueInsert_single 'QER-K-OrgROOT', @uid_OrgRoot, null, @GenProcID17 end else begin declare @DBQueueElements_01 QBM_YDBQueueRaw insert into @DBQueueElements_01 (object, subobject, genprocid) select x.uid, null, x.GenProcID18 from ( select distinct p.uid_Parameter as uid , p.GenProcID from @DBQueueCurrent p join BaseTree b on p.uid_parameter = b.uid_org where b.uid_OrgRoot 19= @uid_OrgRoot ) as x exec QBM_PDBQueueInsert_Bulk 'QER-K-OrgSubTree', @DBQueueElements_01 end select @ElementIndex += 1 end END TRY BEGIN CATCH exec 20QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH endLabel: end 21