DatabaseProcApplicationCreatedLinks
sybsystemprocssp_serverinfo  31 Aug 14Defects Dependencies

1     
2     /* Sccsid = "%Z% generic/sproc/%M% %I% %G%" */
3     
4     /*
5     ** Messages for "sp_serverinfo"         17796
6     **
7     ** 17796, "Legal request codes are as follows:"
8     */
9     
10    create procedure sp_serverinfo
11        @request varchar(30) = NULL,
12        @arg1 varchar(255) = NULL, /* optional arg1 */
13        @arg2 varchar(30) = NULL, /* optional arg2 */
14        @arg3 varchar(30) = NULL, /* optional arg3 */
15        @arg4 varchar(30) = NULL, /* optional arg4 */
16        @arg5 varchar(30) = NULL, /* optional arg5 */
17        @arg6 varchar(30) = NULL, /* optional arg6 */
18        @arg7 varchar(30) = NULL, /* optional arg7 */
19        @arg8 varchar(30) = NULL, /* optional arg8 */
20        @arg9 varchar(30) = NULL /* optional arg9 */
21    as
22    
23        declare @csid int /* character set id */
24        declare @soid int /* sort order id */
25        declare @msg varchar(1024)
26    
27    
28        if @@trancount = 0
29        begin
30            set chained off
31        end
32    
33        set transaction isolation level 1
34    
35        set nocount on
36    
37        if (@request is null or @request = "help")
38        begin
39            /*
40            ** 17796, "Legal request codes are as follows:"
41            */
42            exec sp_getmessage 17796, @msg output
43            print @msg
44            print "    server_csname"
45            print "    server_soname"
46            print "    csdefinition"
47            print "    sodefinition"
48            print "	   client_csexpansion"
49            return (9)
50        end
51    
52        if (@request = "server_csname")
53        begin
54            /*
55            ** User wants the name of the server's default character set.
56            ** No additional arguments required.
57            */
58            select @csid = value
59            from master.dbo.syscurconfigs
60            where config = 131
61    
62            select name
63            from master.dbo.syscharsets
64            where id = @csid and type between 1000 and 1999
65    
66            return (0)
67        end
68        else if (@request = "server_soname")
69        begin
70            /*
71            ** User wants the name of the server's default sort order.
72            ** No additional arguments required.
73            */
74            select @soid = value
75            from master.dbo.syscurconfigs
76            where config = 123
77    
78            select @csid = value
79            from master.dbo.syscurconfigs
80            where config = 131
81    
82            select name
83            from master.dbo.syscharsets
84            where id = @soid and csid = @csid and type between 2000 and 2999
85    
86            return (0)
87        end
88        else if (@request = "csdefinition")
89        begin
90            /*
91            ** User wants the type, id, and definition (IMAGE field) of the
92            ** character set specified in "@arg1".
93            */
94            select @csid = id
95            from master.dbo.syscharsets
96            where name = @arg1
97    
98            set textsize 32768
99    
100           select type, id, definition
101           from master.dbo.syscharsets
102           where id = @csid and type between 1000 and 1999
103   
104           return (0)
105       end
106       else if (@request = "sodefinition")
107       begin
108           /*
109           ** User wants the name of the server's character set.
110           ** No additional arguments required.
111           */
112           /*
113           ** User wants the definition (IMAGE field) of the sort order which
114           ** is the logical equivalent to the server's default sort order,
115           ** except based on the character set specified in "@arg1".
116           */
117           select @soid = value
118           from master.dbo.syscurconfigs
119           where config = 123
120   
121           select @csid = id
122           from master.dbo.syscharsets
123           where name = @arg1 and type between 1000 and 1999
124   
125           select definition
126           from master.dbo.syscharsets
127           where id = @soid and csid = @csid and type between 2000 and 2999
128   
129           return (0)
130       end
131       else if (@request = "client_csexpansion")
132       begin
133           /*
134           ** User wants the expansion factor from server to client.
135           ** No additional arguments required.
136           */
137   
138           select @@client_csexpansion
139   
140           return (0)
141       end
142       else
143       begin
144           /*
145           ** Unknown request code.
146           */
147           return (1)
148       end
149   


