Database | Proc | Application | Created | Links |
sybsystemprocs | sp_showtext_check_print | 31 Aug 14 | Defects Dependencies |
1 2 /* 3 ** sp_showtext_check_print 4 ** 5 ** Check whether we should print this line. A line might need to be 6 ** printed depending on various parameters passed to the main sproc. 7 ** 8 ** . If we are not looking for a context block (grep_ctxt = 0), then a 9 ** line will be printed if all lines are requested (normal showtext 10 ** usage, where numlines_or_ctxt is 0), or if the current line is 11 ** within the # of lines requested (numlines_or_ctxt != 0). 12 ** 13 ** . If we are looking for a context block output (grep_ctxt != 0), 14 ** print the line if the current linenum is within the context block 15 ** (i.e. min_ctxt_linenum and max_ctxt_linenum). 16 ** 17 ** Parameters: 18 ** @startline - Starting line# to print from. 19 ** @numlines_or_ctxt - Number of lines to print, or context window. 20 ** @grep_ctxt - Whether we are in a context block print mode. 21 ** @min_ctxt_linenum - Line # of lower range of context block. 22 ** @max_ctxt_linenum - Line # of upper end of context block. 23 ** @linenum - Current line#. 24 ** @ddlgen - Whether DDL generation was requested. 25 ** 26 ** Returns: 27 ** 0 - We don't need to print this line. 28 ** 1 - Print this line. 29 ** 2 - Print this line, and this is the 'startline' 30 ** line (requested for context block). 31 { 32 */ 33 create procedure sp_showtext_check_print( 34 @startline int 35 , @numlines_or_ctxt int 36 , @grep_ctxt int 37 , @min_ctxt_linenum int 38 , @max_ctxt_linenum int 39 , @linenum int 40 , @gen_ddl int 41 ) as 42 begin 43 declare @retval int 44 45 select @retval = 0 -- default; don't print. 46 47 -- Option 'ddlgen' supersedes everything else. Line needs to be printed. 48 if (@gen_ddl != 0) 49 begin 50 select @retval = 1 51 end 52 else if (@grep_ctxt = 0) 53 begin 54 -- Print this line as follows: 55 -- ========= ======== ========= 56 -- startline Numlines Remark: 57 -- ========= ======== ========= 58 -- NULL (0) NULL (0) Print all lines 59 --NULL (0) Print all lines from line60 -- NULL (0)lines from line 0 62 -- 63 if ((@startline = 0) and (@numlines_or_ctxt = 0)) 64 select @retval = 1 65 66 else if ((@numlines_or_ctxt = 0) and (@linenum >= @startline)) 67 select @retval = 1 68 69 else if (@linenum between @startline 70 and (@startline + @numlines_or_ctxt - 1)) 71 select @retval = 1 72 end 73 else if (@linenum between @min_ctxt_linenum and @max_ctxt_linenum) 74 begin 75 select @retval = case @linenum 76 when @startline then 2 77 else 1 78 end 79 end 80 return @retval 81 end -- } 82lines from line
exec sp_procxmode 'sp_showtext_check_print', 'AnyMode' go Grant Execute on sp_showtext_check_print to public go
DEFECTS | |
MGTP 3 Grant to public sybsystemprocs..sp_showtext_check_print | |
MUCO 3 Useless Code Useless Brackets in create proc | 33 |
MUCO 3 Useless Code Useless Begin-End Pair | 42 |
MUCO 3 Useless Code Useless Brackets | 48 |
MUCO 3 Useless Code Useless Brackets | 52 |
MUCO 3 Useless Code Useless Brackets | 63 |
MUCO 3 Useless Code Useless Brackets | 66 |
MUCO 3 Useless Code Useless Brackets | 69 |
MUCO 3 Useless Code Useless Brackets | 73 |
MTR1 2 Metrics: Comments Ratio Comments: 63% | 33 |
MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 11 = 10dec - 1exi + 2 | 33 |
MTR3 2 Metrics: Query Complexity Complexity: 23 | 33 |
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 |