DatabaseProcApplicationCreatedLinks
sybsystemprocssp_helplanguage  31 Aug 14Defects Dependencies

1     
2     /* Sccsid = "%Z% generic/sproc/src/%M% %I% %G%" */
3     /*	4.8	1.1	06/14/90	sproc/src/fixindex */
4     /*
5     ** Messages for "sp_helplanguage"       17670
6     **
7     ** 17201, "'%1!' is not an official language name from Syslanguages."
8     ** 17670, "No alternate languages are available."
9     ** 17671, "us_english is always available, even though it is not in
10    **	master.dbo.syslanguages."
11    */
12    create procedure sp_helplanguage
13        @language varchar(255) = NULL
14    as
15    
16        declare @msg varchar(1024)
17        declare @retval int
18    
19    
20        if @@trancount = 0
21        begin
22            set chained off
23        end
24    
25        set transaction isolation level 1
26    
27        /* Print all languages if the user didn't give the language name. */
28        if @language is null
29        begin
30            if exists (select * from master.dbo.syslanguages)
31            begin
32                /* Adaptive Server has expanded all '*' elements in the following statement */ select master.dbo.syslanguages.langid, master.dbo.syslanguages.dateformat, master.dbo.syslanguages.datefirst, master.dbo.syslanguages.upgrade, master.dbo.syslanguages.name, master.dbo.syslanguages.alias, master.dbo.syslanguages.months, master.dbo.syslanguages.shortmonths, master.dbo.syslanguages.days into #syslanguages1 from master.dbo.syslanguages
33                exec @retval = sp_autoformat #syslanguages1
34                drop table #syslanguages1
35                if (@retval != 0)
36                    return 1
37            end
38            else
39            begin
40                /* 17670, "No alternate languages are available." */
41                exec sp_getmessage 17670, @msg out
42                print @msg
43            end
44    
45            /* Find out whether us_english is there or not. */
46            if not exists (select * from master.dbo.syslanguages
47                    where name = 'us_english')
48            begin
49                /* 
50                ** 17671, "us_english is always available, even though it
51                ** is not in master.dbo.syslanguages."
52                */
53                exec sp_getmessage 17671, @msg out
54                print @msg
55            end
56            return 0
57        end
58    
59        /*  Report information on this language. */
60        if exists (select * from master.dbo.syslanguages
61                where name = @language)
62        begin
63            /* Adaptive Server has expanded all '*' elements in the following statement */ select master.dbo.syslanguages.langid, master.dbo.syslanguages.dateformat, master.dbo.syslanguages.datefirst, master.dbo.syslanguages.upgrade, master.dbo.syslanguages.name, master.dbo.syslanguages.alias, master.dbo.syslanguages.months, master.dbo.syslanguages.shortmonths, master.dbo.syslanguages.days into #syslanguages2 from master.dbo.syslanguages
64            where name = @language
65            exec @retval = sp_autoformat #syslanguages2
66            drop table #syslanguages2
67            if (@retval != 0)
68                return 1
69    
70            return 0
71        end
72    
73        if exists (select * from master.dbo.syslanguages
74                where alias = @language)
75        begin
76            /* Adaptive Server has expanded all '*' elements in the following statement */ select master.dbo.syslanguages.langid, master.dbo.syslanguages.dateformat, master.dbo.syslanguages.datefirst, master.dbo.syslanguages.upgrade, master.dbo.syslanguages.name, master.dbo.syslanguages.alias, master.dbo.syslanguages.months, master.dbo.syslanguages.shortmonths, master.dbo.syslanguages.days into #syslanguages3 from master.dbo.syslanguages
77            where alias = @language
78            exec @retval = sp_autoformat #syslanguages3
79            drop table #syslanguages3
80            if (@retval != 0)
81                return 1
82    
83            return 0
84        end
85    
86        /* Couldn't find this language. */
87        if @language = 'us_english'
88        begin
89            /* 
90            ** 17671, "us_english is always available, even though it is not in
91            ** 	master.dbo.syslanguages." 
92            */
93            exec sp_getmessage 17671, @msg out
94            print @msg
95            return 0
96        end
97        else
98        begin
99            /* 17201, "'%1!' is not an official language name from Syslanguages." */
100           raiserror 17201, @language
101           return 1
102       end
103   


exec sp_procxmode 'sp_helplanguage', 'AnyMode'
go

Grant Execute on sp_helplanguage to public
go
DEFECTS
 MINU 4 Unique Index with nullable columns master..syslanguages master..syslanguages
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: parameter # 1 33
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: parameter # 1 65
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: parameter # 1 78
 MGTP 3 Grant to public master..syslanguages  
 MGTP 3 Grant to public sybsystemprocs..sp_helplanguage  
 MNER 3 No Error Check should check @@error after select into 32
 MNER 3 No Error Check should check return value of exec 33
 MNER 3 No Error Check should check return value of exec 41
 MNER 3 No Error Check should check return value of exec 53
 MNER 3 No Error Check should check @@error after select into 63
 MNER 3 No Error Check should check return value of exec 65
 MNER 3 No Error Check should check @@error after select into 76
 MNER 3 No Error Check should check return value of exec 78
 MNER 3 No Error Check should check return value of exec 93
 MUCO 3 Useless Code Useless Brackets 35
 MUCO 3 Useless Code Useless Brackets 67
 MUCO 3 Useless Code Useless Brackets 80
 QCTC 3 Conditional Table Creation 32
 QCTC 3 Conditional Table Creation 63
 QCTC 3 Conditional Table Creation 76
 QISO 3 Set isolation level 25
 MSUB 2 Subquery Marker 46
 MSUB 2 Subquery Marker 60
 MSUB 2 Subquery Marker 73
 MTR1 2 Metrics: Comments Ratio Comments: 30% 12
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 3 = 10dec - 9exi + 2 12
 MTR3 2 Metrics: Query Complexity Complexity: 64 12

DEPENDENCIES
PROCS AND TABLES USED
calls proc sybsystemprocs..sp_autoformat  
   reads table master..systypes (1)  
   reads table tempdb..syscolumns (1)  
   read_writes table tempdb..#colinfo_af (1) 
   calls proc sybsystemprocs..sp_autoformat  
   reads table master..syscolumns (1)  
   reads table tempdb..systypes (1)  
   calls proc sybsystemprocs..sp_namecrack  
calls proc sybsystemprocs..sp_getmessage  
   reads table sybsystemprocs..sysusermessages  
   reads table master..sysmessages (1)  
   calls proc sybsystemprocs..sp_validlang  
      reads table master..syslanguages (1)  
   reads table master..syslanguages (1)  
writes table tempdb..#syslanguages2 (1) 
writes table tempdb..#syslanguages3 (1) 
reads table master..syslanguages (1)  
writes table tempdb..#syslanguages1 (1)