DatabaseProcApplicationCreatedLinks
sybsystemprocssp_ddlgen_help  14 déc. 14Defects Propagation Dependencies

1     
2     /*
3     ** sp_ddlgen_help
4     **
5     **	Generate usage/help information for this sproc interface.
6     **
7     ** Parameters:
8     **	@objtype	- Type of object to get more help on using sp_ddlgen.
9     */
10    create or replace procedure sp_ddlgen_help(
11        @objtype varchar(30) = NULL
12        , @valid_objtypes varchar(256) = NULL
13    ) as
14        begin
15            declare @msg varchar(256)
16                , @usage varchar(10)
17    
18            exec sp_getmessage 18954, @usage output
19    
20            -- If user didn't request for a particular object type, generate
21            -- basic help information.
22            --
23            if (@objtype IS NULL)
24            begin
25                select @msg = @usage + " sp_ddlgen [ 'help' ]"
26                print @msg
27    
28                -- Show basic help usage info.
29                select @msg = @usage + " sp_ddlgen 'help' [, %1! ]"
30                print @msg, @valid_objtypes
31    
32                -- Show basic ddl gen usage for all object types.
33                select @msg = @usage + " sp_ddlgen {" + @valid_objtypes + '}'
34                    + ", @objname"
35                print @msg
36    
37                return 0
38            end
39    
40            -- Generate usage information for each object type.
41            --
42            if (@objtype = 'database')
43            begin
44                select @msg = @usage + " sp_ddlgen 'database' [, @dbname ]"
45                print @msg
46    
47                -- Show individual examples...
48                select @msg = @usage + " sp_ddlgen 'database'"
49                print @msg
50    
51                select @msg = @usage + " sp_ddlgen 'database', 'master'"
52                print @msg
53    
54                select @msg = @usage + " sp_ddlgen 'database', 'mydb%%'"
55                print @msg
56    
57                select @msg = @usage + " sp_ddlgen 'database', '%%'"
58                print @msg
59            end
60            else
61            begin
62                raiserror 19194, @objtype, @valid_objtypes
63                return 1
64            end
65    
66    
67            return 0
68        end
69    


exec sp_procxmode 'sp_ddlgen_help', 'AnyMode'
go

Grant Execute on sp_ddlgen_help to public
go
DEFECTS
 MGTP 3 Grant to public sybsystemprocs..sp_ddlgen_help  
 MNER 3 No Error Check should check return value of exec 18
 MUCO 3 Useless Code Useless Brackets in create proc 10
 MUCO 3 Useless Code Useless Begin-End Pair 14
 MUCO 3 Useless Code Useless Brackets 23
 MUCO 3 Useless Code Useless Brackets 42
 MTR1 2 Metrics: Comments Ratio Comments: 27% 10
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 2 = 3dec - 3exi + 2 10
 MTR3 2 Metrics: Query Complexity Complexity: 27 10

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