DatabaseProcApplicationCreatedLinks
sybsystemprocssp_jdbc_getschemas_cts  14 déc. 14Defects Propagation Dependencies

1     
2     /*Stored procedure to support CTS test suite  ADDPOINT_GETSCHEMAS_CTS*/
3     /*
4     **  sp_jdbc_getschemas_cts
5     */
6     
7     CREATE OR REPLACE PROCEDURE sp_jdbc_getschemas_cts
8     as
9         declare @schemaname varchar(32)
10        declare @startedInTransaction bit
11    
12        if @@trancount = 0
13        begin
14            set chained off
15        end
16        /* check if we're in a transaction, before we try any select statements */
17        if (@@trancount > 0)
18            select @startedInTransaction = 1
19        else
20            select @startedInTransaction = 0
21    
22        set transaction isolation level 1
23    
24        if (@startedInTransaction = 1)
25            save transaction jdbc_keep_temptables_from_tx
26    
27        /* this will make sure that all rows are sent even if
28        ** the client "set rowcount" is differect
29        */
30    
31        set rowcount 0
32    
33        create table #tmpschemas
34        (TABLE_SCHEM varchar(32) null)
35    
36        DECLARE jcurs_getschemas CURSOR
37        FOR
38        select name from sysusers where suid >= - 2
39        FOR READ ONLY
40        OPEN jcurs_getschemas
41        FETCH jcurs_getschemas INTO @schemaname
42        while (@@sqlstatus = 0)
43        begin
44            insert into #tmpschemas values (@schemaname)
45            FETCH jcurs_getschemas INTO @schemaname
46        end
47    
48        close jcurs_getschemas
49        deallocate cursor jcurs_getschemas
50    
51        select TABLE_SCHEM from #tmpschemas order by TABLE_SCHEM
52        drop table #tmpschemas
53        if (@startedInTransaction = 1)
54            rollback transaction jdbc_keep_temptables_from_tx
55    


exec sp_procxmode 'sp_jdbc_getschemas_cts', 'AnyMode'
go

Grant Execute on sp_jdbc_getschemas_cts to public
go
RESULT SETS
sp_jdbc_getschemas_cts_rset_001

DEFECTS
 MGTP 3 Grant to public sybsystemprocs..sp_jdbc_getschemas_cts  
 MGTP 3 Grant to public sybsystemprocs..sysusers  
 MNER 3 No Error Check should check @@error after insert 44
 MUCO 3 Useless Code Useless Brackets 17
 MUCO 3 Useless Code Useless Brackets 24
 MUCO 3 Useless Code Useless Brackets 42
 MUCO 3 Useless Code Useless Brackets 53
 QISO 3 Set isolation level 22
 CRDO 2 Read Only Cursor Marker (has for read only clause) 38
 MRST 2 Result Set Marker 51
 MTR1 2 Metrics: Comments Ratio Comments: 17% 7
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 7 = 6dec - 1exi + 2 7
 MTR3 2 Metrics: Query Complexity Complexity: 35 7

DEPENDENCIES
PROCS AND TABLES USED
reads table sybsystemprocs..sysusers  
writes table sybsystemprocs..sp_jdbc_getschemas_cts_rset_001 
read_writes table tempdb..#tmpschemas (1)