Database | Proc | Application | Created | Links |
sybsystemprocs | sp_showtext_usage | 31 Aug 14 | Defects Dependencies |
1 2 /* 3 ** ************************************************************************** 4 ** sp_showtext_usage 5 ** 6 ** Print help usage information for sp_showtext. 7 ** 8 ** Parameters: 9 ** Various args that are passed-in from caller. Essentially, hard-coded 10 ** string names such as 'linenumbers' etc., identifying various print 11 ** options. 12 { 13 */ 14 create procedure sp_showtext_usage( 15 @context_block int 16 , @opt_showsql varchar(7) 17 , @opt_linenumbers varchar(11) 18 , @opt_comments varchar(8) 19 , @opt_leftjustify varchar(11) 20 , @opt_rightjustify varchar(12) 21 , @opt_ddlgen varchar(6) 22 , @opt_context varchar(7) 23 , @opt_noparams varchar(8) 24 ) as 25 begin 26 declare @helptext varchar(30) 27 , @showtext_args varchar(80) 28 , @msg varchar(80) 29 , @msg_19263 varchar(10) 30 , @tabchar char(1) 31 , @newline char(1) 32 , @lineno int 33 , @context int 34 35 36 select @tabchar = char(9) 37 , @newline = char(10) 38 39 exec sp_getmessage 19263, @msg output 40 select @showtext_args = "<object name> " 41 + @newline 42 + @tabchar 43 + @tabchar 44 + "[, <start line> [, <number of lines> [, '<print options>'] ] ]" 45 , @msg_19263 = "Usage: %1! %2!" 46 47 print @msg_19263, "sp_helptext", @showtext_args 48 print " " 49 50 print " @objname - Name of compiled object local to current db." 51 print " @startline - Starting line number from which to generate SQL text" 52 print " @num_lines - Number of lines to print. If '%1!' is specified" 53 , @opt_context 54 print " in <print options>, treat this as the context block." 55 print " @printopts - Print options, see below." 56 print " @trace - Debugging traceflags for internal use." 57 58 print " " 59 print "<print options> is a comma-separated string of print option specifiers:" 60 print " %1! : Print formatted SQL for compiled object.", @opt_showsql 61 print " %1! : Print line numbers", @opt_linenumbers 62 print " %1! : Print line numbers in comments", @opt_comments 63 print " %1! : Generate script as a DDL script to recreate the object." 64 , @opt_ddlgen 65 print " %1! : Print <n> lines of context, starting from given starting line." 66 , @opt_context 67 print " %1! : Suppress parameter information in output." 68 , @opt_noparams 69 70 print " " 71 print "Examples:" 72 73 print " -- Basic usage, without line #s." 74 print " sp_helptext sp_helptext, NULL, NULL, '%1!'", @opt_showsql 75 print " " 76 77 print " -- Basic usage, with line #s right-justified." 78 print " sp_helptext sp_helptext, NULL, NULL, '%1!,%2!'" 79 , @opt_showsql, @opt_linenumbers 80 print " " 81 82 print " -- DDL script with line #s in comments." 83 print " -- (Can use 0 instead of NULL.)" 84 print " sp_helptext sp_helptext, 0, 0, '%1!, %2!, %3!'" 85 , @opt_showsql, @opt_linenumbers, @opt_comments 86 print " " 87 88 print " -- Show (default) context block of %1! lines starting from line 44", @context_block 89 print " sp_helptext sp_helptext, 44, NULL, '%1!, %2!'" 90 , @opt_showsql, @opt_context 91 print " " 92 93 print " -- Show context block of %1! lines starting from line 44", 10 94 print " sp_helptext sp_helptext, 44, %1!, '%2!, %3!'" 95 , 10, @opt_showsql, @opt_context 96 print " " 97 98 select @lineno = 102 99 , @context = 10 100 , @showtext_args = @opt_showsql 101 + ',' 102 + @opt_context 103 + ',' 104 + @opt_linenumbers 105 + ',' 106 + @opt_noparams 107 108 print " -- Show context block of %1! lines starting from line %2!, with linenumbers" 109 , @context, @lineno 110 111 print " sp_helptext sp_helptext, %1!, %2!, '%3!'" 112 , @lineno, @context, @showtext_args 113 114 print " " 115 print "Here is a sample output from the last command shown:" 116 print " " 117 select @helptext = 'sybsystemprocs.dbo.sp_helptext' 118 exec @helptext @helptext, @lineno, @context, @showtext_args 119 120 end -- } 121
exec sp_procxmode 'sp_showtext_usage', 'AnyMode' go Grant Execute on sp_showtext_usage to public go
DEFECTS | |
MGTP 3 Grant to public sybsystemprocs..sp_showtext_usage | |
MNER 3 No Error Check should check return value of exec | 39 |
MUCO 3 Useless Code Useless Brackets in create proc | 14 |
MUCO 3 Useless Code Useless Begin-End Pair | 25 |
MZMB 3 Zombie: use of non-existent object sybsystemprocs.dbo.sp_helptext | 0 |
VNRD 3 Variable is not read @msg | 39 |
VUNU 3 Variable is not used @opt_leftjustify | 19 |
VUNU 3 Variable is not used @opt_rightjustify | 20 |
MDYE 2 Dynamic Exec Marker exec @helptext | 118 |
MTR1 2 Metrics: Comments Ratio Comments: 8% | 14 |
MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 1 = 0dec - 1exi + 2 | 14 |
MTR3 2 Metrics: Query Complexity Complexity: 47 | 14 |
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) CALLERS called by proc sybsystemprocs..sp_showtext_output called by proc sybsystemprocs..sp_showtext called by proc sybsystemprocs..sp_helptext_usage called by proc sybsystemprocs..sp_helptext called by proc sybsystemprocs..sp_helptext called by proc sybsystemprocs..sp_showtext |