dbo.QER_ZOrgRoot
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
- Bulk DBQueue insert -> QER-K-AllForOneOrg / QER_ZAllForOneOrg at line 23
- Bulk DBQueue insert -> QER-K-BaseTreeCollectionF / QER_ZBaseTreeCollectionF at line 23
- Bulk DBQueue insert -> QER-K-BaseTreeCollectionF / QER_ZBaseTreeCollectionF at line 24
- References QBM_PDBQueueInsert_Bulk
Typed Edges
- queues DBQueue task QER_ZAllForOneOrg at line 23 Bulk DBQueue insert -> QER-K-AllForOneOrg / QER_ZAllForOneOrg at line 23
- queues DBQueue task QER_ZBaseTreeCollectionF at line 23 Bulk DBQueue insert -> QER-K-BaseTreeCollectionF / QER_ZBaseTreeCollectionF at line 23
- queues DBQueue task QER_ZBaseTreeCollectionF at line 24 Bulk DBQueue insert -> QER-K-BaseTreeCollectionF / QER_ZBaseTreeCollectionF at line 24
- references source dbo.QBM_FCVElementToObjectKey2 source text reference
- references source dbo.QBM_FGIIsSimulationMode source text reference
- references source dbo.QER_FGIOrgRootName source text reference
- references source dbo.QBM_PDBQueueCalculateDelta source text reference
- references source dbo.QBM_PDBQueueInsert_Bulk source text reference
- references source dbo.QBM_PFESimulationFill source text reference
- references source dbo.QBM_PSessionErrorAdd source text reference
- queues DBQueue task QER-K-AllForOneOrg -> QER_ZAllForOneOrg QBM_PDBQueueInsert_Bulk 'QER-K-AllForOneOrg', @DBQueueElements_01 exec QBM_PDBQueueInsert_Bulk 'QER-K-BaseTreeCollectionF', @DBQueueElements_01 end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END…
- queues DBQueue task QER-K-BaseTreeCollectionF -> QER_ZBaseTreeCollectionF QBM_PDBQueueInsert_Bulk 'QER-K-BaseTreeCollectionF', @DBQueueElements_01 end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH ende: truncate table #QBMDeltaDelete return end
References
- dbo.QBM_FCVElementToObjectKey2
- dbo.QBM_FGIIsSimulationMode
- dbo.QER_FGIOrgRootName
- dbo.QBM_PDBQueueCalculateDelta
- dbo.QBM_PDBQueueInsert_Bulk
- dbo.QBM_PFESimulationFill
- dbo.QBM_PSessionErrorAdd
Referenced By
- No direct source references extracted.
Complete Source
1CREATE PROCEDURE QER_ZOrgRoot(2 @SlotNumber int,3 @UID_OrgRoot varchar(38),4 @dummy varchar(38),5 @GenProcID varchar(38)6)7AS8BEGIN9 DECLARE @IsSimulationMode BIT = dbo.QBM_FGIIsSimulationMode()10 DECLARE @QBMDeltaHelper QBM_YDBQueueDeltaHelper11 BEGIN TRY12 DECLARE @topdown BIT13 DECLARE @AnzahlRow int14 DECLARE @Debugswitch int = 015 DECLARE @Sourcedata QBM_YDataForDelta,16 @CountDeltaQantity int,17 @CountDeltaOrigin int18 SELECT @topdown = isTopDown19 FROM orgroot20 WHERE21 uid_orgroot = @UID_OrgRoot22 IF @Debugswitch > 023 BEGIN24 print 'QER_ZOrgRoot : ' + @uid_Orgroot25 END26 INSERT INTO @SourceData(IsUpcommingContent,27 XOriginBefore,28 Element,29 AssignedElement,30 XOriginAfter)31 SELECT32 0,33 2,34 co.UID_Org,35 co.UID_ParentOrg,36 037 FROM BaseTreeCollection co38 WHERE39 co.uid_org IN(40 SELECT uid_org41 FROM BaseTree42 WHERE43 uid_orgroot = @UID_OrgRoot)44 INSERT INTO @QBMDeltaHelper(Element,45 AssignedElement,46 XOrigin)47 SELECT48 uid_org,49 uid_org,50 251 FROM BaseTree52 WHERE53 uid_orgroot = @UID_OrgRoot54 SELECT @AnzahlRow = 155 WHILE @AnzahlRow > 056 BEGIN57 IF @topdown = 158 BEGIN59 INSERT INTO @QBMDeltaHelper(Element,60 AssignedElement,61 XOrigin)62 SELECT63 DISTINCT y.Element,64 x.UId_parentorg,65 266 FROM BaseTree x,67 @QBMDeltaHelper y68 WHERE69 x.uid_orgroot = @UID_OrgRoot AND x.uid_org = y.AssignedElement AND x.uid_parentorg > ' ' AND NOT EXISTS(70 SELECT TOP 1 171 FROM @QBMDeltaHelper h72 WHERE73 h.Element = y.Element AND h.AssignedElement = x.uid_parentorg) AND x.isCutNode = 074 SELECT @AnzahlRow = @@rowcount75 END76 ELSE77 BEGIN78 INSERT INTO @QBMDeltaHelper(Element,79 AssignedElement,80 XOrigin)81 SELECT82 DISTINCT y.Element,83 x.uid_org,84 285 FROM BaseTree x,86 @QBMDeltaHelper y87 WHERE88 x.uid_orgroot = @UID_OrgRoot AND x.uid_parentorg = y.AssignedElement AND NOT EXISTS(89 SELECT TOP 1 190 FROM @QBMDeltaHelper h91 WHERE92 h.Element = y.Element AND h.AssignedElement = x.uid_org) AND x.isCutNode = 093 SELECT @AnzahlRow = @@rowcount94 END95 END96 INSERT INTO @SourceData(IsUpcommingContent,97 XOriginBefore,98 XOriginAfter,99 Element,100 AssignedElement)101 SELECT102 1,103 0,104 2,105 Element,106 AssignedElement107 FROM @QBMDeltaHelper108 IF @Debugswitch > 0109 BEGIN110 SELECT *111 FROM @SourceData112 END113 EXEC QBM_PDBQueueCalculateDelta @SourceData,114 @DeltaQuantity = 1,115 @DeltaDelete = 0,116 @DeltaInsert = 0,117 @DeltaOrigin = 0,118 @CountDeltaQantity = @CountDeltaQantity OUTPUT,119 @CountDeltaOrigin = @CountDeltaOrigin OUTPUT,120 @UseIsInEffect = 0,121 @SlotNumber = @SlotNumber122 IF @Debugswitch > 0123 BEGIN124 print '@CountDeltaQantity ' + str(@CountDeltaQantity)125 END126 IF @CountDeltaQantity > 0127 BEGIN128 DELETE129 FROM BaseTreeCollection130 WHERE131 uid_org IN(132 SELECT uid_org133 FROM BaseTree134 WHERE135 uid_orgroot = @UID_OrgRoot)136 IF @IsSimulationMode = 1137 BEGIN138 DECLARE @SimulationModeBuffer QBM_YTriggerOperation139 INSERT INTO @SimulationModeBuffer(operation,140 BaseObjectType,141 ColumnName,142 Objectkey,143 OldValue)144 SELECT145 'I',146 dbo.QER_FGIOrgRootName(b.uid_orgroot) + 'Collection',147 '',148 dbo.QBM_FCVElementToObjectKey2(dbo.QER_FGIOrgRootName(b.uid_orgroot) + 'Collection',149 'uid_' + dbo.QER_FGIOrgRootName(b.uid_orgroot),150 c.Element,151 'uid_Parent' + dbo.QER_FGIOrgRootName(b.uid_orgroot),152 c.AssignedElement),153 ''154 FROM @QBMDeltaHelper c155 JOIN BaseTree b156 ON c.Element = b.uid_org157 EXEC QBM_PFESimulationFill @SimulationModeBuffer158 END159 INSERT INTO BaseTreeCollection(uid_org,160 uid_parentorg)161 SELECT162 Element,163 AssignedElement164 FROM @QBMDeltaHelper165 DECLARE @DBQueueElements_01 QBM_YDBQueueRaw166 INSERT INTO @DBQueueElements_01(object,167 subobject,168 genprocid)169 SELECT170 x.uid,171 NULL,172 x.GenProcID173 FROM(174 SELECT175 d.Element AS uid,176 @GenProcID AS GenProcID177 FROM #QBMDeltaQuantity d) AS x178 EXEC QBM_PDBQueueInsert_Bulk 'QER-K-AllForOneOrg',179 @DBQueueElements_01180 EXEC QBM_PDBQueueInsert_Bulk 'QER-K-BaseTreeCollectionF',181 @DBQueueElements_01182 END183 END TRY184 BEGIN CATCH185 EXEC QBM_PSessionErrorAdd DEFAULT186 RAISERROR('',187 18,188 1)189 WITH NOWAIT190 END CATCH191 ende: truncate TABLE #QBMDeltaDelete192 RETURN193END
Open raw exported source
1 create procedure QER_ZOrgRoot ( @SlotNumber int , @UID_OrgRoot varchar(38), @dummy varchar(38) , @GenProcID varchar(38) ) AS begin declare2 @IsSimulationMode bit = dbo.QBM_FGIIsSimulationMode() declare @QBMDeltaHelper QBM_YDBQueueDeltaHelper BEGIN TRY declare @topdown bit declare @AnzahlRow3 int declare @Debugswitch int = 0 declare @Sourcedata QBM_YDataForDelta , @CountDeltaQantity int , @CountDeltaOrigin int select @topdown = isTopDown4 from orgroot where uid_orgroot = @UID_OrgRoot if @Debugswitch > 0 begin print 'QER_ZOrgRoot : ' + @uid_Orgroot end insert into @SourceData( IsUpcommingContent5, XOriginBefore , Element, AssignedElement, XOriginAfter ) select 0, 2 , co.UID_Org , co.UID_ParentOrg, 0 from BaseTreeCollection co where co.uid_org in6 (select uid_org from BaseTree where uid_orgroot = @UID_OrgRoot ) insert into @QBMDeltaHelper (Element, AssignedElement, XOrigin) select uid_org, uid_org7 , 2 from BaseTree where uid_orgroot = @UID_OrgRoot select @AnzahlRow = 1 while @AnzahlRow > 0 begin if @topdown = 1 begin insert into @QBMDeltaHelper8 (Element, AssignedElement, XOrigin) select distinct y.Element, x.UId_parentorg , 2 from BaseTree x, @QBMDeltaHelper y where x.uid_orgroot = @UID_OrgRoot9 and x.uid_org = y.AssignedElement and x.uid_parentorg > ' ' and not exists (select top 1 1 from @QBMDeltaHelper h where h.Element = y.Element and h.AssignedElement10 = x.uid_parentorg ) and x.isCutNode = 0 select @AnzahlRow = @@rowcount end else begin insert into @QBMDeltaHelper (Element,AssignedElement, XOrigin)11 select distinct y.Element, x.uid_org , 2 from BaseTree x, @QBMDeltaHelper y where x.uid_orgroot = @UID_OrgRoot and x.uid_parentorg = y.AssignedElement12 and not exists (select top 1 1 from @QBMDeltaHelper h where h.Element = y.Element and h.AssignedElement = x.uid_org ) and x.isCutNode = 0 select @AnzahlRow13 = @@rowcount end end insert into @SourceData( IsUpcommingContent, XOriginBefore, XOriginAfter , Element, AssignedElement ) select 1, 0, 2 , Element,14 AssignedElement from @QBMDeltaHelper if @Debugswitch > 0 begin select * from @SourceData end exec QBM_PDBQueueCalculateDelta @SourceData, @DeltaQuantity15 = 1, @DeltaDelete = 0, @DeltaInsert = 0, @DeltaOrigin = 0, @CountDeltaQantity = @CountDeltaQantity output , @CountDeltaOrigin = @CountDeltaOrigin output16 , @UseIsInEffect = 0 , @SlotNumber = @SlotNumber if @Debugswitch > 0 begin print '@CountDeltaQantity ' + str(@CountDeltaQantity) end if @CountDeltaQantity17 > 0 begin delete from BaseTreeCollection where uid_org in (select uid_org from BaseTree where uid_orgroot = @UID_OrgRoot ) if @IsSimulationMode = 118 begin declare @SimulationModeBuffer QBM_YTriggerOperation insert into @SimulationModeBuffer (operation, BaseObjectType, ColumnName, Objectkey, OldValue19) select 'I', dbo.QER_FGIOrgRootName(b.uid_orgroot)+ 'Collection', '', dbo.QBM_FCVElementToObjectKey2(dbo.QER_FGIOrgRootName(b.uid_orgroot)+ 'Collection'20, 'uid_' + dbo.QER_FGIOrgRootName(b.uid_orgroot), c.Element, 'uid_Parent' + dbo.QER_FGIOrgRootName(b.uid_orgroot), c.AssignedElement) , '' from @QBMDeltaHelper21 c join BaseTree b on c.Element = b.uid_org exec QBM_PFESimulationFill @SimulationModeBuffer end insert into BaseTreeCollection (uid_org, uid_parentorg22) select Element, AssignedElement from @QBMDeltaHelper declare @DBQueueElements_01 QBM_YDBQueueRaw insert into @DBQueueElements_01 (object, subobject, 23genprocid) select x.uid, null, x.GenProcID from ( select d.Element as uid, @GenProcID as GenProcID from #QBMDeltaQuantity d ) as x exec QBM_PDBQueueInsert_Bulk24 'QER-K-AllForOneOrg', @DBQueueElements_01 exec QBM_PDBQueueInsert_Bulk 'QER-K-BaseTreeCollectionF', @DBQueueElements_01 end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd25 default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH ende: truncate table #QBMDeltaDelete return end 26