DatabaseProcApplicationCreatedLinks
sybsystemprocssp_rjs_register  14 déc. 14Defects Propagation Dependencies

1     
2     /* Sccsid = "%Z% generic/sproc/%M% %I% %G% */
3     
4     /*
5     ** Messages for "sp_rjs_register"
6     **
7     ** 17260, "Can't run %1! from within a transaction."
8     ** 19364, "'%1!' is not a valid value for a server name."
9     ** 19365, "A Job Scheduler server name is required; enter the name of the server with JS installed that you want to register."
10    ** 19367, "A host name is required when registering a Job Scheduler server."
11    ** 19368, "A host port number is required when registering a Job Scheduler server." 
12    ** 19372, "A host port number can not be negative. Enter a valid port number."
13    */
14    
15    create or replace procedure sp_rjs_register
16        @js_server varchar(255), /* name of js server */
17        @host_name varchar(255), /* name of machine hosting JS server */
18        @host_port int /* server access port on host */
19    as
20        begin
21    
22            /*
23            **  If we're in a transaction, disallow this since it might make recovery
24            **  impossible.
25            */
26    
27            if @@trancount > 0
28            begin
29                /*
30                ** 17260, "Can't run %1! from within a transaction."
31                */
32                raiserror 17260, "sp_rjs_register"
33                return (1)
34            end
35            else
36            begin
37                /* Use TSQL mode of unchained transactions */
38                set chained off
39            end
40    
41            /* Dont do "Dirty Reads" */
42            set transaction isolation level 1
43    
44            /*
45            ** Check to see that the input params are correct and then hook up with
46            ** sysattributes table to enter data.
47            */
48            if ((@js_server is NULL) OR (@js_server = ""))
49            begin
50                /*
51                ** 19365, "A Job Scheduler server name is required; enter the name of the server with JS installed that you want to register."
52                **/
53                raiserror 19365
54                return (1)
55            end
56            else
57            begin
58                if valid_name(@js_server) = 0
59                begin
60                    /*
61                    ** 19364, "'%1!' is not a valid value for a server name."
62                    **/
63                    raiserror 19364, @js_server
64                    return (1)
65                end
66            end
67    
68            if ((@host_name is NULL) OR (@host_name = ""))
69            begin
70                /*
71                ** 19367, 
72                ** "A host name is required when registering a Job Scheduler server."
73                **/
74                raiserror 19367
75                return (1)
76            end
77    
78            if ((@host_port is NULL) OR (@host_port = 0))
79            begin
80                /*
81                ** 19368, "A host port number is required when registering a Job Scheduler server." 
82                **/
83                raiserror 19368
84                return (1)
85            end
86            else
87            begin
88                if (@host_port < 0)
89                begin
90                    /*
91                    ** 19372, "A host port number can not be negative. Enter a valid port number."
92                    **/
93                    raiserror 19372
94                    return (1)
95                end
96            end
97    
98            /* 
99            ** Start a transaction so we don't lose the current JS server if the new
100           ** one isn't created.
101           */
102           begin tran rjs_register
103   
104           /* 
105           ** Remove any existing row before inserting 
106           ** This statement must be deleted when multiple JS servers can be
107           ** registered.
108           */
109           if exists (select 1 from master.dbo.sysattributes where class = 22)
110               delete from master.dbo.sysattributes
111               where class = 22 and attribute = 1 and object_type = "JS"
112   
113           /*
114           ** The following sysattribute columns hold the corresponding data for
115           ** a registered JS:
116           **
117           **     object_type: JS
118           **     object_cinfo: ASE server name
119           **     char_value: host name
120           **     int_value: host port
121           **
122           ** Note:  in future, if we want to register more than one Job Scheduler
123           **        server, we have a natural key in object_cinfo (@js_server), 
124           **        char_value (@host_name) and int_value (host_port).
125           */
126           insert master.dbo.sysattributes(class, attribute, object_type,
127               object_cinfo, char_value, int_value)
128           values (22, 1, "JS",
129               @js_server, @host_name, @host_port)
130           if ((@@error != 0) OR (@@rowcount != 1))
131           begin
132               rollback tran rjs_register
133               return 1
134           end
135   
136           commit tran rjs_register
137   
138           return 0
139       end /*end sp*/
140   