exec sp_procxmode 'sp_serverinfo', 'AnyMode'
go

Grant Execute on sp_serverinfo to public
go
RESULT SETS
sp_serverinfo_rset_005
sp_serverinfo_rset_004
sp_serverinfo_rset_003
sp_serverinfo_rset_002
sp_serverinfo_rset_001

DEFECTS
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 60
 QTYP 4 Comparison type mismatch Comparison type mismatch: tinyint vs int 64
 QTYP 4 Comparison type mismatch tinyint = int 64
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 76
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 80
 QTYP 4 Comparison type mismatch Comparison type mismatch: tinyint vs int 84
 QTYP 4 Comparison type mismatch tinyint = int 84
 QTYP 4 Comparison type mismatch Comparison type mismatch: tinyint vs int 102
 QTYP 4 Comparison type mismatch tinyint = int 102
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 119
 QTYP 4 Comparison type mismatch Comparison type mismatch: tinyint vs int 127
 QTYP 4 Comparison type mismatch tinyint = int 127
 TNOI 4 Table with no index master..syscurconfigs master..syscurconfigs
 MGTP 3 Grant to public master..syscharsets  
 MGTP 3 Grant to public master..syscurconfigs  
 MGTP 3 Grant to public sybsystemprocs..sp_serverinfo  
 MNER 3 No Error Check should check return value of exec 42
 MUCO 3 Useless Code Useless Brackets 37
 MUCO 3 Useless Code Useless Brackets 49
 MUCO 3 Useless Code Useless Brackets 52
 MUCO 3 Useless Code Useless Brackets 66
 MUCO 3 Useless Code Useless Brackets 68
 MUCO 3 Useless Code Useless Brackets 86
 MUCO 3 Useless Code Useless Brackets 88
 MUCO 3 Useless Code Useless Brackets 104
 MUCO 3 Useless Code Useless Brackets 106
 MUCO 3 Useless Code Useless Brackets 129
 MUCO 3 Useless Code Useless Brackets 131
 MUCO 3 Useless Code Useless Brackets 140
 MUCO 3 Useless Code Useless Brackets 147
 QAFM 3 Var Assignment from potentially many rows 58
 QAFM 3 Var Assignment from potentially many rows 74
 QAFM 3 Var Assignment from potentially many rows 78
 QAFM 3 Var Assignment from potentially many rows 117
 QCRS 3 Conditional Result Set 62
 QCRS 3 Conditional Result Set 82
 QCRS 3 Conditional Result Set 100
 QCRS 3 Conditional Result Set 125
 QCRS 3 Conditional Result Set 138
 QISO 3 Set isolation level 33
 QNAM 3 Select expression has no name @@client_csexpansion 138
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: syscharsets.csyscharsets unique clustered
(id, csid)
Intersection: {id}
64
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: syscharsets.csyscharsets unique clustered
(id, csid)
Intersection: {id}
102
 VUNU 3 Variable is not used @arg2 13
 VUNU 3 Variable is not used @arg3 14
 VUNU 3 Variable is not used @arg4 15
 VUNU 3 Variable is not used @arg5 16
 VUNU 3 Variable is not used @arg6 17
 VUNU 3 Variable is not used @arg7 18
 VUNU 3 Variable is not used @arg8 19
 VUNU 3 Variable is not used @arg9 20
 MRST 2 Result Set Marker 62
 MRST 2 Result Set Marker 82
 MRST 2 Result Set Marker 100
 MRST 2 Result Set Marker 125
 MRST 2 Result Set Marker 138
 MTR1 2 Metrics: Comments Ratio Comments: 34% 10
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 4 = 10dec - 8exi + 2 10
 MTR3 2 Metrics: Query Complexity Complexity: 75 10

DEPENDENCIES
PROCS AND TABLES USED
reads table master..syscharsets (1)  
reads table master..syscurconfigs (1)  
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)  

CALLERS
called by proc sybsystemprocs..sp_inform