DatabaseProcApplicationCreatedLinks
sybsystemprocssp_jdbc_getcatalogs_cts  14 déc. 14Defects Propagation Dependencies

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


exec sp_procxmode 'sp_jdbc_getcatalogs_cts', 'AnyMode'
go

Grant Execute on sp_jdbc_getcatalogs_cts to public
go
RESULT SETS
sp_jdbc_getcatalogs_cts_rset_001

DEFECTS
 MGTP 3 Grant to public master..sysdatabases  
 MGTP 3 Grant to public sybsystemprocs..sp_jdbc_getcatalogs_cts  
 MNER 3 No Error Check should check @@error after insert 49
 MUCO 3 Useless Code Useless Brackets 23
 MUCO 3 Useless Code Useless Brackets 30
 MUCO 3 Useless Code Useless Brackets 47
 MUCO 3 Useless Code Useless Brackets 57
 QISO 3 Set isolation level 28
 CRDO 2 Read Only Cursor Marker (has for read only clause) 43
 MRST 2 Result Set Marker 54
 MTR1 2 Metrics: Comments Ratio Comments: 20% 12
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 7 = 6dec - 1exi + 2 12
 MTR3 2 Metrics: Query Complexity Complexity: 34 12

DEPENDENCIES
PROCS AND TABLES USED
read_writes table tempdb..#tmpcatalog (1) 
writes table sybsystemprocs..sp_jdbc_getcatalogs_cts_rset_001 
reads table master..sysdatabases (1)