DatabaseProcApplicationCreatedLinks
sybsystemprocssp_sysmon_analyze_mda  31 Aug 14Defects Dependencies

1     
2     /*
3     ** This sproc will be installed as a part of installmontables and is invoked
4     ** from sp_sysom
5     **
6     **	Messages for sp_sysmon_analyze_mda
7     **
8     ** 18291, "The parameter value '%1!' is invalid."
9     */
10    
11    create procedure sp_sysmon_analyze_mda
12        @seconds int,
13        @Reco char(1),
14        @section char(80),
15        @top_n varchar(14),
16        @filter varchar(255)
17    as
18    
19        /* ----------- declare local variables ---------- */
20        declare @status int /* hold sproc status codes */
21        declare @top_n_substr varchar(13) /* temporary sub string */
22        declare @first_char char(1) /* first character in 'top_n' */
23    
24        select @top_n_substr = substring(@top_n, 2, datalength(@top_n) - 1)
25        select @first_char = substring(@top_n, 1, 1)
26    
27        /*
28        ** There should be no non-numerals in the sub string consisting of
29        ** the input except the first character. First character must be a
30        ** numberal or a negative sign
31        */
32        if ((patindex("%[^0-9]%", @top_n_substr) > 0) or
33                (patindex("[-0-9]", @first_char) = 0))
34        begin
35            /*
36            ** 18291, "The parameter value '%1!' is invalid."
37            */
38            raiserror 18291, @top_n
39            return 1
40        end
41    
42        if @section = "cache wizard"
43        begin
44            exec @status = sp_sysmon_dcachestats @top_n, @filter, @seconds, @Reco
45            return @status
46        end
47        return 0
48    


exec sp_procxmode 'sp_sysmon_analyze_mda', 'AnyMode'
go

Grant Execute on sp_sysmon_analyze_mda to public
go
DEFECTS
 MGTP 3 Grant to public sybsystemprocs..sp_sysmon_analyze_mda  
 MLCH 3 Char type with length>30 char(80) 14
 MNER 3 No Error Check should check return value of exec 44
 MUCO 3 Useless Code Useless Brackets 32
 MTR1 2 Metrics: Comments Ratio Comments: 42% 11
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 2 = 3dec - 3exi + 2 11
 MTR3 2 Metrics: Query Complexity Complexity: 16 11

DEPENDENCIES
PROCS AND TABLES USED
calls proc sybsystemprocs..sp_sysmon_dcachestats  
   read_writes table tempdb..#recommendations_tab (1) 
   read_writes table tempdb..#tempcachedobjstats (1) 
   read_writes table tempdb..#tempcachestats (1) 
   read_writes table tempdb..#obj_details (1) 
   reads table master..syscurconfigs (1)  
   read_writes table tempdb..#syscacheconfig (1) 
   read_writes table tempdb..#tempobjstats (1) 
   read_writes table tempdb..#tempbufpoolstats (1) 
   reads table tempdb..#tempmonitors (1) 
   reads table master..sysconfigures (1)  

CALLERS
called by proc sybsystemprocs..sp_sysmon