DatabaseProcApplicationCreatedLinks
sybsystemprocssp_ijdbc_mda  31 Aug 14Defects Dependencies

1     
2     
3     /*
4     ** requesttype 0 == Returns the mdinfo:MDAVERSION and mdinfo:MDARELEASEID rows.
5     ** requesttype 1 == JDBC
6     ** requesttype 2 == JDBC - but only send back the minimal frequently used info.
7     ** 
8     ** mdaversion 
9     */
10    create procedure sp_ijdbc_mda(@requesttype int, @requestversion int, @clientversion int = 0) as
11        begin
12    
13            declare @min_mdaversion int, @max_mdaversion int
14            declare @mda_version int
15            declare @srv_version int
16            declare @mdaver_querytype tinyint
17            declare @mdaver_query varchar(255)
18    
19            select @min_mdaversion = 1
20            select @max_mdaversion = 7
21            select @mda_version = @requestversion
22            /* get the Server version */
23            select @srv_version = convert(int, value) from master.dbo.sysconfigures
24            where config = 122
25            if @@trancount = 0
26            begin
27                set chained off
28            end
29    
30            set transaction isolation level 1
31    
32            /*
33            ** if the client is requesting a version too old
34            ** then we return our lowest version supported
35            **
36            ** the client needs to be able to just handle this
37            */
38            if (@requestversion < @min_mdaversion)
39            begin
40                select @mda_version = @min_mdaversion
41            end
42    
43            /*
44            ** if the client is requesting a version too new
45            ** we will return our highest version available
46            */
47            if (@mda_version > @max_mdaversion)
48            begin
49                select @mda_version = @max_mdaversion
50            end
51    
52            /*
53            ** if the client's requested version is between 1 and 3, 
54            ** then the mda version returned needs to be 1.  The reason
55            ** for this is the jConnect driver would pass in it's own 
56            ** major version number as the @requestversion.  We need to
57            ** keep older version's of the driver working ok since 
58            ** they expect a '1' to be returned.
59            */
60            if (@mda_version < 4)
61            begin
62                select @mda_version = 1
63                select @mdaver_querytype = 2
64                select @mdaver_query = 'select 1'
65            end
66            else
67            begin
68                select @mdaver_querytype = 5
69                select @mdaver_query = convert(varchar(255), @mda_version)
70            end
71    
72            /*
73            ** process the @requesttype
74            */
75            if (@requesttype = 0)
76            begin
77                select "mdinfo" = convert(varchar(30), 'MDAVERSION'),
78                    "querytype" = @mdaver_querytype,
79                    "pre_query" = '',
80                    "query" = @mdaver_query,
81                    "post_query" = ''
82                union
83                select mdinfo, querytype, isnull(pre_query, ''), query,
84                    isnull(post_query, '')
85                from master..spt_ijdbc_mda
86                where mdinfo in (
87                        'MDARELEASEID'
88                    )
89            end
90            else if (@requesttype = 1)
91            begin
92                select "mdinfo" = convert(varchar(30), 'MDAVERSION'),
93                    "querytype" = @mdaver_querytype,
94                    "pre_query" = '',
95                    "query" = @mdaver_query,
96                    "post_query" = ''
97                union
98                select mdinfo, querytype, isnull(pre_query, ''), query,
99                    isnull(post_query, '')
100               from master..spt_ijdbc_mda
101               where @mda_version >= mdaver_start
102                   and @mda_version <= mdaver_end
103                   and ((@srv_version >= srvver_start)
104                       and (@srv_version < srvver_end
105                           or srvver_end = - 1))
106           end
107           else if (@requesttype = 2)
108           begin
109               select "mdinfo" = convert(varchar(30), 'MDAVERSION'),
110                   "querytype" = @mdaver_querytype,
111                   "pre_query" = '',
112                   "query" = @mdaver_query,
113                   "post_query" = ''
114               union
115               select mdinfo, querytype, isnull(pre_query, ''), query,
116                   isnull(post_query, '')
117               from master..spt_ijdbc_mda
118               where mdinfo in (
119                       'CONNECTCONFIG',
120                       'SET_CATALOG',
121                       'SET_AUTOCOMMIT_ON',
122                       'SET_AUTOCOMMIT_OFF',
123                       'SET_ISOLATION',
124                       'SET_ROWCOUNT',
125                       'DEFAULT_CHARSET'
126                   )
127                   and @mda_version >= mdaver_start
128                   and @mda_version <= mdaver_end
129                   and ((@srv_version >= srvver_start)
130                       and (@srv_version < srvver_end
131                           or srvver_end = - 1))
132           end
133       end
134   


