DatabaseProcApplicationCreatedLinks
sybsystemprocssp_jdbc_datatype_info  31 Aug 14Defects Dependencies

1     /** SECTION END: CLEANUP **/
2     
3     create procedure sp_jdbc_datatype_info
4     as
5     
6         if @@trancount = 0
7         begin
8             set chained off
9         end
10    
11        set transaction isolation level 1
12    
13        /* this will make sure that all rows are sent even if
14        ** the client "set rowcount" is differect
15        */
16    
17        set rowcount 0
18    
19        select /* Real SQL Server data types */
20            case
21                when t.name = 'usmallint' then 'unsigned smallint'
22                when t.name = 'uint' then 'unsigned int'
23                when t.name = 'ubigint' then 'unsigned bigint'
24                else
25                    t.name
26            end as TYPE_NAME,
27            d.data_type as DATA_TYPE,
28            isnull(d.data_precision, convert(int, t.length)) as 'PRECISION',
29            d.literal_prefix as LITERAL_PREFIX,
30            d.literal_suffix as LITERAL_SUFFIX,
31            e.create_params as CREATE_PARAMS,
32            d.nullable as NULLABLE,
33            d.case_sensitive as CASE_SENSITIVE,
34            d.searchable as SEARCHABLE,
35            d.unsigned_attribute as UNSIGNED_ATTRIBUTE,
36            d.money as FIXED_PREC_SCALE,
37            d.auto_increment as AUTO_INCREMENT,
38            d.local_type_name as LOCAL_TYPE_NAME,
39            d.minimum_scale as MINIMUM_SCALE,
40            d.maximum_scale as MAXIMUM_SCALE,
41            d.sql_data_type as SQL_DATA_TYPE,
42            d.sql_datetime_sub as SQL_DATETIME_SUB,
43            d.num_prec_radix as NUM_PREC_RADIX,
44            d.interval_precision as INTERVAL_PRECISION
45        from sybsystemprocs.dbo.spt_jdbc_datatype_info d,
46            sybsystemprocs.dbo.spt_datatype_info_ext e, systypes t
47        where d.ss_dtype = t.type and t.usertype *= e.user_type
48            /* restrict results to 'real' datatypes, exclude float, date and time*/
49            and t.name not in ('nchar', 'nvarchar', 'sysname', 'timestamp', 'longsysname', 'float',
50                'datetimn', 'floatn', 'intn', 'moneyn', 'unichar',
51                'univarchar', 'daten', 'timen', 'date', 'time', 'uintn')
52            and t.usertype < 100 /* No user defined types */
53        UNION
54        select /* SQL Server user data types */
55            case
56                when t.name = 'usmallint' then 'unsigned smallint'
57                when t.name = 'uint' then 'unsigned int'
58                when t.name = 'ubigint' then 'unsigned bigint'
59                else
60                    t.name
61            end as TYPE_NAME,
62            d.data_type,
63            isnull(d.data_precision, convert(int, t.length)) as 'PRECISION',
64            d.literal_prefix, d.literal_suffix, e.create_params, d.nullable,
65            d.case_sensitive, d.searchable, d.unsigned_attribute, d.money,
66            d.auto_increment, t.name, d.minimum_scale,
67            d.maximum_scale, d.sql_data_type, d.sql_datetime_sub,
68            d.num_prec_radix, d.interval_precision
69        from sybsystemprocs.dbo.spt_jdbc_datatype_info d,
70            sybsystemprocs.dbo.spt_datatype_info_ext e, systypes t
71        where d.ss_dtype = t.type and t.usertype *= e.user_type
72            /* Restrict to user defined types (value > 100)  and Sybase user defined 
73            ** types (listed)*/
74            and (t.name in ('nchar', 'nvarchar')
75                or t.usertype >= 100) /* User defined types */
76        UNION
77        select /* ADD double precision which is floatn internally*/
78            'double precision', 8, 15,
79            d.literal_prefix, d.literal_suffix, e.create_params, d.nullable,
80            d.case_sensitive, d.searchable, d.unsigned_attribute, d.money,
81            d.auto_increment, 'double precision', d.minimum_scale,
82            d.maximum_scale, d.sql_data_type, d.sql_datetime_sub,
83            d.num_prec_radix, d.interval_precision
84        from sybsystemprocs.dbo.spt_jdbc_datatype_info d,
85            sybsystemprocs.dbo.spt_datatype_info_ext e, systypes t
86        where d.ss_dtype = t.type and t.usertype *= e.user_type
87            and t.name = 'floatn' and t.usertype < 100
88        UNION /* ADD float now */
89        select
90            'float', 8, 8,
91            d.literal_prefix, d.literal_suffix, e.create_params, d.nullable,
92            d.case_sensitive, d.searchable, d.unsigned_attribute, d.money,
93            d.auto_increment, 'float', d.minimum_scale,
94            d.maximum_scale, d.sql_data_type, d.sql_datetime_sub,
95            d.num_prec_radix, d.interval_precision
96        from sybsystemprocs.dbo.spt_jdbc_datatype_info d,
97            sybsystemprocs.dbo.spt_datatype_info_ext e, systypes t
98        where d.ss_dtype = t.type and t.usertype *= e.user_type
99            and t.name = 'float' and t.usertype < 100
100       UNION
101       select /* Add date and time now. Special case because we want to use */
102           /* d.sql_data_type for DATA_TYPE for these two types          */
103           case
104               when t.name = 'usmallint' then 'unsigned smallint'
105               when t.name = 'uint' then 'unsigned int'
106               when t.name = 'ubigint' then 'unsigned bigint'
107               else
108                   t.name
109           end as TYPE_NAME,
110           d.sql_data_type,
111           isnull(d.data_precision, convert(int, t.length)),
112           d.literal_prefix,
113           d.literal_suffix,
114           e.create_params,
115           d.nullable,
116           d.case_sensitive,
117           d.searchable,
118           d.unsigned_attribute,
119           d.money,
120           d.auto_increment,
121           d.local_type_name,
122           d.minimum_scale,
123           d.maximum_scale,
124           d.sql_data_type,
125           d.sql_datetime_sub,
126           d.num_prec_radix,
127           d.interval_precision
128       from sybsystemprocs.dbo.spt_jdbc_datatype_info d,
129           sybsystemprocs.dbo.spt_datatype_info_ext e, systypes t
130       where d.ss_dtype = t.type and t.usertype *= e.user_type
131           /* restrict results to date and time*/
132           and t.name in ('date', 'time')
133           and t.usertype < 100 /* No user defined types */
134       order by DATA_TYPE, TYPE_NAME
135   
136       return (0)
137   


