DatabaseProcApplicationCreatedLinks
sybsystemprocssp_helpremotelogin  14 déc. 14Defects Propagation Dependencies

1     
2     /* Sccsid = "%Z% generic/sproc/%M% %I% %G%" */
3     /*	4.8	1.1	06/14/90	sproc/src/fixindex */
4     /*
5     ** Messages for "sp_helpremotelogin"    17680
6     **
7     ** 17680, "There are no remote servers defined."
8     ** 17681, "There are no remote logins for the remote server '%1!'."
9     ** 17682, "There are no remotelogins defined."
10    ** 17683, "There are no remote logins for '%1!'."
11    ** 17684, "There are no remote logins."
12    ** 17685, "There are no remote logins for '%1!' on remote server '%2!'."
13    ** 17686, "** mapped locally **"
14    ** 17687, "** use local name **"
15    ** 17661, "-- none --"
16    */
17    create or replace procedure sp_helpremotelogin
18        @remoteserver varchar(255) = NULL, /* remote server name */
19        @remotename varchar(255) = NULL /* remote login name */
20    as
21    
22        declare @msg varchar(1024)
23        declare @sptlang int
24        declare @len1 int, @len2 int, @len3 int
25    
26    
27        if @@trancount = 0
28        begin
29            set chained off
30        end
31    
32        set transaction isolation level 1
33    
34        set nocount on
35    
36        /*
37        **  If no server given, get 'em all.
38        */
39        if @remoteserver is null
40        begin
41            select @remoteserver = "%"
42        end
43    
44        else
45        begin
46            if not exists (select *
47                    from master.dbo.sysservers s,
48                        master.dbo.sysremotelogins r
49                    where s.srvid = r.remoteserverid
50                        and s.srvname like @remoteserver
51                        and s.srvid > 0)
52            begin
53                if @remoteserver = "%"
54                begin
55                    /* 17680, "There are no remote servers defined." */
56                    exec sp_getmessage 17680, @msg out
57                    print @msg
58                    return (1)
59                end
60    
61                /* 17681, "There are no remote logins for the remote server '%1!'." */
62                exec sp_getmessage 17681, @msg out
63                print @msg, @remoteserver
64                return (1)
65            end
66        end
67    
68        /*
69        **  If no remotename given, get 'em all.
70        */
71        if @remotename is null
72        begin
73            select @remotename = "%"
74        end
75    
76        else
77        begin
78            if not exists (select *
79                    from master.dbo.sysremotelogins
80                    where isnull(remoteusername, "") like @remotename)
81            begin
82                if @remotename = "%"
83                begin
84                    /* 17682, "There are no remotelogins defined." */
85                    exec sp_getmessage 17682, @msg out
86                    print @msg
87                    return (1)
88                end
89    
90                /* 17683, "There are no remote logins for '%1!'." */
91                exec sp_getmessage 17683, @msg out
92                print @msg, @remotename
93                return (1)
94            end
95        end
96    
97        /*
98        **  Check for empty results.
99        */
100       if not exists (select *
101               from master.dbo.sysremotelogins r, master.dbo.sysservers s
102               where isnull(r.remoteusername, "") like @remotename
103                   and s.srvid = r.remoteserverid
104                   and s.srvname like @remoteserver)
105       begin
106           if ((@remoteserver = '%') and (@remotename = '%'))
107               /* 17684, "There are no remote logins." */
108               exec sp_getmessage 17684, @msg out
109           else
110               /* 17685, "There are no remote logins for '%1!' on remote server '%2!'." */
111               exec sp_getmessage 17685, @msg out
112   
113           print @msg, @remotename, @remoteserver
114           return (1)
115       end
116   
117       /*
118       **  Select the information.
119       */
120       declare @maplocal varchar(22)
121       declare @uselocal varchar(22)
122   
123       /* 17686, "** mapped locally **" */
124       /* 17687, "** use local name **" */
125       exec sp_getmessage 17686, @maplocal out
126       exec sp_getmessage 17687, @uselocal out
127   
128       select @sptlang = @@langid
129   
130       if @@langid != 0
131       begin
132           if not exists (
133                   select * from master.dbo.sysmessages where error
134                       between 17070 and 17079
135                       and langid = @@langid)
136               select @sptlang = 0
137       end
138   
139   
140       if @sptlang = 0 /* us_english */
141       begin
142           select server = s.srvname,
143               remote_user_name = isnull(r.remoteusername, @maplocal),
144               local_user_name = isnull(suser_name(r.suid), @uselocal),
145               options = name
146           into #sprmtlogin1rs
147           from master.dbo.sysservers s, master.dbo.sysremotelogins r,
148               master.dbo.spt_values v
149           where s.srvid = r.remoteserverid
150               and s.srvname like @remoteserver
151               and s.srvid > 0
152               and isnull(r.remoteusername, "") like @remotename
153               and v.type = "F"
154               and v.number = r.status
155           exec sp_autoformat @fulltabname = #sprmtlogin1rs,
156               @orderby = "order by server, remote_user_name"
157           drop table #sprmtlogin1rs
158       end
159       else /* non us_english */
160       begin
161           select server = s.srvname,
162               remote_user_name = isnull(r.remoteusername, @maplocal),
163               local_user_name = isnull(suser_name(r.suid), @uselocal),
164               options = m.description
165           into #sprmtlogin2rs
166           from master.dbo.sysservers s, master.dbo.sysremotelogins r,
167               master.dbo.spt_values v, master.dbo.sysmessages m
168           where s.srvid = r.remoteserverid
169               and s.srvname like @remoteserver
170               and s.srvid > 0
171               and isnull(r.remoteusername, "") like @remotename
172               and v.type = "F"
173               and v.number = r.status
174               and v.msgnum = m.error
175               and m.langid = @sptlang
176           exec sp_autoformat @fulltabname = #sprmtlogin2rs,
177               @orderby = "order by server, remote_user_name"
178           drop table #sprmtlogin2rs
179       end
180       return (0)
181   


