DatabaseProcApplicationCreatedLinks
sybsystemprocssp_jdbc_convert_datatype  14 déc. 14Defects Propagation Dependencies

1     
2     create or replace procedure sp_jdbc_convert_datatype(
3         @source int,
4         @destination int)
5     as
6     
7         if @@trancount = 0
8         begin
9             set chained off
10        end
11    
12        set transaction isolation level 1
13    
14        /* Make source non-negative */
15        select @source = @source + 7
16        /* Put the strange date numbers into this area between 0-19*/
17        if (@source > 90)
18            select @source = @source - 82
19    
20        /*Convert destination the same way*/
21        /* Put the strange date numbers into this area between 0-19*/
22        if (@destination > 90)
23            select @destination = @destination - 82
24    
25        /* Need 8 added instead of 7 because substring starts at 1 instead */
26        /* of 0 */
27        select @destination = @destination + 8
28    
29        /* Check the conversion. If the bit string in the table has a 1 
30        ** on the place's number of the destination's value we have to 
31        ** return true, else false
32        */
33        if ((select substring(conversion, @destination, 1)
34                    from master.dbo.spt_jdbc_conversion
35                    where datatype = @source) = '1')
36    
37            select 1
38        else
39            select 0
40    


exec sp_procxmode 'sp_jdbc_convert_datatype', 'AnyMode'
go

Grant Execute on sp_jdbc_convert_datatype to public
go
RESULT SETS
sp_jdbc_convert_datatype_rset_002
sp_jdbc_convert_datatype_rset_001

DEFECTS
 TNOI 4 Table with no index master..spt_jdbc_conversion master..spt_jdbc_conversion
 MGTP 3 Grant to public master..spt_jdbc_conversion  
 MGTP 3 Grant to public sybsystemprocs..sp_jdbc_convert_datatype  
 MUCO 3 Useless Code Useless Brackets in create proc 2
 MUCO 3 Useless Code Useless Brackets 17
 MUCO 3 Useless Code Useless Brackets 22
 MUCO 3 Useless Code Useless Brackets 33
 QCRS 3 Conditional Result Set 37
 QCRS 3 Conditional Result Set 39
 QISO 3 Set isolation level 12
 QNAM 3 Select expression has no name 1 37
 QNAM 3 Select expression has no name 0 39
 MRST 2 Result Set Marker 37
 MRST 2 Result Set Marker 39
 MSUB 2 Subquery Marker 33
 MTR1 2 Metrics: Comments Ratio Comments: 40% 2
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 6 = 5dec - 1exi + 2 2
 MTR3 2 Metrics: Query Complexity Complexity: 19 2

DEPENDENCIES
PROCS AND TABLES USED
writes table sybsystemprocs..sp_jdbc_convert_datatype_rset_002 
reads table master..spt_jdbc_conversion (1)  
writes table sybsystemprocs..sp_jdbc_convert_datatype_rset_001