DatabaseProcApplicationCreatedLinks
sybsystemprocssp_create_syscoordinations  14 déc. 14Defects Propagation Dependencies

1     
2     
3     /*
4     ** This procedure creates syscoordinations system table. It must be
5     ** executed from sybsystemdb database only. If executed from any other
6     ** database, the create will return with an appropriate message.
7     **
8     ** This stored procedure must not be modified, unless the changes are
9     ** reflected in syscoordinations manager and upgrade.
10    */
11    
12    /*
13    ** Messages for "sp_create_syscoordinations"
14    **
15    ** 17260, "Can't run %1! from within a transaction."
16    */
17    
18    create or replace procedure sp_create_syscoordinations as
19        begin
20    
21            declare @nullarg char(1)
22            declare @dummy int
23            declare @status int
24            declare @gp_enabled int
25    
26    
27            if @@trancount > 0
28            begin
29                /* 17260, "Can't run %1! from within a transaction." */
30                raiserror 17260, "sp_create_syscoordinations"
31                return (1)
32            end
33    
34            /* 
35            ** If granular permissions is not enabled then sa_role is required.
36            ** If granular permissions is enabled then the permission 
37            ** 'own any database' is required.  proc_role and proc_auditperm will 
38            ** also do auditing if required. Both will also print error message if 
39            ** required.
40            */
41    
42            select @nullarg = NULL
43            execute @status = sp_aux_checkroleperm "sa_role", "own any database",
44                @nullarg, @gp_enabled output
45    
46            /* For Auditing */
47            if (@gp_enabled = 0)
48            begin
49                if (proc_role("sa_role") = 0)
50                    return (1)
51            end
52            else
53            begin
54                select @dummy = proc_auditperm("own any database", @status)
55            end
56    
57            if (@status != 0)
58                return (1)
59    
60            dbcc astc("crtcoord")
61    
62            if (@@error != 0)
63                return (1)
64            else
65                return (0)
66    
67        end
68    


exec sp_procxmode 'sp_create_syscoordinations', 'AnyMode'
go

Grant Execute on sp_create_syscoordinations to public
go
DEFECTS
 MGTP 3 Grant to public sybsystemprocs..sp_create_syscoordinations  
 MUCO 3 Useless Code Useless Begin-End Pair 19
 MUCO 3 Useless Code Useless Brackets 31
 MUCO 3 Useless Code Useless Brackets 47
 MUCO 3 Useless Code Useless Brackets 49
 MUCO 3 Useless Code Useless Brackets 50
 MUCO 3 Useless Code Useless Brackets 57
 MUCO 3 Useless Code Useless Brackets 58
 MUCO 3 Useless Code Useless Brackets 62
 MUCO 3 Useless Code Useless Brackets 63
 MUCO 3 Useless Code Useless Brackets 65
 VNRD 3 Variable is not read @dummy 54
 MTR1 2 Metrics: Comments Ratio Comments: 51% 18
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 5 = 6dec - 3exi + 2 18
 MTR3 2 Metrics: Query Complexity Complexity: 25 18

DEPENDENCIES
PROCS AND TABLES USED
calls proc sybsystemprocs..sp_aux_checkroleperm  
   reads table master..syscurconfigs (1)  
   reads table master..sysconfigures (1)