exec sp_procxmode 'sp_helpremotelogin', 'AnyMode'
go

Grant Execute on sp_helpremotelogin to public
go
DEFECTS
 MEST 4 Empty String will be replaced by Single Space 80
 MEST 4 Empty String will be replaced by Single Space 102
 MEST 4 Empty String will be replaced by Single Space 152
 MEST 4 Empty String will be replaced by Single Space 171
 MINU 4 Unique Index with nullable columns master..sysmessages master..sysmessages
 MINU 4 Unique Index with nullable columns master..sysremotelogins master..sysremotelogins
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: @fulltabname 155
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: @fulltabname 176
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: sysremotelogins.csysremotelogins unique clustered
(remoteserverid, remoteusername)
Intersection: {remoteusername}
80
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: sysremotelogins.csysremotelogins unique clustered
(remoteserverid, remoteusername)
Intersection: {remoteusername}
102
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: sysremotelogins.csysremotelogins unique clustered
(remoteserverid, remoteusername)
Intersection: {remoteusername}
152
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: sysremotelogins.csysremotelogins unique clustered
(remoteserverid, remoteusername)
Intersection: {remoteusername}
171
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 51
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 135
 QTYP 4 Comparison type mismatch smallint = int 135
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 151
 QTYP 4 Comparison type mismatch Comparison type mismatch: int vs smallint 154
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 170
 QTYP 4 Comparison type mismatch Comparison type mismatch: int vs smallint 173
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 175
 QTYP 4 Comparison type mismatch smallint = int 175
 TNOU 4 Table with no unique index master..spt_values master..spt_values
 MGTP 3 Grant to public master..spt_values  
 MGTP 3 Grant to public master..sysmessages  
 MGTP 3 Grant to public master..sysremotelogins  
 MGTP 3 Grant to public master..sysservers  
 MGTP 3 Grant to public sybsystemprocs..sp_helpremotelogin  
 MNER 3 No Error Check should check return value of exec 56
 MNER 3 No Error Check should check return value of exec 62
 MNER 3 No Error Check should check return value of exec 85
 MNER 3 No Error Check should check return value of exec 91
 MNER 3 No Error Check should check return value of exec 108
 MNER 3 No Error Check should check return value of exec 111
 MNER 3 No Error Check should check return value of exec 125
 MNER 3 No Error Check should check return value of exec 126
 MNER 3 No Error Check should check @@error after select into 142
 MNER 3 No Error Check should check return value of exec 155
 MNER 3 No Error Check should check @@error after select into 161
 MNER 3 No Error Check should check return value of exec 176
 MUCO 3 Useless Code Useless Brackets 58
 MUCO 3 Useless Code Useless Brackets 64
 MUCO 3 Useless Code Useless Brackets 87
 MUCO 3 Useless Code Useless Brackets 93
 MUCO 3 Useless Code Useless Brackets 106
 MUCO 3 Useless Code Useless Brackets 114
 MUCO 3 Useless Code Useless Brackets 180
 QCTC 3 Conditional Table Creation 142
 QCTC 3 Conditional Table Creation 161
 QISO 3 Set isolation level 32
 QNAJ 3 Not using ANSI Inner Join 47
 QNAJ 3 Not using ANSI Inner Join 101
 QNAJ 3 Not using ANSI Inner Join 147
 QNAJ 3 Not using ANSI Inner Join 166
 QNUA 3 Should use Alias: Column name should use alias v 145
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysmessages.ncsysmessages unique
(error, dlevel, langid)
Intersection: {error, langid}
133
 QPRI 3 Join or Sarg with Rooted Partial Index Use JOIN Candidate index: sysmessages.ncsysmessages unique
