DatabaseProcApplicationCreatedLinks
sybsystemprocssp_rjs_unregister  14 déc. 14Defects Propagation Dependencies

1     
2     /* Sccsid = "%Z% generic/sproc/%M% %I% %G% */
3     
4     /*
5     ** Messages for "sp_rjs_unregister"
6     **
7     ** 17260, "Can't run %1! from within a transaction."
8     ** 19364, "'%1!' is not a valid server name."
9     ** 19369, "A Job Scheduler server name is required;  enter the name of the server with JS installed that you want to unregister."
10    ** 19370, "A host name is required when unregistering a Job Scheduler server."
11    ** 19371, "A host port number is required when unregistering a Job Scheduler server." 
12    */
13    
14    create or replace procedure sp_rjs_unregister
15        @js_server varchar(30), /* name of js server */
16        @host_name varchar(255), /* name of machine hosting JS server */
17        @host_port int /* server access port on host */
18    as
19        begin
20    
21            /*
22            **  If we're in a transaction, disallow this since it might make recovery
23            **  impossible.
24            */
25    
26            if @@trancount > 0
27            begin
28                /*
29                ** 17260, "Can't run %1! from within a transaction."
30                */
31                raiserror 17260, "sp_rjs_unregister"
32                return (1)
33            end
34            else
35            begin
36                /* Use TSQL mode of unchained transactions */
37                set chained off
38            end
39    
40            /* Dont do "Dirty Reads" */
41            set transaction isolation level 1
42    
43            /*
44            ** Check to see that the input params are correct and then hook up with
45            ** sysattributes table to enter data.
46            */
47            if ((@js_server is NULL) OR (@js_server = ""))
48            begin
49                /*
50                ** 19369, "A Job Scheduler server name is required;  enter the name of the server with JS installed that you want to unregister."
51                **/
52                raiserror 19369
53                return (1)
54            end
55            else
56            begin
57                if valid_name(@js_server) = 0
58                begin
59                    /*
60                    ** 19364, "'%1!' is not a valid server name."
61                    **/
62                    raiserror 19364, @js_server
63                    return (1)
64                end
65            end
66    
67            if ((@host_name is NULL) OR (@host_name = ""))
68            begin
69                /*
70                ** 19370, 
71                ** "A host name is required when unregistering a Job Scheduler server."
72                **/
73                raiserror 19370
74                return (1)
75            end
76    
77            if ((@host_port is NULL) OR (@host_port = 0))
78            begin
79                /*
80                ** 19371, "A host port number is required when unregistering a Job Scheduler server." 
81                **/
82                raiserror 19371
83                return (1)
84            end
85    
86            /*
87            ** The following sysattribute columns hold the corresponding data for
88            ** a unregistered JS:
89            **
90            **     object_type: JS
91            **     object_cinfo: ASE server name
92            **     char_value: host name
93            **     int_value: host port
94            **
95            ** Note:  in future, if we want to unregister more than one Job Scheduler
96            **        server, we have a natural key in object_cinfo (@js_server), 
97            **        char_value (@host_name) and int_value (host_port).
98            */
99            delete from master.dbo.sysattributes
100           where class = 22 and attribute = 1 and object_type = "JS" and
101               object_cinfo = @js_server and char_value = @host_name and
102               int_value = @host_port
103   
104           return @@error
105       end /*end sp*/
106   

DEFECTS
 MEST 4 Empty String will be replaced by Single Space 47
 MEST 4 Empty String will be replaced by Single Space 67
 MINU 4 Unique Index with nullable columns master..sysattributes master..sysattributes
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 100
 MGTP 3 Grant to public master..sysattributes  
 MUCO 3 Useless Code Useless Begin-End Pair 19
 MUCO 3 Useless Code Useless Brackets 32
 MUCO 3 Useless Code Useless Brackets 47
 MUCO 3 Useless Code Useless Brackets 53
 MUCO 3 Useless Code Useless Brackets 63
 MUCO 3 Useless Code Useless Brackets 67
 MUCO 3 Useless Code Useless Brackets 74
 MUCO 3 Useless Code Useless Brackets 77
 MUCO 3 Useless Code Useless Brackets 83
 QISO 3 Set isolation level 41
 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: {attribute, object_type, object_cinfo, class}
100
 MTR1 2 Metrics: Comments Ratio Comments: 55% 14
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 5 = 9dec - 6exi + 2 14
 MTR3 2 Metrics: Query Complexity Complexity: 35 14

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