DatabaseProcApplicationCreatedLinks
sybsystemprocssp_flushmetrics  14 déc. 14Defects Propagation Dependencies

1     
2     /*
3     ** sp_flushmetrics
4     **
5     ** Dump metrics in memory to system catalog
6     ** Requires Galaxy or later
7     **
8     */
9     
10    create or replace procedure sp_flushmetrics
11    as
12    
13        declare @nullarg char(1)
14        declare @dummy int
15        declare @status int
16        declare @gp_enabled int
17    
18        if @@trancount = 0
19        begin
20            set chained off
21        end
22    
23        set transaction isolation level 1
24    
25        /*
26        ** If granular permissions is not enabled sa_role is required by dbcc 
27        ** flushmetrics so we will check for sa_role here.
28        ** If granular permissions is enabled then the permission 
29        ** 'monitor qp performance' is required.  proc_role and proc_auditperm will 
30        ** also do auditing if required. Both will print an error message if 
31        ** required.
32        */
33    
34        select @nullarg = NULL
35        execute @status = sp_aux_checkroleperm "sa_role", "monitor qp performance",
36            @nullarg, @gp_enabled output
37    
38        /* For Auditing */
39        if (@gp_enabled = 0)
40        begin
41            select @dummy = proc_role("sa_role")
42        end
43        else
44        begin
45            select @dummy = proc_auditperm("monitor qp performance", @status)
46        end
47        if (@status != 0)
48        begin
49            return (1)
50        end
51    
52        dbcc traceon(3604)
53        dbcc flushmetrics
54        dbcc traceoff(3604)
55    
56        return (0)
57    


exec sp_procxmode 'sp_flushmetrics', 'AnyMode'
go

Grant Execute on sp_flushmetrics to public
go
DEFECTS
 MGTP 3 Grant to public sybsystemprocs..sp_flushmetrics  
 MUCO 3 Useless Code Useless Brackets 39
 MUCO 3 Useless Code Useless Brackets 47
 MUCO 3 Useless Code Useless Brackets 49
 MUCO 3 Useless Code Useless Brackets 56
 QISO 3 Set isolation level 23
 VNRD 3 Variable is not read @dummy 45
 MTR1 2 Metrics: Comments Ratio Comments: 36% 10
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 4 = 4dec - 2exi + 2 10
 MTR3 2 Metrics: Query Complexity Complexity: 22 10

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

CALLERS
called by proc sybsystemprocs..sp_metrics