dbo.QBM_PDBQCS_CurrentRestore

SQL_STORED_PROCEDURE

Created 2025-06-27T17:57:37.390 · modified 2026-04-14T23:16:09.083 · source: live DB sys.objects/sys.sql_expression_dependencies.

Open formatted source/search result

Parameters

NameTypeOutput
@ExecutionTypeintno
@IgnoreGenerationbitno
@UID_TaskPatternvarcharno
@RowsMovedintyes

Referenced objects

SchemaObjectColumn/minorClass
DialogDatabaseOBJECT_OR_COLUMN
DialogDBQueueOBJECT_OR_COLUMN
QBM_PDBQCS_CurrentMoveSlotOBJECT_OR_COLUMN
QBM_PDBQueueInsert_SingleOBJECT_OR_COLUMN
QBM_PJournalOBJECT_OR_COLUMN
QBM_PSessionContextSetOBJECT_OR_COLUMN
QBM_PSessionErrorAddOBJECT_OR_COLUMN
QBM_PTransactionLevelCheckOBJECT_OR_COLUMN
QBM_PWaitForSecondsOBJECT_OR_COLUMN
QBM_YCursorBufferTYPE
QBM_YDBQCSCurrentToMoveTYPE
QBM_YHelperQueueRepairTYPE
QBM_YSingleGUIDTYPE
QBMDBQueueCurrentOBJECT_OR_COLUMN
QBMDBQueueTaskMetricOBJECT_OR_COLUMN
dboQBM_FGIDBQueueCurrRestoreAbleOBJECT_OR_COLUMN
dboQBM_FGISessionContextOBJECT_OR_COLUMN
dboQBM_FGISessionErrorIsDeadlockOBJECT_OR_COLUMN
dboQBM_FGIsessionErrorIsMissingCOOBJECT_OR_COLUMN
dboQBM_FGISessionErrorRethrowOBJECT_OR_COLUMN
dboQBM_FGITableCountAllOBJECT_OR_COLUMN

Source excerpt

First extracted SQL definition lines from the exported source. Use the full source page for complete context.

Open full formatted source

