dbo.QBM_PViewBuildCheckCCCExtend
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_FCVGUIDToModuleOwner source text reference
- references source dbo.QBM_FCVStringToInt source text reference
- references source dbo.QBM_FGIDBOwner source text reference
- references source dbo.QBM_FGISessionErrorRethrow source text reference
- references source dbo.QBM_PSessionErrorAdd source text reference
- references source dbo.QBM_PViewBuild source text reference
- references source dbo.QBM_PViewBuild_FromAddOn source text reference
Complete Source
1CREATE PROCEDURE QBM_PViewBuildCheckCCCExtend(2 @UID_QBMViewAddOn varchar(38)3)4AS5BEGIN6 DECLARE @Vorher QBM_YParameterList7 DECLARE @nachher QBM_YParameterList8 DECLARE @UID_DialogTable varchar(38)9 DECLARE @DebugSwitch int = 010 DECLARE @Datatypes TABLE(Datatype nvarchar(64) collate database_default,11 SortOrder int)12 SET XACT_ABORT OFF13 BEGIN TRY14 IF @DebugSwitch > 015 BEGIN16 print 'eintritt QBM_PViewBuildCheckCCCExtend für' + @UID_QBMViewAddOn17 END18 IF dbo.QBM_FGIDBOwner() <> 'CCC'19 BEGIN20 GOTO endLabel21 END22 SELECT TOP 1 @UID_DialogTable = a.UID_DialogTable23 FROM QBMViewAddOn a24 WHERE25 UID_QBMViewAddOn = @UID_QBMViewAddOn26 IF dbo.QBM_FCVGUIDToModuleOwner(@UID_DialogTable) = 'CCC'27 BEGIN28 IF @DebugSwitch > 029 BEGIN30 print 'Kundentabelle'31 END32 GOTO endlabel33 END34 IF dbo.QBM_FCVGUIDToModuleOwner(@UID_QBMViewAddOn) <> 'CCC'35 BEGIN36 IF @DebugSwitch > 037 BEGIN38 print 'unsere Tablle unser kram'39 END40 GOTO endLabel41 END42 INSERT INTO @Vorher(Parameter1,43 Parameter2,44 Parameter3)45 SELECT46 c.COLUMN_NAME,47 c.DATA_TYPE,48 CASE isnull(c.CHARACTER_MAXIMUM_LENGTH,49 0)50 WHEN 0 THEN51 052 WHEN -1 THEN53 107374182454 ELSE c.CHARACTER_MAXIMUM_LENGTH55 END56 FROM INFORMATION_SCHEMA.COLUMNS c57 JOIN DialogTable t58 ON t.TableName = c.TABLE_NAME collate database_default59 WHERE60 t.UID_DialogTable = @UID_DialogTable61 IF @DebugSwitch > 062 BEGIN63 print '@vorher'64 SELECT65 z.Parameter1,66 z.Parameter2,67 z.Parameter368 FROM @vorher z69 END70 EXEC QBM_PViewBuild_FromAddOn @UID_DialogTable71 INSERT INTO @nachher(Parameter1,72 Parameter2,73 Parameter3)74 SELECT75 c.COLUMN_NAME,76 c.DATA_TYPE,77 CASE isnull(c.CHARACTER_MAXIMUM_LENGTH,78 0)79 WHEN 0 THEN80 081 WHEN -1 THEN82 107374182483 ELSE c.CHARACTER_MAXIMUM_LENGTH84 END85 FROM INFORMATION_SCHEMA.COLUMNS c86 JOIN DialogTable t87 ON t.TableName = c.TABLE_NAME collate database_default88 WHERE89 t.UID_DialogTable = @UID_DialogTable90 IF @DebugSwitch > 091 BEGIN92 print '@nachher'93 SELECT94 z.Parameter1,95 z.Parameter2,96 z.Parameter397 FROM @nachher z98 END99 IF EXISTS(100 SELECT TOP 1 1101 FROM(102 SELECT n.Parameter1 AS AdditionalColumn103 FROM @nachher n104 LEFT105 OUTER106 JOIN @Vorher v107 ON v.Parameter1 = n.Parameter1108 WHERE109 v.Parameter1 IS NULL) AS x)110 BEGIN111 SET XACT_ABORT112 ON113 RAISERROR('#LDS#Custom extension would extend columns of the view.|',114 18,115 1)116 WITH nowait117 GOTO endlabel118 END119 INSERT INTO @Datatypes(Datatype,120 SortOrder)121 VALUES('nvarchar',122 0),123 ('varchar',124 100),125 ('nchar',126 200),127 ('char',128 300),129 ('varbinary',130 1000),131 ('binary',132 1100),133 ('float',134 2001),135 ('datetime',136 2100),137 ('numeric',138 3001),139 ('bigint',140 3101),141 ('int',142 3201),143 ('smallint',144 3301),145 ('tinyint',146 3401),147 ('bit',148 3501)149 IF @DebugSwitch > 0150 BEGIN151 print 'vergleich'152 SELECT153 v.Parameter1,154 v.Parameter2 AS typ_alt,155 n.Parameter2 AS typ_neu,156 v.Parameter3 AS laenge_alt,157 n.Parameter3 AS laenge_neu,158 vd.SortOrder / 1000 AS GruppeV,159 nd.SortOrder / 1000 AS GruppeN160 FROM @Vorher v161 JOIN @nachher n162 ON v.Parameter1 = n.Parameter1163 JOIN @Datatypes vd164 ON v.Parameter2 = vd.Datatype165 JOIN @Datatypes nd166 ON n.Parameter2 = nd.Datatype167 END168 IF EXISTS(169 SELECT TOP 1 1170 FROM(171 SELECT172 v.Parameter1, v.Parameter2 AS typ_alt, n.Parameter2 AS typ_neu, v.Parameter3 AS laenge_alt, n.Parameter3 AS laenge_neu173 FROM @Vorher v174 JOIN @nachher n175 ON v.Parameter1 = n.Parameter1176 JOIN @Datatypes vd177 ON v.Parameter2 = vd.Datatype178 JOIN @Datatypes nd179 ON n.Parameter2 = nd.Datatype180 WHERE181 nd.SortOrder / 1000 <> vd.SortOrder / 1000 OR dbo.QBM_FCVStringToInt(v.Parameter3, 0) > dbo.QBM_FCVStringToInt(n.Parameter3,182 0) OR(v.Parameter1 LIKE 'X%' AND(v.Parameter3 <> n.Parameter3 OR v.Parameter2 <> n.Parameter2))) AS x)183 BEGIN184 RAISERROR('#LDS#Custom extension would change datatype(s) of the view-columns.|',185 18,186 1)187 WITH nowait188 GOTO endlabel189 END190 END TRY191 BEGIN CATCH192 EXEC QBM_PSessionErrorAdd DEFAULT193 DECLARE @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow()194 RAISERROR(@Rethrow,195 18,196 1)197 WITH NOWAIT198 END CATCH199 endLabel:200 RETURN201END
Open raw exported source
1 create procedure QBM_PViewBuildCheckCCCExtend (@UID_QBMViewAddOn varchar(38) ) as begin declare @Vorher QBM_YParameterList declare @nachher2 QBM_YParameterList declare @UID_DialogTable varchar(38) declare @DebugSwitch int = 0 declare @Datatypes table(Datatype nvarchar(64) collate database_default3 , SortOrder int ) SET XACT_ABORT OFF BEGIN TRY if @DebugSwitch > 0 begin print 'eintritt QBM_PViewBuildCheckCCCExtend für' + @UID_QBMViewAddOn end if 4dbo.QBM_FGIDBOwner() <> 'CCC' begin goto endLabel end select top 1 @UID_DialogTable = a.UID_DialogTable from QBMViewAddOn a where UID_QBMViewAddOn = @UID_QBMViewAddOn5 if dbo.QBM_FCVGUIDToModuleOwner(@UID_DialogTable) = 'CCC' begin if @DebugSwitch > 0 begin print 'Kundentabelle' end goto endlabel end if dbo.QBM_FCVGUIDToModuleOwner6(@UID_QBMViewAddOn) <> 'CCC' begin if @DebugSwitch > 0 begin print 'unsere Tablle unser kram' end goto endLabel end insert into @Vorher(Parameter1, Parameter27, Parameter3) select c.COLUMN_NAME, c.DATA_TYPE, case isnull(c.CHARACTER_MAXIMUM_LENGTH, 0) when 0 then 0 when -1 then 1073741824 else c.CHARACTER_MAXIMUM_LENGTH8 end from INFORMATION_SCHEMA.COLUMNS c join DialogTable t on t.TableName = c.TABLE_NAME collate database_default where t.UID_DialogTable = @UID_DialogTable9 if @DebugSwitch > 0 begin print '@vorher' select z.Parameter1, z.Parameter2, z.Parameter3 from @vorher z end exec QBM_PViewBuild_FromAddOn @UID_DialogTable10 insert into @nachher(Parameter1, Parameter2, Parameter3) select c.COLUMN_NAME, c.DATA_TYPE, case isnull(c.CHARACTER_MAXIMUM_LENGTH, 0) when 0 then 0 when11 -1 then 1073741824 else c.CHARACTER_MAXIMUM_LENGTH end from INFORMATION_SCHEMA.COLUMNS c join DialogTable t on t.TableName = c.TABLE_NAME collate database_default12 where t.UID_DialogTable = @UID_DialogTable if @DebugSwitch > 0 begin print '@nachher' select z.Parameter1, z.Parameter2, z.Parameter3 from @nachher z 13end if exists (select top 1 1 from ( select n.Parameter1 as AdditionalColumn from @nachher n left outer join @Vorher v on v.Parameter1 = n.Parameter1 where14 v.Parameter1 is null ) as x ) begin set XACT_ABORT ON raiserror('#LDS#Custom extension would extend columns of the view.|', 18, 1) with nowait goto endlabel15 end insert into @Datatypes(Datatype, SortOrder) values ('nvarchar' , 0 ) , ('varchar' , 100 ) , ('nchar' , 200 ) , ('char' , 300 ) , ('varbinary' , 100016 ) , ('binary' , 1100 ) , ('float' , 2001 ) , ('datetime' , 2100 ) , ('numeric' , 3001 ) , ('bigint' , 3101 ) , ('int' , 3201 ) , ('smallint' , 3301 )17 , ('tinyint' , 3401 ) , ('bit' , 3501 ) if @DebugSwitch > 0 begin print 'vergleich' select v.Parameter1, v.Parameter2 as typ_alt, n.Parameter2 as typ_neu18, v.Parameter3 as laenge_alt, n.Parameter3 as laenge_neu, vd.SortOrder / 1000 as GruppeV, nd.SortOrder / 1000 as GruppeN from @Vorher v join @nachher n19 on v.Parameter1 = n.Parameter1 join @Datatypes vd on v.Parameter2 = vd.Datatype join @Datatypes nd on n.Parameter2 = nd.Datatype end if exists (select20 top 1 1 from ( select v.Parameter1, v.Parameter2 as typ_alt, n.Parameter2 as typ_neu, v.Parameter3 as laenge_alt, n.Parameter3 as laenge_neu from @Vorher21 v join @nachher n on v.Parameter1 = n.Parameter1 join @Datatypes vd on v.Parameter2 = vd.Datatype join @Datatypes nd on n.Parameter2 = nd.Datatype where22 nd.SortOrder / 1000 <> vd.SortOrder / 1000 or dbo.QBM_FCVStringToInt(v.Parameter3, 0) > dbo.QBM_FCVStringToInt(n.Parameter3,0) or (v.Parameter1 like23 'X%' and (v.Parameter3 <> n.Parameter3 or v.Parameter2 <> n.Parameter2 ) ) ) as x ) begin raiserror('#LDS#Custom extension would change datatype(s) of the view-columns.|'24, 18, 1) with nowait goto endlabel end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default declare @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow25() RAISERROR (@Rethrow, 18, 1) WITH NOWAIT END CATCH endLabel: return end 26