DEFECTS
 MEST 4 Empty String will be replaced by Single Space 48
 MEST 4 Empty String will be replaced by Single Space 68
 MINU 4 Unique Index with nullable columns master..sysattributes master..sysattributes
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 109
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 111
 MGTP 3 Grant to public master..sysattributes  
 MNER 3 No Error Check should check @@error after delete 110
 MUCO 3 Useless Code Useless Begin-End Pair 20
 MUCO 3 Useless Code Useless Brackets 33
 MUCO 3 Useless Code Useless Brackets 48
 MUCO 3 Useless Code Useless Brackets 54
 MUCO 3 Useless Code Useless Brackets 64
 MUCO 3 Useless Code Useless Brackets 68
 MUCO 3 Useless Code Useless Brackets 75
 MUCO 3 Useless Code Useless Brackets 78
 MUCO 3 Useless Code Useless Brackets 84
 MUCO 3 Useless Code Useless Brackets 88
 MUCO 3 Useless Code Useless Brackets 94
 MUCO 3 Useless Code Useless Brackets 130
 QISO 3 Set isolation level 42
 QIWC 3 Insert with not all columns specified missing 9 columns out of 15 126
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysattributes.csysattributes unique clustered
(class, attribute, object_type, object, object_info1, object_info2, object_info3, object_cinfo)
Intersection: {class}
109
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysattributes.csysattributes unique clustered
(class, attribute, object_type, object, object_info1, object_info2, object_info3, object_cinfo)
Intersection: {class, object_type, attribute}
111
 MSUB 2 Subquery Marker 109
 MTR1 2 Metrics: Comments Ratio Comments: 52% 15
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 7 = 13dec - 8exi + 2 15
 MTR3 2 Metrics: Query Complexity Complexity: 49 15

DATA PROPAGATION detailed
ColumnWritten To
@host_namesysattributes.char_value   sysattributes.int_value   °.char_value   sp_dropdevice_rset_001.device sp_dropdevice_rset_001.device sp_forceonline_object_rset_001.status sp_forceonline_object_rset_002.status sp_forceonline_page_rset_001.status sp_forceonline_page_rset_002.status sp_listsuspect_object_rset_001.Access
sp_listsuspect_page_rset_001.Access sp_makesuspect_obj_rset_001.Indid °.LogType °.PageType °.ErrType °.Delay °.TotalNum sp_makesuspect_obj_rset_002.Indid °.LogType °.PageType
°.ErrType °.Delay °.TotalNum sp_makesuspect_obj_rset_003.Indid °.LogType °.PageType °.ErrType °.Delay °.TotalNum sp_passwordpolicy_rset_001.message
sp_passwordpolicy_rset_002.value sp_passwordpolicy_rset_003.value sp_passwordpolicy_rset_004.Policy_option sp_rjs_retrieve_rset_001.host_name sp_setsuspect_granularity_rset_001.Online mode sp_ssladmin_rset_001.certificate_path sp_ssladmin_rset_002.Cipher Suite Name °.Preference
@host_portsysattributes.object   °.object_info1   °.object_info3   °.int_value   °.char_value   sysremotelogins.remoteserverid   sysservers.srvid   sysattributes.object_info1   °.object_info3   °.int_value  
°.char_value   sp_dropdevice_rset_001.device sp_checknames_rset_006.remoteserverid sp_checknames_rset_007.srvid sp_checknames_rset_008.srvid sp_dbrecovery_order_rset_001.Database Name °.Database id °.Recovery Order sp_dbrecovery_order_rset_002.Recovery Order sp_displayroles_rset_001.Role Name
sp_displayroles_rset_002.Role Name °.Grantee sp_displayroles_rset_003.Role Name sp_displayroles_rset_004.Role Name sp_dropdevice_rset_001.device sp_forceonline_object_rset_001.Objid °.Object °.status sp_forceonline_object_rset_002.Objid °.Object
°.status sp_forceonline_page_rset_001.Pageid °.status sp_forceonline_page_rset_002.Pageid °.status sp_listsuspect_object_rset_001.Objid °.Object °.Access sp_listsuspect_page_rset_001.Pageid °.Object
°.Access sp_makesuspect_obj_rset_001.Obj °.Indid °.LogType °.PageType °.ErrType °.Delay °.TotalNum sp_makesuspect_obj_rset_002.Obj °.Indid
°.LogType °.PageType °.ErrType °.Delay °.TotalNum sp_makesuspect_obj_rset_003.Obj °.Indid °.LogType °.PageType °.ErrType
°.Delay °.TotalNum sp_memlog_rset_001.dumps_per_file sp_passwordpolicy_rset_001.message sp_passwordpolicy_rset_002.value sp_passwordpolicy_rset_003.value sp_passwordpolicy_rset_004.Policy_option sp_rjs_retrieve_rset_001.host_name °.host_port sp_setsuspect_error_rset_001.Error Num
sp_setsuspect_error_rset_002.Error Num sp_setsuspect_granularity_rset_001.Online mode sp_setsuspect_threshold_rset_001.Cur. Suspect threshold sp_setsuspect_threshold_rset_002.Cur. Suspect Threshold sp_ssladmin_rset_001.certificate_path sp_ssladmin_rset_002.Cipher Suite Name °.Preference
@js_serversysattributes.object_cinfo   sp_optgoal_rset_002.name sp_passwordpolicy_rset_001.value sp_rjs_retrieve_rset_001.js_server

DEPENDENCIES
PROCS AND TABLES USED
read_writes table master..sysattributes (1)