1        create   procedure QBM_PDBQCS_CurrentRestore ( @ExecutionType int ,@IgnoreGeneration bit = 0 , @UID_TaskPattern varchar(38) = '%'  , @RowsMoved
2 int = 0 output ) as begin declare @Trans int declare @UID_TaskToMatch varchar(38) declare @GenProcID varchar(38) = newid() declare @PathLength int declare
3 @DebugStarttime datetime = getutcdate() declare @DebugLevel char(1) = 'I' declare @DebugMessage nvarchar(4000) declare @DebugSwitch int = 0 declare @warFehler
4 int declare @SecondsToAdd int declare @einRuck int = 1000 declare @AktuelleEintraege QBM_YHelperQueueRepair declare @UID_TaskAutomatedFollower varchar
5(38) declare @UID_TaskAutomatedPredecessor varchar(38) select @RowsMoved = 0 declare @DBQueueToMove QBM_YDBQCSCurrentToMove declare @RowsMovedDelete int
6 declare @RestoreToGeneration0 int = -500 declare @GenProcID_R varchar(38) = dbo.QBM_FGISessionContext('') declare @XUser_R nvarchar(64) = dbo.QBM_FGISessionContext
7('XUser') declare @validTasks QBM_YCursorBuffer declare @ElementCount int ,@ElementIndex int declare @UIDDBQueueMerken QBM_YSingleGUID  declare @rows int
8 declare @InMigration bit = 0 SET XACT_ABORT OFF BEGIN TRY select @Trans = @@TRANCOUNT set nocount on if @IgnoreGeneration = 1 begin update QBMDBQueueCurrent
9 set SlotNumber = -1 where SlotNumber > 0 select @rows = @@rowcount if @rows > 0 begin select @DebugMessage = 'set Current Slotnumber = -1: ' + str(@rows
10) exec QBM_PJournal @DebugMessage, @@PROCID, 'T', @DebugLevel end  end  insert into @validTasks(UID1) select x.UID_Task from ( select mo.UID_Task, mo.PathLength
11 from QBMDBQueueCurrent cu with (readpast, forceSeek) join QBMDBQueueTaskMetric mo with (readpast) on cu.UID_Task = mo.UID_Task where cu.SlotNumber < 0
12 and cu.UID_Task like @UID_TaskPattern group by mo.UID_Task, mo.PathLength ) as x order by x.PathLength select @ElementCount = @@ROWCOUNT if @ElementCount
13 = 0 begin if @DebugSwitch > 0 begin print 'definitiv nix gefunden' end goto endLabel end if exists (select top 1 1 from DialogDatabase d with (readpast
14) where d.UpdatePhase > 0 ) begin select @InMigration = 1 end if dbo.QBM_FGITableCountAll('QBMDBQueueCurrent') = 0 begin if @DebugSwitch > 0 begin print
15 'QBMDBQueueCurrent is leer' end goto endLabel end if @ExecutionType <= 997 begin  exec QBM_PTransactionLevelCheck 0, @@procid, 'entry'  end exec QBM_PSessionContextSet
16 'XUser', 'QBM_PDBQueueInsert_Bulk'   select @ElementIndex = 1 while @ElementIndex <= @ElementCount begin select top 1 @UID_TaskToMatch = v.UID1 from @validTasks
17 v where v.ElementIndex = @ElementIndex  select top 1 @SecondsToAdd = case when @InMigration = 1 then 0 when mo.CountInDBQueue is null then 0 when mo.CountInDBQueue
18 < 20000 then 0 else mo.CountInDBQueue / 1000 end  + case when @InMigration = 1 then 0 else isnull(mo.RestoreDelay, 0) end , @UID_TaskAutomatedPredecessor
19 = mo.UID_TaskAutomatedPredecessor , @UID_TaskAutomatedFollower = mo.UID_TaskAutomatedFollower , @PathLength = mo.PathLength from QBMDBQueueTaskMetric 
20mo with (readpast) where mo.UID_Task = @UID_TaskToMatch delete @UIDDBQueueMerken insert into @UIDDBQueueMerken(UID_SingleGuid) select cu.UID_DialogDBQueue
21 from QBMDBQueueCurrent cu with (readpast) where (cu.SlotNumber < 0 and cu.UID_Task = @UID_TaskToMatch ) and (dbo.QBM_FGIDBQueueCurrRestoreAble(cu.Generation
22, cu.StartedAt, @SecondsToAdd)= 1 or @IgnoreGeneration = 1 or cu.SlotNumber <= @RestoreToGeneration0 or @InMigration = 1 ) if @@ROWCOUNT = 0 begin goto
23 zyklusende end if @UID_TaskAutomatedFollower > ' ' begin exec QBM_PDBQueueInsert_Single @UID_TaskAutomatedFollower, '', '', @GenProcID end if @UID_TaskAutomatedPredecessor
24 > ' ' begin exec QBM_PDBQueueInsert_Single @UID_TaskAutomatedPredecessor, '', '', @GenProcID end   set lock_timeout 800 begin transaction   BEGIN TRY 
25 select @warFehler = 0   delete  @AktuelleEintraege  insert into @AktuelleEintraege (UID_DialogDBQueue, Object, SubObject , Generation, GenProcID, PathLength
26, UID_Task) select top (@einRuck) cu.UID_DialogDBQueue, isnull(cu.UID_Parameter, ''), isnull(cu.UID_SubParameter, '') , case  when cu.SlotNumber <= @RestoreToGeneration0
27 then -1 else cu.Generation end , cu.GenProcID, @PathLength, cu.UID_Task from @UIDDBQueueMerken me join QBMDBQueueCurrent cu with (readpast, forceseek)
28 on me.UID_SingleGuid = cu.UID_DialogDBQueue  merge into DialogDBQueue as t using @AktuelleEintraege as s on t.UID_DialogDBQueue = s.UID_DialogDBQueue 
29and t.Generation >= 0 when matched then update set t.generation = s.Generation + 1 when not matched by target then insert (UID_DialogDBQueue, Object, SubObject
30 , Generation , GenProcID , PathLength, UID_Task ) values (convert(varchar(38), newid()) , case when s.Object = '' then null else s.Object end , case when
31 s.SubObject = '' then null else s.SubObject end , s.Generation +1 , case when len(isnull(s.GenProcID, '') ) < 36 then convert(varchar(38), newid()) else
32 s.GenProcID end , s.PathLength, s.UID_Task ) ; delete @DBQueueToMove  insert into @DBQueueToMove(UID_DialogDBQueue) select cul.UID_DialogDBQueue from 
33@AktuelleEintraege cul exec @RowsMovedDelete = QBM_PDBQCS_CurrentMoveSlot @DBQueueToMove , @SlotNumberSource = -1  , @SlotnumberTarget = 0 select @RowsMoved
34 += @RowsMovedDelete END TRY BEGIN CATCH select @warFehler = -1  exec QBM_PSessionErrorAdd default if dbo.QBM_FGISessionErrorIsDeadlock(default) = 1 begin
35 select @warFehler = 1  end END CATCH if @warFehler = 0 begin commit transaction end else begin rollback if @warFehler = 1 begin exec QBM_PWaitForSeconds
36 0.05 end else begin raiserror ('', 18, 1) with nowait end end  set lock_timeout -1 if @warFehler = 0 begin select @DebugMessage = 'restore from Current '
37 + @UID_TaskToMatch exec QBM_PJournal @DebugMessage, @@PROCID, 'T', @DebugLevel end zyklusende: select @ElementIndex += 1 end  exec QBM_PSessionContextSet
38'XUser', '' exec QBM_PTransactionLevelCheck @trans, @@procid, 'exit' END TRY BEGIN CATCH  set lock_timeout -1 exec QBM_PSessionErrorAdd default if dbo.QBM_FGIsessionErrorIsMissingCO
39(default)= 0 begin rollback transaction declare @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow() RAISERROR (@Rethrow, 18, 1) WITH NOWAIT end END
40 CATCH endLabel:  exec QBM_PJournal @Debugstarttime, @@procid, 'T', @Debuglevel exec QBM_PSessionContextSet 'GenProcID', @GenProcID_R exec QBM_PSessionContextSet
41 'XUser', @XUser_R return end 
42