exec sp_procxmode 'sp_jdbc_datatype_info', 'AnyMode'
go

Grant Execute on sp_jdbc_datatype_info to public
go
RESULT SETS
sp_jdbc_datatype_info_rset_001

DEFECTS
 QJWI 5 Join or Sarg Without Index 47
 QJWI 5 Join or Sarg Without Index 71
 QJWI 5 Join or Sarg Without Index 86
 QJWI 5 Join or Sarg Without Index 98
 QJWI 5 Join or Sarg Without Index 130
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 52
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 75
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 87
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 99
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 133
 TNOI 4 Table with no index sybsystemprocs..spt_datatype_info_ext sybsystemprocs..spt_datatype_info_ext
 TNOI 4 Table with no index sybsystemprocs..spt_jdbc_datatype_info sybsystemprocs..spt_jdbc_datatype_info
 MGTP 3 Grant to public sybsystemprocs..sp_jdbc_datatype_info  
 MGTP 3 Grant to public sybsystemprocs..spt_datatype_info_ext  
 MGTP 3 Grant to public sybsystemprocs..spt_jdbc_datatype_info  
 MGTP 3 Grant to public sybsystemprocs..systypes  
 MUCO 3 Useless Code Useless Brackets 136
 QISO 3 Set isolation level 11
 QNAO 3 Not using ANSI Outer Join 45
 QNAO 3 Not using ANSI Outer Join 69
 QNAO 3 Not using ANSI Outer Join 84
 QNAO 3 Not using ANSI Outer Join 96
 QNAO 3 Not using ANSI Outer Join 128
 QUNI 3 Check Use of 'union' vs 'union all' 19
 MRST 2 Result Set Marker 19
 MTR1 2 Metrics: Comments Ratio Comments: 11% 3
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 2 = 1dec - 1exi + 2 3
 MTR3 2 Metrics: Query Complexity Complexity: 53 3

DEPENDENCIES
PROCS AND TABLES USED
reads table sybsystemprocs..systypes  
reads table sybsystemprocs..spt_jdbc_datatype_info  
reads table sybsystemprocs..spt_datatype_info_ext