exec sp_procxmode 'sp_ijdbc_mda', 'AnyMode'
go

Grant Execute on sp_ijdbc_mda to public
go
RESULT SETS
sp_ijdbc_mda_rset_003
sp_ijdbc_mda_rset_002
sp_ijdbc_mda_rset_001

DEFECTS
 MEST 4 Empty String will be replaced by Single Space 79
 MEST 4 Empty String will be replaced by Single Space 81
 MEST 4 Empty String will be replaced by Single Space 83
 MEST 4 Empty String will be replaced by Single Space 84
 MEST 4 Empty String will be replaced by Single Space 94
 MEST 4 Empty String will be replaced by Single Space 96
 MEST 4 Empty String will be replaced by Single Space 98
 MEST 4 Empty String will be replaced by Single Space 99
 MEST 4 Empty String will be replaced by Single Space 111
 MEST 4 Empty String will be replaced by Single Space 113
 MEST 4 Empty String will be replaced by Single Space 115
 MEST 4 Empty String will be replaced by Single Space 116
 MINU 4 Unique Index with nullable columns master..sysconfigures master..sysconfigures
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_ijdbc_mda.spt_ijdbc_mda_ind unique
(mdinfo, mdaver_end, srvver_end)
Intersection: {srvver_end, mdaver_end}
101
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 24
 QTYP 4 Comparison type mismatch Comparison type mismatch: int vs tinyint 101
 QTYP 4 Comparison type mismatch tinyint = int 101
 QTYP 4 Comparison type mismatch Comparison type mismatch: int vs tinyint 102
 QTYP 4 Comparison type mismatch tinyint = int 102
 QTYP 4 Comparison type mismatch Comparison type mismatch: int vs tinyint 127
 QTYP 4 Comparison type mismatch tinyint = int 127
 QTYP 4 Comparison type mismatch Comparison type mismatch: int vs tinyint 128
 QTYP 4 Comparison type mismatch tinyint = int 128
 MGTP 3 Grant to public master..spt_ijdbc_mda  
 MGTP 3 Grant to public master..sysconfigures  
 MGTP 3 Grant to public sybsystemprocs..sp_ijdbc_mda  
 MUCO 3 Useless Code Useless Brackets in create proc 10
 MUCO 3 Useless Code Useless Begin-End Pair 11
 MUCO 3 Useless Code Useless Brackets 38
 MUCO 3 Useless Code Useless Brackets 47
 MUCO 3 Useless Code Useless Brackets 60
 MUCO 3 Useless Code Useless Brackets 75
 MUCO 3 Useless Code Useless Brackets 90
 MUCO 3 Useless Code Useless Brackets 107
 QAFM 3 Var Assignment from potentially many rows 23
 QCRS 3 Conditional Result Set 77
 QCRS 3 Conditional Result Set 92
 QCRS 3 Conditional Result Set 109
 QGWO 3 Group by/Distinct/Union without order by 77
 QGWO 3 Group by/Distinct/Union without order by 92
 QGWO 3 Group by/Distinct/Union without order by 109
 QISO 3 Set isolation level 30
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: spt_ijdbc_mda.spt_ijdbc_mda_ind unique
(mdinfo, mdaver_end, srvver_end)
Intersection: {mdinfo}
86
 QUNI 3 Check Use of 'union' vs 'union all' 77
 QUNI 3 Check Use of 'union' vs 'union all' 92
 QUNI 3 Check Use of 'union' vs 'union all' 109
 VUNU 3 Variable is not used @clientversion 10
 MRST 2 Result Set Marker 77
 MRST 2 Result Set Marker 92
 MRST 2 Result Set Marker 109
 MTR1 2 Metrics: Comments Ratio Comments: 21% 10
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 8 = 7dec - 1exi + 2 10
 MTR3 2 Metrics: Query Complexity Complexity: 53 10

DEPENDENCIES
PROCS AND TABLES USED
reads table master..sysconfigures (1)  
reads table master..spt_ijdbc_mda (1)