(error, dlevel, langid)
Intersection: {error}
Uncovered: [dlevel]
174
 VUNU 3 Variable is not used @len1 24
 VUNU 3 Variable is not used @len2 24
 VUNU 3 Variable is not used @len3 24
 MSUB 2 Subquery Marker 46
 MSUB 2 Subquery Marker 78
 MSUB 2 Subquery Marker 100
 MSUB 2 Subquery Marker 132
 MTR1 2 Metrics: Comments Ratio Comments: 25% 17
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 28 = 32dec - 6exi + 2 17
 MTR3 2 Metrics: Query Complexity Complexity: 101 17
 PRED_QUERY_COLLECTION 2 {r=master..sysremotelogins, s=master..sysservers} 0 46
 PRED_QUERY_COLLECTION 2 {r=master..sysremotelogins, s=master..sysservers} 0 100
 PRED_QUERY_COLLECTION 2 {r=master..sysremotelogins, s=master..sysservers, sv=master..spt_values} 0 142
 PRED_QUERY_COLLECTION 2 {m=master..sysmessages, r=master..sysremotelogins, s=master..sysservers, sv=master..spt_values} 0 161

DEPENDENCIES
PROCS AND TABLES USED
calls proc sybsystemprocs..sp_getmessage  
   calls proc sybsystemprocs..sp_validlang  
      reads table master..syslanguages (1)  
   reads table master..syslanguages (1)  
   reads table sybsystemprocs..sysusermessages  
   reads table master..sysmessages (1)  
reads table master..sysservers (1)  
reads table master..sysremotelogins (1)  
writes table tempdb..#sprmtlogin2rs (1) 
writes table tempdb..#sprmtlogin1rs (1) 
reads table master..spt_values (1)  
reads table master..sysmessages (1)  
calls proc sybsystemprocs..sp_autoformat  
   writes table sybsystemprocs..sp_autoformat_rset_002 
   writes table sybsystemprocs..sp_autoformat_rset_005 
   reads table master..systypes (1)  
   writes table sybsystemprocs..sp_autoformat_rset_004 
   calls proc sybsystemprocs..sp_autoformat  
   reads table master..syscolumns (1)  
   read_writes table tempdb..#colinfo_af (1) 
   calls proc sybsystemprocs..sp_namecrack  
   reads table tempdb..systypes (1)  
   writes table sybsystemprocs..sp_autoformat_rset_001 
   reads table tempdb..syscolumns (1)  
   writes table sybsystemprocs..sp_autoformat_rset_003