DatabaseProcApplicationCreatedLinks
sybsystemprocssp_spaceusage_showhelp  14 déc. 14Defects Propagation Dependencies

1     
2     /*
3     **	SP_SPACEUSAGE_SHOWHELP
4     **
5     **	The sub-procedure to print help/usage iformation for the sp_spaceusage
6     **	procedure. Called by sp_spaceusage.
7     **
8     **	Parameters
9     **		@helpaction 	- Action on which help is sought.
10    **		@helpentity	- Entity type on which help is sought.
11    **		@validactions	- The string containing all valid actions.
12    **		@validentities	- The string containing all valid entities.
13    **
14    **	Returns 
15    **		0 - always. Prints the usage information or error messge for
16    **		    invalid action/entity.
17    {
18    */
19    create or replace procedure sp_spaceusage_showhelp
20    (
21        @helpaction varchar(20)
22        , @helpentity varchar(12)
23        , @validactions varchar(75)
24        , @validentities varchar(30)
25    )
26    as
27        begin -- { 	-- procedure begins! 
28    
29            declare @procToCall varchar(50)
30                , @msg varchar(256)
31    
32            select @validactions = @validactions + ", 'all'"
33                , @helpaction = ltrim(rtrim(@helpaction))
34                , @helpentity = ltrim(rtrim(@helpentity))
35    
36            if @helpaction is NULL
37                or lower(@helpaction) in ("all", "help")
38            begin -- { generic help
39    
40                exec sp_getmessage 18954, @msg output
41                print @msg
42                print "sp_spaceusage 'help' [, 'all' ]"
43                print "sp_spaceusage 'help' [, {'display'|'display summary'|'report'|'report summary'|'archive'} [, {'table'|'index'|'tranlog'}]]"
44                print ""
45    
46                exec sp_getmessage 19541, @msg out
47                print @msg
48    
49                exec sp_getmessage 19563, @msg out
50                print @msg, "  -- "
51    
52                print "  sp_spaceusage 'help', 'display'"
53                print ""
54    
55                exec sp_getmessage 19564, @msg out
56                print @msg, "  -- "
57    
58                print "  sp_spaceusage 'help', 'report', 'index'"
59                print ""
60    
61                if lower(@helpaction) = "help"
62                    return (0)
63    
64                exec sp_getmessage 18954, @msg output
65                print @msg
66    
67                print "sp_spaceusage {'display'|'display summary'|'report'|'report summary'|'archive'}, {'table'|'index'} [,... ]"
68                print ""
69                print "sp_spaceusage {'display'|'report'|'archive'}, 'tranlog' [,{'syslogs'|NULL} [,... ]]"
70                print ""
71    
72                exec sp_getmessage 19592, @msg output
73                print @msg
74    
75                exec sp_getmessage 19593, @msg output
76                print @msg
77    
78                exec sp_getmessage 19565, @msg out
79                print @msg
80    
81                print ""
82                print "using { <using_item> [, <using_item> ] ... }"
83                print ""
84    
85                exec sp_getmessage 19566, @msg out
86                print @msg, "  -- "
87    
88                print "%1!<using_item> :: { unit={KB|MB|GB|PAGES} }"
89                    , "	"
90                print ""
91    
92                exec sp_getmessage 19567, @msg out
93                print @msg, "  -- "
94    
95                print "%1!<using_item> :: { unit={KB|MB|GB|PAGES} | dbname=<db> | prefix=<string> }"
96                    , "	"
97                print ""
98                print ""
99    
100               if lower(ltrim(rtrim(@helpaction))) = "all"
101                   exec sp_spaceusage_showhelp_all 1
102               else
103                   exec sp_spaceusage_showhelp_all 0
104   
105               return (0)
106   
107           end -- } generic help done!
108   
109           select @procToCall = "sp_spaceusage_showhelp_"
110   
111           if lower(@helpaction) in ("display", "display summary")
112           begin
113               select @procToCall = @procToCall + "display"
114           end
115           else if lower(@helpaction) = "archive"
116           begin
117               select @procToCall = @procToCall + "archive"
118           end
119           else if lower(@helpaction) in ("report", "report summary")
120           begin
121               select @procToCall = @procToCall + "report"
122           end
123           else
124           begin
125               raiserror 19194, @helpaction, @validactions
126               return (1)
127           end
128   
129           if @helpentity is not NULL
130               and lower(@helpentity) not in ("table", "index", "tranlog")
131           begin
132               raiserror 19194, @helpentity, @validentities
133               return (2)
134           end
135   
136           exec @procToCall @helpentity, 0
137   
138       end -- }	-- }
139   


