DatabaseProcApplicationCreatedLinks
sybsystemprocssp_monitor_deadlock_getopts  14 déc. 14Defects Propagation Dependencies

1     
2     /*
3     ** sp_monitor_deadlock_getopts
4     **
5     **	Extract the individual options from a comma-separated print options
6     **	string, and set local output variables to pass back to the caller.
7     **
8     ** Parameters:
9     **	@output			- User-specified output options.
10    **	@opt_verbose_str	- Name of verbose option
11    **	@opt_pagediag_str	- Name of page diagnostics option
12    **	@opt_verbose		- If verbose option was requested.
13    **	@opt_pagediag		- If page diagnostics was requested.
14    {
15    */
16    create or replace procedure sp_monitor_deadlock_getopts(
17        @output varchar(30)
18        , @opt_verbose_str varchar(7)
19        , @opt_pagediag_str varchar(8)
20        , @opt_verbose int = 0 output
21        , @opt_pagediag int = 0 output
22    ) as
23        begin
24            declare @opt_sep char(1)
25                , @sep_index int
26                , @option_item varchar(30)
27                , @option_found int
28                , @valid_options varchar(30)
29    
30            if (@output IS NULL)
31                return 0
32    
33            -- Extract each comma-separated output option.
34            select @opt_sep = ','
35            while (1 = 1)
36            begin
37                exec @option_found = sp_getopts @output
38                    , @opt_sep
39                    , @option_item output
40                    , @output output
41                if (@option_found = 0)
42                    return 0
43    
44                -- Decode option specified and set local variable.
45                --
46                if (@option_item = @opt_verbose_str)
47                    select @opt_verbose = 1
48    
49                else if (@option_item = @opt_pagediag_str)
50                    select @opt_pagediag = 1
51    
52                else
53                begin
54                    -- Build list of valid print options.
55                    select @valid_options = @opt_verbose_str
56                        + @opt_sep
57                        + @opt_pagediag_str
58    
59                    raiserror 18640, "print", @option_item, @valid_options
60                    return 1
61                end
62            end
63    
64            return 0
65    
66        end -- }
67        if (@@error != 0) select syb_quit()
68    

RESULT SETS
sp_monitor_deadlock_getopts_rset_001

DEFECTS
 MURC 6 Unreachable Code 67
 MUCO 3 Useless Code Useless Brackets in create proc 16
 MUCO 3 Useless Code Useless Begin-End Pair 23
 MUCO 3 Useless Code Useless Brackets 30
 MUCO 3 Useless Code Useless Brackets 35
 MUCO 3 Useless Code Useless Brackets 41
 MUCO 3 Useless Code Useless Brackets 46
 MUCO 3 Useless Code Useless Brackets 49
 MUCO 3 Useless Code Useless Brackets 67
 QCRS 3 Conditional Result Set 67
 QNAM 3 Select expression has no name syb_quit() 67
 VUNU 3 Variable is not used @sep_index 25
 MRST 2 Result Set Marker 67
 MTR1 2 Metrics: Comments Ratio Comments: 33% 16
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 6 = 7dec - 3exi + 2 16
 MTR3 2 Metrics: Query Complexity Complexity: 25 16

DEPENDENCIES
PROCS AND TABLES USED
writes table sybsystemprocs..sp_monitor_deadlock_getopts_rset_001 
calls proc sybsystemprocs..sp_getopts  

CALLERS
called by proc sybsystemprocs..sp_monitor_deadlock  
   called by proc sybsystemprocs..sp_monitor