DatabaseProcApplicationCreatedLinks
sybsystemprocssp_compatmode  31 Aug 14Defects Dependencies

1     
2     /* Sccsid = "%Z% generic/sproc/%M% %I% %G%" */
3     /*	4.8	1.1	06/14/90	sproc/src/compatmode */
4     
5     /*
6     ** Messages for "sp_compatmode"		
7     ** 
8     ** 19963, "Compatibility mode is not enabled."
9     ** 19964, "Compatibility mode is enabled."
10    ** 19965, "WARNING: The configuration option 'histogram tuning factor' is configured with value '%1!', which is not the default value in ASE 12.5. This may lead to different accuracy of statistics and different query plans."
11    */
12    
13    create procedure sp_compatmode as
14        begin
15    
16            declare @config_value_to_check int /* value of config option to be 
17            ** checked.
18            */
19            declare @msg varchar(1024) /* temp buffer for messages */
20    
21            select @config_value_to_check = NULL
22    
23            if @@trancount = 0
24            begin
25                set chained off
26            end
27    
28            set transaction isolation level 1
29    
30            /* Get value of 'enable compatibility mode' option. */
31            select @config_value_to_check = value
32            from master.dbo.sysconfigures
33            where config = 502
34    
35            /* Nothing to check if compatibility mode is disabled.*/
36            if (@config_value_to_check is not NULL
37                    and @config_value_to_check = 0)
38            begin
39                exec sp_getmessage 19963, @msg output
40                print @msg
41    
42                return (0)
43            end
44            else if (@config_value_to_check = 1)
45            begin
46                exec sp_getmessage 19964, @msg output
47                print @msg
48            end
49    
50            /*
51            ** Raise warning message if abstract plan 
52            ** dump/load/replace is also on. 
53            */
54            if exists (select *
55                    from master.dbo.sysconfigures
56                    where config in (383, 384, 385)
57                        and value = 1)
58            begin
59                exec sp_getmessage 19961, @msg output
60                print @msg
61            end
62    
63            /*
64            ** Raise warning message 19962 if literal  
65            ** autoparam is on, but we need to check
66            ** if statment cache is on also. 
67            */
68            if exists (select *
69                    from master.dbo.sysconfigures
70                    where config = 414 and value != 0)
71            begin
72                if exists (select *
73                        from master.dbo.sysconfigures
74                        where config = 462 and value = 1)
75                begin
76                    exec sp_getmessage 19962, @msg output
77                    print @msg
78                end
79            end
80    
81            /*
82            ** Raise warning message if the value of histogram 
83            ** tuning factor is not 1, the default value in
84            ** ASE 12.5. 
85            */
86            select @config_value_to_check = value
87            from master.dbo.sysconfigures
88            where config = 433
89    
90            if (@config_value_to_check is not NULL
91                    and @config_value_to_check != 1)
92            begin
93                exec sp_getmessage 19965, @msg output
94                print @msg, @config_value_to_check
95            end
96    
97            return (0)
98    
99        end
100   
101   


exec sp_procxmode 'sp_compatmode', 'AnyMode'
go

Grant Execute on sp_compatmode to public
go
DEFECTS
 MINU 4 Unique Index with nullable columns master..sysconfigures master..sysconfigures
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 33
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 70
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 74
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 88
 MGTP 3 Grant to public master..sysconfigures  
 MGTP 3 Grant to public sybsystemprocs..sp_compatmode  
 MNER 3 No Error Check should check return value of exec 39
 MNER 3 No Error Check should check return value of exec 46
 MNER 3 No Error Check should check return value of exec 59
 MNER 3 No Error Check should check return value of exec 76
 MNER 3 No Error Check should check return value of exec 93
 MUCO 3 Useless Code Useless Begin-End Pair 14
 MUCO 3 Useless Code Useless Brackets 36
 MUCO 3 Useless Code Useless Brackets 42
 MUCO 3 Useless Code Useless Brackets 44
 MUCO 3 Useless Code Useless Brackets 90
 MUCO 3 Useless Code Useless Brackets 97
 QAFM 3 Var Assignment from potentially many rows 31
 QAFM 3 Var Assignment from potentially many rows 86
 QISO 3 Set isolation level 28
 MSUB 2 Subquery Marker 54
 MSUB 2 Subquery Marker 68
 MSUB 2 Subquery Marker 72
 MTR1 2 Metrics: Comments Ratio Comments: 37% 13
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 12 = 12dec - 2exi + 2 13
 MTR3 2 Metrics: Query Complexity Complexity: 49 13

DEPENDENCIES
PROCS AND TABLES USED
calls proc sybsystemprocs..sp_getmessage  
   reads table sybsystemprocs..sysusermessages  
   reads table master..sysmessages (1)  
   reads table master..syslanguages (1)  
   calls proc sybsystemprocs..sp_validlang  
      reads table master..syslanguages (1)  
reads table master..sysconfigures (1)