exec sp_procxmode 'sp_spaceusage_showhelp', 'AnyMode'
go

Grant Execute on sp_spaceusage_showhelp to public
go
DEFECTS
 MEST 4 Empty String will be replaced by Single Space 44
 MEST 4 Empty String will be replaced by Single Space 53
 MEST 4 Empty String will be replaced by Single Space 59
 MEST 4 Empty String will be replaced by Single Space 68
 MEST 4 Empty String will be replaced by Single Space 70
 MEST 4 Empty String will be replaced by Single Space 81
 MEST 4 Empty String will be replaced by Single Space 83
 MEST 4 Empty String will be replaced by Single Space 90
 MEST 4 Empty String will be replaced by Single Space 97
 MEST 4 Empty String will be replaced by Single Space 98
 MGTP 3 Grant to public sybsystemprocs..sp_spaceusage_showhelp  
 MNER 3 No Error Check should check return value of exec 40
 MNER 3 No Error Check should check return value of exec 46
 MNER 3 No Error Check should check return value of exec 49
 MNER 3 No Error Check should check return value of exec 55
 MNER 3 No Error Check should check return value of exec 64
 MNER 3 No Error Check should check return value of exec 72
 MNER 3 No Error Check should check return value of exec 75
 MNER 3 No Error Check should check return value of exec 78
 MNER 3 No Error Check should check return value of exec 85
 MNER 3 No Error Check should check return value of exec 92
 MNER 3 No Error Check should check return value of exec 101
 MNER 3 No Error Check should check return value of exec 103
 MUCO 3 Useless Code Useless Brackets in create proc 20
 MUCO 3 Useless Code Useless Begin-End Pair 27
 MUCO 3 Useless Code Useless Brackets 62
 MUCO 3 Useless Code Useless Brackets 105
 MUCO 3 Useless Code Useless Brackets 126
 MUCO 3 Useless Code Useless Brackets 133
 MZMB 3 Zombie: use of non-existent object sybsystemprocs..sp_spaceusage_showhelp_ 0
 MDYE 2 Dynamic Exec Marker exec @procToCall 136
 MTR1 2 Metrics: Comments Ratio Comments: 16% 19
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 7 = 10dec - 5exi + 2 19
 MTR3 2 Metrics: Query Complexity Complexity: 71 19

DEPENDENCIES
PROCS AND TABLES USED
calls proc sybsystemprocs..sp_getmessage  
   reads table master..syslanguages (1)  
   calls proc sybsystemprocs..sp_validlang  
      reads table master..syslanguages (1)  
   reads table master..sysmessages (1)  
   reads table sybsystemprocs..sysusermessages  
calls proc sybsystemprocs..sp_spaceusage_showhelp_all  
   calls proc sybsystemprocs..sp_spaceusage_showhelp_report  
      calls proc sybsystemprocs..sp_getmessage  
   calls proc sybsystemprocs..sp_spaceusage_showhelp_display  
      calls proc sybsystemprocs..sp_getmessage  
   calls proc sybsystemprocs..sp_spaceusage_showhelp_archive  
      calls proc sybsystemprocs..sp_getmessage  

CALLERS
called by proc sybsystemprocs..sp_spaceusage