Database | Proc | Application | Created | Links |
sybsystemprocs | sp_monitor_help | 31 Aug 14 | Defects Dependencies |
1 2 /* 3 ** This stored procedure is a subordinate stored procedure that is invoked by 4 ** the parent stored procedure sp_monitor when "help" is passed as the 5 ** argument. This stored procedure provides help related information pertaining 6 ** to all the parameters to sp_monitor. 7 ** The procedure provides Usage and Example information for each of the options 8 ** supported by sp_monitor. If "help" is sought without any additional parameter 9 ** then all the options are listed with examples. 10 ** 11 ** User can invoke the 'help' facility in one of two ways: 12 ** 13 ** sp_monitor 'help' 14 ** 15 ** This will produce 1st level of help information for each type of 16 ** entity that can be monitored. 17 ** 18 ** sp_monitor 'help', 'deadlock' ['deadlock' is only an example.] 19 ** 20 ** This produces a bit more detailed help information for the entity 21 ** being monitored. Currently, only few commands have extensive 22 ** help information built-in, which is produced under this usage. 23 ** 24 ** Parameters: 25 ** @cmdtype - The specific command for which help is required. 26 ** @listall - Indicate if help is required for all commands. 27 ** 0 : Brief info on each command 28 ** 1 : Verbose info on specific command 29 ** 2 : Verbose info on all commands 30 ** 31 ** Returns: 32 ** 0 - upon sucessful completion 33 { 34 */ 35 create procedure sp_monitor_help( 36 @cmdtype varchar(30) = NULL 37 , @listall int 38 ) as 39 begin 40 declare @sqlmsg varchar(255) -- varchar so as to truncate trailing blanks 41 , @monprocname varchar(256) 42 , @validcmd_names varchar(256) 43 44 -- Reuse variable to build list of monitoring types allowed. 45 -- 46 select @validcmd_names = "'enable' | 'disable' | 'connection' | 'procedure' | 'statement' | 'event' | 'deadlock' | 'procstack' | 'archive' | 'report'" 47 48 exec sp_getmessage 19263, @sqlmsg output 49 50 -- Fix this when @msg_19263 is updated in a major release. 51 select @sqlmsg = "Usage: %1! %2!" 52 53 if (@listall != 0) 54 begin 55 -- Show the possible optional arguments in help info. 56 select @monprocname = "[ " + @validcmd_names + " [, ...] ] " 57 print @sqlmsg, "sp_monitor", @monprocname 58 end 59 60 -- Show the syntax for the basic help command. 61 -- 62 if (@cmdtype = "HELP" OR @listall != 0) 63 begin 64 select @monprocname = "help " + "[, " + @validcmd_names + "]" 65 print @sqlmsg, "sp_monitor", @monprocname 66 print @sqlmsg, "sp_monitor", "help, 'all'" 67 end 68 69 if (@cmdtype = "CONNECTION" OR @listall != 0) 70 begin 71 select @sqlmsg = case @listall when 1 then 'terse' else 'verbose' end 72 , @monprocname = "sybsystemprocs.dbo.sp_monitor_connection_usage" 73 exec @monprocname @sqlmsg 74 end 75 if (@cmdtype = "EVENT" OR @listall != 0) 76 begin 77 print " " 78 exec sp_getmessage 19266, @sqlmsg output 79 print @sqlmsg 80 exec sp_getmessage 19267, @sqlmsg output 81 print @sqlmsg 82 end 83 84 if (@cmdtype = "PROCEDURE" OR @listall != 0) 85 begin 86 print " " 87 exec sp_getmessage 19268, @sqlmsg output 88 print @sqlmsg 89 exec sp_getmessage 19269, @sqlmsg output 90 print @sqlmsg 91 exec sp_getmessage 19280, @sqlmsg output 92 print @sqlmsg 93 exec sp_getmessage 19281, @sqlmsg output 94 print @sqlmsg 95 exec sp_getmessage 19282, @sqlmsg output 96 print @sqlmsg 97 end 98 99 if (@cmdtype = "ENABLE" OR @listall != 0) 100 begin 101 select @sqlmsg = case @listall when 1 then 'terse' else 'verbose' end 102 , @monprocname = "sybsystemprocs.dbo.sp_monitor_enable_usage" 103 exec @monprocname @sqlmsg, @validcmd_names 104 end 105 106 if (@cmdtype = "DISABLE" OR @listall != 0) 107 begin 108 select @sqlmsg = case @listall when 1 then 'terse' else 'verbose' end 109 , @monprocname = "sybsystemprocs.dbo.sp_monitor_disable_usage" 110 exec @monprocname @sqlmsg, @validcmd_names 111 end 112 113 if (@cmdtype = "STATEMENT" OR @listall != 0) 114 begin 115 print " " 116 exec sp_getmessage 19274, @sqlmsg output 117 print @sqlmsg 118 exec sp_getmessage 19275, @sqlmsg output 119 print @sqlmsg 120 end 121 122 select @sqlmsg = case @listall when 1 then 'terse' else 'verbose' end 123 124 if (@cmdtype = "DEADLOCK" OR @listall != 0) 125 begin 126 select @monprocname = "sybsystemprocs.dbo.sp_monitor_deadlock" 127 exec @monprocname 'help', @sqlmsg 128 end 129 130 if (@cmdtype = "PROCSTACK" OR @listall != 0) 131 begin 132 select @monprocname = "sybsystemprocs.dbo.sp_monitor_procstack_usage" 133 exec @monprocname @sqlmsg 134 end 135 136 if (@cmdtype = "ARCHIVE" OR @listall != 0) 137 begin 138 select @monprocname = "sybsystemprocs.dbo.sp_monitor_archive_usage" 139 exec @monprocname @sqlmsg 140 end 141 142 if (@cmdtype = "REPORT" OR @listall != 0) 143 begin 144 select @monprocname = "sybsystemprocs.dbo.sp_monitor_report_usage" 145 exec @monprocname @sqlmsg 146 end 147 return (0) 148 end -- } 149
exec sp_procxmode 'sp_monitor_help', 'AnyMode' go Grant Execute on sp_monitor_help to public go
DEFECTS | |
MBPA 6 Not a parameter of this proc sybsystemprocs..sp_monitor_connection_usage: parameter # 2 | 103 |
MBPA 6 Not a parameter of this proc sybsystemprocs..sp_monitor_connection_usage: parameter # 2 | 110 |
MBPA 6 Not a parameter of this proc sybsystemprocs..sp_monitor_connection_usage: parameter # 2 | 127 |
MTYP 4 Assignment type mismatch @output_type: varchar(10) = varchar(255) | 73 |
MTYP 4 Assignment type mismatch @output_type: varchar(10) = varchar(255) | 103 |
MTYP 4 Assignment type mismatch null = varchar(256) | 103 |
MTYP 4 Assignment type mismatch @output_type: varchar(10) = varchar(255) | 110 |
MTYP 4 Assignment type mismatch null = varchar(256) | 110 |
MTYP 4 Assignment type mismatch @arg2: varchar(30) = varchar(255) | 127 |
MTYP 4 Assignment type mismatch null = varchar(255) | 127 |
MTYP 4 Assignment type mismatch @arg1: varchar(30) = varchar(255) | 133 |
MTYP 4 Assignment type mismatch @output_type: varchar(10) = varchar(255) | 133 |
MTYP 4 Assignment type mismatch @output_type: varchar(8) = varchar(255) | 133 |
MTYP 4 Assignment type mismatch @arg1: varchar(30) = varchar(255) | 139 |
MTYP 4 Assignment type mismatch @output_type: varchar(10) = varchar(255) | 139 |
MTYP 4 Assignment type mismatch @output_type: varchar(8) = varchar(255) | 139 |
MTYP 4 Assignment type mismatch @arg1: varchar(30) = varchar(255) | 145 |
MTYP 4 Assignment type mismatch @output_type: varchar(10) = varchar(255) | 145 |
MTYP 4 Assignment type mismatch @output_type: varchar(8) = varchar(255) | 145 |
MGTP 3 Grant to public sybsystemprocs..sp_monitor_help | |
MNER 3 No Error Check should check return value of exec | 48 |
MNER 3 No Error Check should check return value of exec | 78 |
MNER 3 No Error Check should check return value of exec | 80 |
MNER 3 No Error Check should check return value of exec | 87 |
MNER 3 No Error Check should check return value of exec | 89 |
MNER 3 No Error Check should check return value of exec | 91 |
MNER 3 No Error Check should check return value of exec | 93 |
MNER 3 No Error Check should check return value of exec | 95 |
MNER 3 No Error Check should check return value of exec | 116 |
MNER 3 No Error Check should check return value of exec | 118 |
MUCO 3 Useless Code Useless Brackets in create proc | 35 |
MUCO 3 Useless Code Useless Begin-End Pair | 39 |
MUCO 3 Useless Code Useless Brackets | 53 |
MUCO 3 Useless Code Useless Brackets | 62 |
MUCO 3 Useless Code Useless Brackets | 69 |
MUCO 3 Useless Code Useless Brackets | 75 |
MUCO 3 Useless Code Useless Brackets | 84 |
MUCO 3 Useless Code Useless Brackets | 99 |
MUCO 3 Useless Code Useless Brackets | 106 |
MUCO 3 Useless Code Useless Brackets | 113 |
MUCO 3 Useless Code Useless Brackets | 124 |
MUCO 3 Useless Code Useless Brackets | 130 |
MUCO 3 Useless Code Useless Brackets | 136 |
MUCO 3 Useless Code Useless Brackets | 142 |
MUCO 3 Useless Code Useless Brackets | 147 |
MZMB 3 Zombie: use of non-existent object sybsystemprocs.dbo.sp_monitor_archive_usage | 0 |
MZMB 3 Zombie: use of non-existent object sybsystemprocs.dbo.sp_monitor_connection_usage | 0 |
MZMB 3 Zombie: use of non-existent object sybsystemprocs.dbo.sp_monitor_deadlock | 0 |
MZMB 3 Zombie: use of non-existent object sybsystemprocs.dbo.sp_monitor_disable_usage | 0 |
MZMB 3 Zombie: use of non-existent object sybsystemprocs.dbo.sp_monitor_enable_usage | 0 |
MZMB 3 Zombie: use of non-existent object sybsystemprocs.dbo.sp_monitor_procstack_usage | 0 |
MZMB 3 Zombie: use of non-existent object sybsystemprocs.dbo.sp_monitor_report_usage | 0 |
MDYE 2 Dynamic Exec Marker exec @monprocname | 73 |
MDYE 2 Dynamic Exec Marker exec @monprocname | 103 |
MDYE 2 Dynamic Exec Marker exec @monprocname | 110 |
MDYE 2 Dynamic Exec Marker exec @monprocname | 127 |
MDYE 2 Dynamic Exec Marker exec @monprocname | 133 |
MDYE 2 Dynamic Exec Marker exec @monprocname | 139 |
MDYE 2 Dynamic Exec Marker exec @monprocname | 145 |
MTR1 2 Metrics: Comments Ratio Comments: 33% | 35 |
MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 24 = 23dec - 1exi + 2 | 35 |
MTR3 2 Metrics: Query Complexity Complexity: 82 | 35 |
DEPENDENCIES |
PROCS AND TABLES USED calls proc sybsystemprocs..sp_getmessage reads table sybsystemprocs..sysusermessages reads table master..sysmessages (1) reads table master..syslanguages (1) calls proc sybsystemprocs..sp_validlang reads table master..syslanguages (1) |