Database | Proc | Application | Created | Links |
sybsystemprocs | sp_showtext_print_line | 31 Aug 14 | Defects Dependencies |
1 2 /* 3 ** ************************************************************************** 4 ** sp_showtext_print_line 5 ** 6 ** Common procedure to output a line of text depending on user-provided 7 ** options of how to print. 8 ** 9 ** Parameters: 10 ** @print_lnumbers - Boolean whether to print line#s. 11 ** @right_just - Boolean; to right-justify line#s. 12 ** @print_lcomment - Print line#s in comment /* */ 13 ** @grep_ctxt - Boolean whether we are in a context search 14 ** @linenum - Line # of current line being output 15 ** @subtext - Piece of SQL sub-text extracted, to print. 16 ** @tagline - Code returned from sp_showtext_check_print 17 ** (2=>line is the tag line in context block.) 18 ** @trace - Trace flag user passed-in. 19 ** @trace_hang_for_debug - Trace flag under which to hang here to debug. 20 ** 21 { 22 */ 23 create procedure sp_showtext_print_line( 24 @print_lnumbers tinyint 25 , @right_just tinyint 26 , @print_lcomment tinyint 27 , @grep_ctxt tinyint 28 , @linenum int 29 , @subtext varchar(1024) 30 , @tagline int 31 , @trace int = 0 32 , @trace_hang_for_debug int 33 ) as 34 begin 35 declare @ln_varchar varchar(5) -- Big enough for line# 36 , @linenum_char char(5) -- Large enough for line#s 37 , @tabstop varchar(1) 38 , @tagmark char(4) 39 , @printfmt varchar(30) 40 41 select @tabstop = char(9) 42 , @linenum_char = space(5) 43 , @tagmark = case @tagline when 2 then " >>>" else "" end 44 45 if (@print_lnumbers != 0) 46 begin 47 select @ln_varchar = convert(varchar, @linenum) 48 49 -- Format line # in a char field, with left 50 -- or right-justification. 51 -- 52 select @linenum_char = 53 case @right_just 54 when 1 55 then 56 space(char_length(@linenum_char) 57 - char_length(@ln_varchar)) 58 else NULL 59 end 60 + @ln_varchar 61 62 select @printfmt = case @print_lcomment 63 when 1 then "/* %1! */%2!%3!%4!" 64 else "%1!%2!%3!%4!" 65 end 66 print @printfmt, @linenum_char 67 , @tagmark 68 , @tabstop 69 , @subtext 70 end 71 else 72 begin 73 select @printfmt = case @grep_ctxt 74 when 1 75 then case @tagline 76 when 2 then ">>> %1!" 77 else " %1!" 78 end 79 else "%1!" 80 end 81 print @printfmt, @subtext 82 end 83 84 -- Hang here, so that we can debug sp_procstack via the use 85 -- of this sproc. 86 if (@trace = @trace_hang_for_debug) 87 waitfor delay "0:0:10" 88 end /* } */ 89
exec sp_procxmode 'sp_showtext_print_line', 'AnyMode' go Grant Execute on sp_showtext_print_line to public go
DEFECTS | |
MEST 4 Empty String will be replaced by Single Space | 43 |
MGTP 3 Grant to public sybsystemprocs..sp_showtext_print_line | |
MUCO 3 Useless Code Useless Brackets in create proc | 23 |
MUCO 3 Useless Code Useless Begin-End Pair | 34 |
MUCO 3 Useless Code Useless Brackets | 45 |
MUCO 3 Useless Code Useless Brackets | 86 |
MTR1 2 Metrics: Comments Ratio Comments: 38% | 23 |
MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 3 = 2dec - 1exi + 2 | 23 |
MTR3 2 Metrics: Query Complexity Complexity: 14 | 23 |
DEPENDENCIES |
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 |