DatabaseProcApplicationCreatedLinks
sybsystemprocssp_inst15015msg_oth_mesg  14 déc. 14Defects Propagation Dependencies

1     
2     /*                      --------------------------------                      */
3     /* ====================        DONE WITH SQL TEXT        ==================== */
4     /* ==================== BEGIN ACTUAL CODE FOR new_msgs() ==================== */
5     /*                      --------------------------------                      */
6     
7     /*
8     ** SP_INST15015MSG_OTH_MESG
9     **
10    ** Description:
11    **	sproc to install other msgs.
12    **
13    ** Parameter:
14    **      @error
15    **	@message
16    **	@langname
17    **
18    **
19    */
20    create or replace procedure sp_inst15015msg_oth_mesg
21    (
22        @error int, /* Error being installed. */
23        @message varchar(255), /* Text of new message. */
24        @langname varchar(255) /* language name */
25    )
26    as
27    
28        /* Variable declarations */
29        declare @retval int /* return value */
30        declare @msg varchar(255)
31        declare @langid int
32    
33    
34        set nocount on
35        select @retval = 0
36        select @langid = langid from master.dbo.syslanguages where name = @langname
37        if (@message = "delete")
38        begin
39            select @langid = langid from master.dbo.syslanguages
40            if @langid is NULL
41            begin
42                select @msg = "No languages installed"
43                print @msg
44                return 0
45            end
46        end
47        else
48        begin
49            select @langid = langid from master.dbo.syslanguages where name = @langname
50            if @langid is NULL
51            begin
52                select @msg = convert(varchar(8), @langname) + " language is not installed"
53                print @msg
54                return 0
55            end
56        end
57        exec @retval = sp_inst15015msg_addlimsg @error, @message, @langid
58    
59        if @retval = 1
60        begin
61            select @msg = "Added Message #" + convert(varchar(6), @error) + " for " + @langname + " language"
62        end
63        else if @retval = 2
64        begin
65            select @msg = "Updated Error #" + convert(varchar(6), @error) + " for " + @langname + " language"
66        end
67        else if @retval = 3
68        begin
69            select @msg = "Message #" + convert(varchar(6), @error) + " not found in database for delete for" + @langname + " language"
70        end
71        else if @retval = 4
72        begin
73            select @msg = "Deleted localized versions of message #" + convert(varchar(6), @error)
74        end
75        else if @retval = 5
76        begin
77            select @msg = "Deleted localized versions of message #" + convert(varchar(6), @error)
78        end
79        else if @retval = 6
80        begin
81            select @msg = "Format count of + @langname" + " message #" + convert(varchar(6), @error) + " does not match English message"
82        end
83        else if @retval = 7
84        begin
85            select @msg = "English Message Not found for + message #" + convert(varchar(6), @error)
86        end
87        else if @retval = 8
88        begin
89            select @msg = "Insert failed for message #" + convert(varchar(6), @error) + " for " + @langname + " language"
90        end
91        else if @retval = 9
92        begin
93            select @msg = "Update failed for message #" + convert(varchar(6), @error) + " for " + @langname + " language"
94        end
95        else if @retval = 10
96        begin
97            select @msg = "Delete failed for message #" + convert(varchar(6), @error) + " for " + @langname + " language"
98        end
99        else if @retval = 11
100       begin
101           select @msg = "Skipped parameter number in message #" + convert(varchar(6), @error) + " for " + @langname + " language"
102       end
103       else if @retval = 12
104       begin
105           select @msg = "Illegal parameter 0 found in message #" + convert(varchar(6), @error) + " for " + @langname + " language"
106       end
107       else if @retval = 13
108       begin
109           select @msg = "Duplicate parameter found in message #" + convert(varchar(6), @error) + " for " + @langname + " language"
110       end
111       else if @retval = 14
112       begin
113           select @msg = "English message is corrupted for message #" + convert(varchar(6), @error)
114       end
115       else
116       begin
117           select @msg = "Bad return code"
118       end
119       print @msg
120   

DEFECTS
 MINU 4 Unique Index with nullable columns master..syslanguages master..syslanguages
 MGTP 3 Grant to public master..syslanguages  
 MUCO 3 Useless Code Useless Brackets in create proc 21
 MUCO 3 Useless Code Useless Brackets 37
 QAFM 3 Var Assignment from potentially many rows 39
 MTR1 2 Metrics: Comments Ratio Comments: 15% 20
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 17 = 18dec - 3exi + 2 20
 MTR3 2 Metrics: Query Complexity Complexity: 71 20

DEPENDENCIES
PROCS AND TABLES USED
calls proc sybsystemprocs..sp_inst15015msg_addlimsg  
   read_writes table master..sysmessages (1)  
reads table master..syslanguages (1)  

CALLERS
called by proc sybsystemprocs..sp_inst15015msg_all_oth_mesgs  
   called by proc sybsystemprocs..sp_inst15015msg  
      called by proc sybsystemprocs..sp_downgrade