Back to OIM Explorer

dbo.QER_ZPersonHasObject

Stored ProcedureSQL_STORED_PROCEDURESandbox DB

Stored Procedure.

Source: sandbox-db sys.sql_modules

Source size: 5.580 characters

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.QER_FCVXOriginToInheritInfo source text reference
  • references source dbo.QER_FGIBitPatternInheritInfo source text reference
  • references source dbo.QER_FGIOrgRootName source text reference
  • references source dbo.QBM_PDBQueueCalculateDelta source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference
  • references source dbo.QER_PPersonHasObjectPostProc source text reference

Complete Source

SQL251 lines
1CREATE PROCEDURE QER_ZPersonHasObject(2  @SlotNumber int3)4AS5BEGIN6  DECLARE @Sourcedata QBM_YDataForDelta,7  @CountDeltaQantity int,8  @CountDeltaOrigin int9  DECLARE @DBQueueCurrent QBM_YDBQueueCurrent10  DECLARE @QER_BitPatternInherit_Direct int = dbo.QER_FGIBitPatternInheritInfo('|Direct|',11  0)12  DECLARE @QER_BitPatternInherit_Master int = dbo.QER_FGIBitPatternInheritInfo('|Master|',13  0)14  BEGIN TRY15    INSERT INTO @DBQueueCurrent(UID_DialogDBQueue,16    UID_Parameter,17    UID_SubParameter,18    GenProcID)19    SELECT20      UID_DialogDBQueue,21      UID_Parameter,22      UID_SubParameter,23      GenProcID24    FROM QBMDBQueueCurrent cu25      WITH(readpast)26    WHERE27      cu.SlotNumber = @SlotNumber28    IF @@rowcount = 029    BEGIN30      GOTO EndLabel31    END32    INSERT INTO @SourceData(IsUpcommingContent,33    XOriginAfter,34    Element,35    AssignedElement,36    XOriginBefore)37    SELECT38      0,39      0,40      uid_person,41      ObjectKey,42      InheritInfo43    FROM PersonHasObject pho44    JOIN @DBQueueCurrent x45      ON uid_person = x.uid_parameter CROSS46    JOIN(47    SELECT48      DISTINCT dbo.QER_FGIOrgRootName(r.uid_orgRoot) AS OrgRootName49    FROM OrgRoot r) AS rn50    WHERE51      pho.ObjectKey LIKE '<Key><T>' + rn.OrgRootName + '</T>%'52    INSERT INTO @SourceData(IsUpcommingContent,53    XOriginAfter,54    Element,55    AssignedElement,56    XOriginBefore)57    SELECT58      0,59      0,60      uid_person,61      ObjectKey,62      InheritInfo63    FROM PersonHasObject pho64    JOIN @DBQueueCurrent x65      ON uid_person = x.uid_parameter66    WHERE67      pho.ObjectKey LIKE '<Key><T>QERAssign</T>%' OR pho.ObjectKey LIKE '<Key><T>QERResource</T>%' OR pho.ObjectKey LIKE '<Key><T>QERReuse</T>%' OR68    pho.ObjectKey LIKE '<Key><T>QERReuseUS</T>%'69    INSERT INTO @SourceData(IsUpcommingContent,70    XOriginBefore,71    Element,72    AssignedElement,73    XOriginAfter)74    SELECT75      x.IsUpcommingContent,76      x.XOriginBefore,77      x.Element,78      x.AssignedElement,79      dbo.QER_FCVXOriginToInheritInfo(x.XOrigin)80    FROM(81    SELECT82      1 AS IsUpcommingContent,83      0 AS XOriginBefore,84      y.uid_person AS Element,85      z.XObjectKey AS AssignedElement,86      y.XOrigin87    FROM PersonHasQERAssign y88    JOIN @DBQueueCurrent x89      ON y.uid_person= x.uid_parameter AND y.XOrigin > 0 AND y.XIsInEffect = 190    JOIN QERAssign z91      ON y.uid_QERAssign = z.uid_QERAssign92    UNION all93    SELECT94      1,95      0,96      y.uid_person,97      z.XObjectKey,98      y.XOrigin99    FROM PersonHasQERResource y100    JOIN @DBQueueCurrent x101      ON y.uid_person= x.uid_parameter AND y.XOrigin > 0 AND y.XIsInEffect = 1102    JOIN QERResource z103      ON y.uid_QERResource = z.uid_QERResource104    UNION all105    SELECT106      1,107      0,108      y.uid_person,109      z.XObjectKey,110      y.XOrigin111    FROM PersonHasQERReuse y112    JOIN @DBQueueCurrent x113      ON y.uid_person= x.uid_parameter AND y.XOrigin > 0 AND y.XIsInEffect = 1114    JOIN QERReuse z115      ON y.uid_QERReuse = z.uid_QERReuse116    UNION all117    SELECT118      1,119      0,120      y.uid_person,121      z.XObjectKey,122      y.XOrigin123    FROM PersonHasQERReuseUS y124    JOIN @DBQueueCurrent x125      ON y.uid_person= x.uid_parameter AND y.XOrigin > 0 AND y.XIsInEffect = 1126    JOIN QERReuseUS z127      ON y.uid_QERReuseUS = z.uid_QERReuseUS) AS x128    INSERT INTO @SourceData(IsUpcommingContent,129    XOriginBefore,130    Element,131    AssignedElement,132    XOriginAfter)133    SELECT134      1,135      0,136      y.uid_person,137      q.XObjectKey,138      dbo.QER_FCVXOriginToInheritInfo(y.XOrigin)139    FROM PersonInBaseTree y140    JOIN @DBQueueCurrent x141      ON y.uid_person= x.uid_parameter AND y.XOrigin > 0142    JOIN BaseTree q143      ON y.uid_org = q.uid_org144    WHERE145      q.UID_OrgRoot <> 'QER-V-ITShopOrg'146    INSERT INTO @SourceData(IsUpcommingContent,147    XOriginBefore,148    Element,149    AssignedElement,150    XOriginAfter)151    SELECT152      1,153      0,154      y.uid_person,155      q.XObjectKey,156      dbo.QER_FCVXOriginToInheritInfo(y.XOrigin)157    FROM PersonInBaseTree y158    JOIN @DBQueueCurrent x159      ON y.uid_person= x.uid_parameter AND y.XOrigin > 0160    JOIN BaseTree q161      ON y.uid_org = q.uid_org162    WHERE163      q.UID_OrgRoot = 'QER-V-ITShopOrg' AND q.ITShopInfo <> 'PR'164    INSERT INTO @SourceData(IsUpcommingContent,165    XOriginBefore,166    Element,167    AssignedElement,168    XOriginAfter)169    SELECT170      1,171      0,172      y.uid_person,173      q.XObjectKey,174      @QER_BitPatternInherit_Direct175    FROM HelperPersonOrg y176    JOIN @DBQueueCurrent x177      ON y.uid_person= x.uid_parameter178    JOIN BaseTree q179      ON y.uid_org = q.uid_org180    INSERT INTO @SourceData(IsUpcommingContent,181    XOriginBefore,182    Element,183    AssignedElement,184    XOriginAfter)185    SELECT186      1,187      0,188      m.uid_person,189      pho.objectkey,190      @QER_BitPatternInherit_Master191    FROM @DBQueueCurrent x192    JOIN person m193      WITH(readpast)194      ON m.UID_Person = x.uid_parameter195    JOIN person s196      WITH(readpast)197      ON s.UID_PersonMasterIdentity = m.uid_Person198    JOIN PersonHasObject pho199      WITH(readpast)200      ON pho.uid_person = s.uid_person201    JOIN(202    SELECT203      DISTINCT dbo.QER_FGIOrgRootName(r.uid_orgRoot) AS OrgRootName204    FROM OrgRoot r) AS rn205      ON pho.ObjectKey LIKE '<Key><T>' + rn.OrgRootName + '</T>%' option(force206    ORDER)207    INSERT INTO @SourceData(IsUpcommingContent,208    XOriginBefore,209    Element,210    AssignedElement,211    XOriginAfter)212    SELECT213      1,214      0,215      m.uid_person,216      pho.objectkey,217      @QER_BitPatternInherit_Master218    FROM @DBQueueCurrent x219    JOIN person m220      ON m.UID_Person = x.uid_parameter221    JOIN person s222      ON s.UID_PersonMasterIdentity = m.uid_Person223    JOIN PersonHasObject pho224      ON pho.uid_person = s.uid_person225    WHERE226      pho.ObjectKey LIKE '<Key><T>QERAssign</T>%' OR pho.ObjectKey LIKE '<Key><T>QERResource</T>%' OR pho.ObjectKey LIKE '<Key><T>QERReuse</T>%' OR227    pho.ObjectKey LIKE '<Key><T>QERReuseUS</T>%' berechnen:228    EXEC QBM_PDBQueueCalculateDelta @SourceData,229      @DeltaQuantity = 1,230      @DeltaDelete = 1,231      @DeltaInsert = 1,232      @DeltaOrigin = 1,233      @CountDeltaQantity = @CountDeltaQantity OUTPUT,234      @CountDeltaOrigin = @CountDeltaOrigin OUTPUT,235      @UseIsInEffect = 0,236      @SlotNumber = @SlotNumber,237      @DBQueueCurrentExtern = @DBQueueCurrent238    EXEC QER_PPersonHasObjectPostProc @SlotNumber,239      @CountDeltaOrigin,240      @CountDeltaQantity,241    'QER-K-PersonHasObject'242  END TRY243  BEGIN CATCH244    EXEC QBM_PSessionErrorAdd DEFAULT245    RAISERROR('',246    18,247    1)248      WITH NOWAIT249  END CATCH250  endLabel:251END
Open raw exported source
SQL ยท Raw37 lines
1      create   procedure QER_ZPersonHasObject (@SlotNumber int) AS begin declare @Sourcedata QBM_YDataForDelta , @CountDeltaQantity int , @CountDeltaOrigin2 int declare @DBQueueCurrent QBM_YDBQueueCurrent declare @QER_BitPatternInherit_Direct int = dbo.QER_FGIBitPatternInheritInfo('|Direct|', 0) declare @QER_BitPatternInherit_Master3 int = dbo.QER_FGIBitPatternInheritInfo('|Master|', 0)  BEGIN TRY insert into @DBQueueCurrent(UID_DialogDBQueue, UID_Parameter, UID_SubParameter, GenProcID4) select UID_DialogDBQueue, UID_Parameter, UID_SubParameter, GenProcID from QBMDBQueueCurrent cu with (readpast) where cu.SlotNumber = @SlotNumber if @@rowcount5 = 0 begin goto EndLabel end insert into @SourceData( IsUpcommingContent, XOriginAfter , Element, AssignedElement, XOriginBefore ) select 0, 0 , uid_person6, ObjectKey, InheritInfo from PersonHasObject pho join @DBQueueCurrent x on uid_person = x.uid_parameter cross join (select distinct dbo.QER_FGIOrgRootName7(r.uid_orgRoot) as OrgRootName from OrgRoot r ) as rn where  pho.ObjectKey like '<Key><T>' + rn.OrgRootName + '</T>%' insert into @SourceData( IsUpcommingContent8, XOriginAfter , Element, AssignedElement, XOriginBefore ) select 0, 0 , uid_person, ObjectKey, InheritInfo from PersonHasObject pho join @DBQueueCurrent9 x on uid_person = x.uid_parameter where pho.ObjectKey like '<Key><T>QERAssign</T>%' or pho.ObjectKey like '<Key><T>QERResource</T>%' or pho.ObjectKey 10like '<Key><T>QERReuse</T>%' or pho.ObjectKey like '<Key><T>QERReuseUS</T>%'  insert into @SourceData( IsUpcommingContent, XOriginBefore , Element, AssignedElement11, XOriginAfter ) select x.IsUpcommingContent, x.XOriginBefore, x.Element, x.AssignedElement, dbo.QER_FCVXOriginToInheritInfo(x.XOrigin) from ( select 112 as IsUpcommingContent, 0 as XOriginBefore , y.uid_person as Element, z.XObjectKey as AssignedElement, y.XOrigin from PersonHasQERAssign y join @DBQueueCurrent13 x on y.uid_person= x.uid_parameter and y.XOrigin > 0 and y.XIsInEffect = 1 join QERAssign z on y.uid_QERAssign = z.uid_QERAssign union all select 1, 014 , y.uid_person, z.XObjectKey, y.XOrigin from PersonHasQERResource y join @DBQueueCurrent x on y.uid_person= x.uid_parameter and y.XOrigin > 0 and y.XIsInEffect15 = 1  join QERResource z on y.uid_QERResource = z.uid_QERResource union all select 1, 0 , y.uid_person, z.XObjectKey, y.XOrigin from PersonHasQERReuse 16y join @DBQueueCurrent x on y.uid_person= x.uid_parameter and y.XOrigin > 0 and y.XIsInEffect = 1  join QERReuse z on y.uid_QERReuse = z.uid_QERReuse union17 all select 1, 0 , y.uid_person, z.XObjectKey, y.XOrigin from PersonHasQERReuseUS y join @DBQueueCurrent x on y.uid_person= x.uid_parameter and y.XOrigin18 > 0 and y.XIsInEffect = 1 join QERReuseUS z on y.uid_QERReuseUS = z.uid_QERReuseUS ) as x  insert into @SourceData( IsUpcommingContent, XOriginBefore 19, Element, AssignedElement, XOriginAfter ) select 1, 0 , y.uid_person, q.XObjectKey, dbo.QER_FCVXOriginToInheritInfo(y.XOrigin) from PersonInBaseTree y20 join @DBQueueCurrent x on y.uid_person= x.uid_parameter and y.XOrigin > 0 join BaseTree q on y.uid_org = q.uid_org  where q.UID_OrgRoot <> 'QER-V-ITShopOrg'21 insert into @SourceData( IsUpcommingContent, XOriginBefore , Element, AssignedElement, XOriginAfter ) select 1, 0 , y.uid_person, q.XObjectKey, dbo.QER_FCVXOriginToInheritInfo22(y.XOrigin) from PersonInBaseTree y join @DBQueueCurrent x on y.uid_person= x.uid_parameter and y.XOrigin > 0 join BaseTree q on y.uid_org = q.uid_org 23 where q.UID_OrgRoot = 'QER-V-ITShopOrg' and q.ITShopInfo <> 'PR'  insert into @SourceData( IsUpcommingContent, XOriginBefore , Element, AssignedElement24, XOriginAfter ) select 1, 0 , y.uid_person, q.XObjectKey, @QER_BitPatternInherit_Direct from HelperPersonOrg y join @DBQueueCurrent x on y.uid_person=25 x.uid_parameter join BaseTree q on y.uid_org = q.uid_org   insert into @SourceData( IsUpcommingContent, XOriginBefore , Element, AssignedElement, XOriginAfter26 )  select 1, 0 , m.uid_person, pho.objectkey, @QER_BitPatternInherit_Master FROM @DBQueueCurrent x JOIN person m with (readpast)ON m.UID_Person = x.uid_parameter27 JOIN person s with (readpast) ON s.UID_PersonMasterIdentity = m.uid_Person JOIN PersonHasObject pho with (readpast) ON pho.uid_person = s.uid_person join28 (SELECT DISTINCT dbo.QER_FGIOrgRootName(r.uid_orgRoot) AS OrgRootName FROM OrgRoot r ) AS rn on pho.ObjectKey LIKE '<Key><T>' + rn.OrgRootName + '</T>%'29 option (force order)   insert into @SourceData( IsUpcommingContent, XOriginBefore , Element, AssignedElement, XOriginAfter ) select 1, 0 , m.uid_person30, pho.objectkey, @QER_BitPatternInherit_Master from @DBQueueCurrent x join person m on m.UID_Person = x.uid_parameter  join person s on s.UID_PersonMasterIdentity31 = m.uid_Person join PersonHasObject pho on pho.uid_person = s.uid_person   where pho.ObjectKey like '<Key><T>QERAssign</T>%' or pho.ObjectKey like '<Key><T>QERResource</T>%'32 or pho.ObjectKey like '<Key><T>QERReuse</T>%' or pho.ObjectKey like '<Key><T>QERReuseUS</T>%'   berechnen: exec QBM_PDBQueueCalculateDelta @SourceData33, @DeltaQuantity = 1, @DeltaDelete = 1, @DeltaInsert = 1, @DeltaOrigin = 1, @CountDeltaQantity = @CountDeltaQantity output , @CountDeltaOrigin = @CountDeltaOrigin34 output , @UseIsInEffect = 0 , @SlotNumber = @SlotNumber , @DBQueueCurrentExtern = @DBQueueCurrent exec QER_PPersonHasObjectPostProc @SlotNumber , @CountDeltaOrigin35 , @CountDeltaQantity , 'QER-K-PersonHasObject' END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH endLabel:36 end 37