Module relation graph

Loading module relation graph…

Source-derived context

Generated from exported SQL module definitions plus read-only sandbox sys.objects/sys.parameters/sys.sql_expression_dependencies metadata. This is factual source evidence, not a semantic guess.

provenance: SQL definition export provenance: sandbox DB metadata modified: 2026-04-14T23:16:09.083

inserts DBQueue tasks uses session context values has TRY/CATCH error handling

Summary: calls QBM_PJournal, QBM_PTransactionLevelCheck, QBM_PSessionContextSet, QBM_PDBQueueInsert_Single, QBM_PDBQCS_CurrentMoveSlot…; writes INSERT into, UPDATE QBMDBQueueCurrent; reads/joins QBMDBQueueCurrent, QBMDBQueueTaskMetric, DialogDatabase, Current; uses session context XUser, GenProcID

Declared parameters

ParameterTypeDirection
@ExecutionTypeintinput
@IgnoreGenerationbitinput
@UID_TaskPatternvarchar(38)input
@RowsMovedintOUTPUT

DML targets

INSERT into UPDATE QBMDBQueueCurrent

Config/session

Config: None extracted.

Session: XUser GenProcID

DBQueue/tasks

select @ElementIndex = 1 while @ElementIndex <= @ElementCount begin select top 1 @UID_TaskToMatch = v.UID1 from @validTasks v where v.ElementIndex = @ElementIndex select top 1 @SecondsToAdd = case when @InMigration = 1 then 0 when mo.CountInDBQueue is null then 0 when mo.CountInDBQueue < 20000 then 0 else mo.CountInDBQueue / 1000 end + case when @InMigration = 1 then 0 else isnull(mo.RestoreDelay, 0) end , @UID_TaskAutomatedPredecessor = mo.UID_TaskAutomatedPredecessor , @UID_TaskAutomatedFollower = mo.UID_TaskAutomatedFollower , @PathLength = mo.PathLength from QBMDBQueueTaskMetric mo with (readpast) where mo.UID_Task = @UID_TaskToMatch delete @UIDDBQueueMerken insert into @UIDDBQueueMerken(UID_SingleGuid) select cu.UID_DialogDBQueue from QBMDBQueueCurrent cu with (readpast) where (cu.SlotNumber < 0 and cu.UID_Task = @UID_TaskToMatch ) and (dbo.QBM_FGIDBQueueCurrRestoreAble(cu.Generation , cu.StartedAt, @SecondsToAdd)= 1 or @IgnoreGeneration = 1 or cu.SlotNumber <= @RestoreToGeneration0 or @InMigration = 1 ) if @@ROWCOUNT = 0 begin goto zyklusende end if @UID_TaskAutomatedFollower >

Temp tables / referenced variables

Temp: None extracted.

Variables: @ExecutionType @IgnoreGeneration @UID_TaskPattern @RowsMoved @Trans @UID_TaskToMatch @GenProcID @PathLength @DebugStarttime @DebugLevel @DebugMessage @DebugSwitch @warFehler @SecondsToAdd @einRuck @AktuelleEintraege @UID_TaskAutomatedFollower @UID_TaskAutomatedPredecessor @DBQueueToMove @RowsMovedDelete @RestoreToGeneration0 @GenProcID_R @XUser_R @validTasks @ElementCount @ElementIndex @UIDDBQueueMerken @rows @InMigration @TRANCOUNT @rowcount @PROCID @ROWCOUNT @procid @SlotNumberSource @SlotnumberTarget @trans @Rethrow @Debugstarttime @Debuglevel

Referenced by / reverse dependencies

Generated from live DB metadata, FK rows, and exported SQL dependency/source extraction. This is factual linkage evidence, not inferred behavior.

Referencing objectRelationEvidence
dbo.QBM_ZBufferTProcessDeleteSQL expression dependencyOBJECT_OR_COLUMN
dbo.QBM_ZBufferTProcessDeletesource text referenceinserts DBQueue tasks, has TRY/CATCH error handling