dbo.QBM_PBufferC_ProcessOneColumn
Stored ProcedureSQL_STORED_PROCEDURESandbox DB
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.QBM_FCVStringToIndent source text reference
- references source dbo.QBM_FGIColumnExists source text reference
- references source dbo.QBM_FGIColumnExistsInSchema source text reference
- references source dbo.QBM_FGISessionErrorRethrow source text reference
- references source dbo.QBM_FSQCVBufferToColumn source text reference
- references source dbo.QBM_FSQFunctionCallModuleOwner source text reference
- references source dbo.QBM_FSQIsNullClauseCmp source text reference
- references source dbo.QBM_PSessionErrorAdd source text reference
Complete Source
1CREATE PROCEDURE QBM_PBufferC_ProcessOneColumn(2 @TableName varchar(30),3 @columnname varchar(30),4 @ModuleOwner varchar(3)5)6AS7BEGIN8 DECLARE @DebugSwitch int = 09 DECLARE @cmd nvarchar(max)10 DECLARE @xclause nvarchar(1000)11 DECLARE @IsPKMember BIT12 DECLARE @IsCustomConfigurable BIT13 DECLARE @XUser nvarchar(64) = object_name(@@procid)14 DECLARE @Xdate datetime = getutcdate()15 SET XACT_ABORT OFF16 BEGIN TRY17 SELECT18 TOP 1 @IsCustomConfigurable = IsCustomConfigurable,19 @IsPKMember = IsPKMember20 FROM DialogColumn c21 JOIN DialogTable t22 WITH(readpast)23 ON c.UID_DialogTable = t.UID_DialogTable24 WHERE25 t.TableName = @TableName AND c.ColumnName = @columnname26 IF @IsPKMember = 1 OR @columnname IN('XObjectKey',27 'XUserInserted',28 'XUserUpdated',29 'Xdateinserted',30 'Xdateupdated',31 'XTouched')32 BEGIN33 UPDATE QBMBufferConfig34 SET xtouched = 'D',35 XDateUpdated = @Xdate,36 XUserUpdated = @XUser37 WHERE38 TableName = @TableName AND ColumnName = @columnname AND xtouched = 'O'39 GOTO nachbearbeitung40 END41 IF dbo.QBM_FGIColumnExistsInSchema(@TableName,42 'XDateupdated') = 1 AND @columnname NOT LIKE 'X[d,u][a,s][t,e][e,r]updated'43 BEGIN44 SELECT45 @xclause = ', XUserupdated = ''' + @xuser + ''' , xdateupdated = getutcdate()'46 END47 ELSE48 BEGIN49 SELECT @xclause = '--'50 END51 SELECT52 @cmd = CONCAT('53 updat',54 'e @TableName @55 set @columnname@ = 56@ContentClause@57 @Xclause@58 from @TableName @ x join QBMBufferConfig y on x.XObjectKey = y.ObjectKeyOfRow59 and y.TableName = ''@TableName @''60 and y.columnname = ''@columnname@''61 where @IsnullClause@ <> 62@ContentNull@63 and ( ( ''CCC'' = ''@ModuleOwner@''64 and '65 + str(@IsCustomConfigurable) + ' = 0 66 )67 or68 ( ''CCC'' <> ''@ModuleOwner@''69 and ' + dbo.QBM_FSQFunctionCallModuleOwner(@TableName70 , 'x') + ' <> ''@ModuleOwner@''71 ) 72 )73 74 ')75 SELECT76 @cmd = REPLACE(@cmd,77 '@IsnullClause@',78 dbo.QBM_FSQIsNullClauseCmp(@TableName, @columnname, N 'x'))79 SELECT80 @cmd = REPLACE(@cmd,81 '@ContentClause@',82 dbo.QBM_FCVStringToIndent(dbo.QBM_FSQCVBufferToColumn(@TableName, @columnname, N 'y', 0), 7))83 SELECT84 @cmd = REPLACE(@cmd,85 '@ContentNull@',86 dbo.QBM_FCVStringToIndent(dbo.QBM_FSQCVBufferToColumn(@TableName, @columnname, N 'y', 1), 7))87 SELECT88 @cmd = REPLACE(@cmd,89 '@Xclause@',90 @Xclause)91 SELECT92 @cmd = replace(REPLACE(@cmd, '@TableName @', @TableName),93 '@columnname@',94 @columnname)95 SELECT96 @cmd = REPLACE(@cmd,97 '@ModuleOwner@',98 @ModuleOwner)99 IF @DebugSwitch > 0100 BEGIN101 print @cmd print 'go'102 END103 nachbearbeitung:104 SELECT105 @cmd = '106 delete QBMBufferConfig107 from QBMBufferConfig y join @TableName @ x on y.XObjectKey = x.XObjectKey108 where y.TableName = ''@TableName @''109 and y.ColumnName = ''@columnname@''110 and @IsnullClause@ = 111@ContentClause@ 112 '113 SELECT114 @cmd = REPLACE(@cmd,115 '@IsnullClause@',116 dbo.QBM_FSQIsNullClauseCmp(@TableName, @columnname, N 'x'))117 SELECT118 @cmd = REPLACE(@cmd,119 '@ContentClause@',120 dbo.QBM_FCVStringToIndent(dbo.QBM_FSQcvBufferToColumn(@TableName, @columnname, N 'y', 1), 7))121 SELECT122 @cmd = replace(REPLACE(@cmd, '@TableName @', @TableName),123 '@columnname@',124 @columnname)125 IF @DebugSwitch > 0126 BEGIN127 print @cmd print 'go'128 END129 END TRY130 BEGIN CATCH131 EXEC QBM_PSessionErrorAdd DEFAULT132 DECLARE @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow()133 RAISERROR(@Rethrow,134 18,135 1)136 WITH NOWAIT137 END CATCH138 ende:139END
Open raw exported source
1 create procedure QBM_PBufferC_ProcessOneColumn ( @TableName varchar(30) , @columnname varchar(30) , @ModuleOwner varchar(3) ) as begin 2declare @DebugSwitch int = 0 declare @cmd nvarchar(max) declare @xclause nvarchar(1000) declare @IsPKMember bit declare @IsCustomConfigurable bit declare3 @XUser nvarchar(64) = object_name(@@procid) declare @Xdate datetime = getutcdate() SET XACT_ABORT OFF BEGIN TRY select top 1 @IsCustomConfigurable =4 IsCustomConfigurable , @IsPKMember = IsPKMember from DialogColumn c join DialogTable t with (readpast) on c.UID_DialogTable = t.UID_DialogTable where 5t.TableName = @TableName and c.ColumnName = @columnname if @IsPKMember = 1 or @columnname in ('XObjectKey', 'XUserInserted', 'XUserUpdated', 'Xdateinserted'6, 'Xdateupdated', 'XTouched') begin update QBMBufferConfig set xtouched = 'D' , XDateUpdated = @Xdate , XUserUpdated = @XUser where TableName = @TableName7 and ColumnName = @columnname and xtouched = 'O' goto nachbearbeitung end if dbo.QBM_FGIColumnExistsInSchema(@TableName , 'XDateupdated') = 1 and @columnname8 not like 'X[d,u][a,s][t,e][e,r]updated' begin select @xclause = ', XUserupdated = ''' + @xuser + ''' , xdateupdated = getutcdate()' end else begin select9 @xclause = '--' end select @cmd = concat('10 updat','e @TableName @11 set @columnname@ = 12@ContentClause@13 @Xclause@14 from @TableName @ x join QBMBufferConfig y on x.XObjectKey = y.ObjectKeyOfRow15 and y.TableName = ''@TableName @''16 and y.columnname = ''@columnname@''17 where @IsnullClause@ <> 18@ContentNull@19 and ( ( ''CCC'' = ''@ModuleOwner@''20 and '21 + str(@IsCustomConfigurable) + ' = 0 22 )23 or24 ( ''CCC'' <> ''@ModuleOwner@''25 and ' + dbo.QBM_FSQFunctionCallModuleOwner(@TableName, 'x'26) + ' <> ''@ModuleOwner@''27 ) 28 )29 30 ') select @cmd = REPLACE(@cmd, '@IsnullClause@', dbo.QBM_FSQIsNullClauseCmp(@TableName , @columnname31, N'x')) select @cmd = REPLACE(@cmd, '@ContentClause@',dbo.QBM_FCVStringToIndent( dbo.QBM_FSQCVBufferToColumn(@TableName , @columnname, N'y', 0), 7)) select32 @cmd = REPLACE(@cmd, '@ContentNull@', dbo.QBM_FCVStringToIndent(dbo.QBM_FSQCVBufferToColumn(@TableName , @columnname, N'y', 1), 7)) select @cmd = REPLACE33(@cmd, '@Xclause@', @Xclause) select @cmd = replace(REPLACE(@cmd, '@TableName @', @TableName ) , '@columnname@', @columnname) select @cmd = REPLACE(@cmd34, '@ModuleOwner@', @ModuleOwner) if @DebugSwitch > 0 begin print @cmd print 'go' end nachbearbeitung: select @cmd = '35 delete QBMBufferConfig36 from QBMBufferConfig y join @TableName @ x on y.XObjectKey = x.XObjectKey37 where y.TableName = ''@TableName @''38 and y.ColumnName = ''@columnname@''39 and @IsnullClause@ = 40@ContentClause@ 41 '42 select @cmd = REPLACE(@cmd, '@IsnullClause@', dbo.QBM_FSQIsNullClauseCmp(@TableName , @columnname, N'x')) select @cmd = REPLACE(@cmd, '@ContentClause@'43, dbo.QBM_FCVStringToIndent(dbo.QBM_FSQcvBufferToColumn(@TableName , @columnname, N'y', 1), 7)) select @cmd = replace(REPLACE(@cmd, '@TableName @', @TableName44 ) , '@columnname@', @columnname) if @DebugSwitch > 0 begin print @cmd print 'go' end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default declare @Rethrow45 varchar(1000) = dbo.QBM_FGISessionErrorRethrow() RAISERROR (@Rethrow, 18, 1) WITH NOWAIT END CATCH ende: end 46