DatabaseProcApplicationCreatedLinks
sybsystemprocssp_extengine  31 Aug 14Defects Dependencies

1     
2     /* Sccsid = "@(#) generic/sproc/src/%M% %I% %G%" */
3     /*      5.0     14.2    11/12/91        sproc/src/extengine */
4     
5     /*
6     ** Messages for "sp_extengine"      
7     **
8     ** 18888, "The server name specified does not exist."
9     ** 18889, "The specified command '%1!' does not exist."
10    ** 18892, "Unable to start the EJB Server. Check server errorlog for any additional 
11    ** information."
12    ** 18893, "Unable to stop the EJB Server. Check server errorlog for any additional 
13    ** information."
14    ** 18894, "Unable to determine the status of the EJB Server. Check server errorlog for 
15    ** any additional information."
16    **
17    */
18    create procedure sp_extengine
19        @servername varchar(30),
20        @command varchar(30)
21    as
22        declare @srvclass smallint
23        declare @upper_command varchar(30)
24        declare @physname varchar(32)
25        declare @msg varchar(250)
26    
27        select @upper_command = upper(@command)
28    
29        /*
30        **  if we're in a transaction, disallow this since it might make recovery
31        **  impossible.
32        */
33        if @@trancount > 0
34        begin
35            /*
36            ** 17260, "Can't run %1! from within a transaction."
37            */
38            raiserror 17260, "sp_extengine"
39            return (1)
40        end
41        else
42        begin
43            /* Use TSQL mode of unchained transactions */
44            set chained off
45        end
46    
47        /* Dont do "Dirty Reads" */
48        set transaction isolation level 1
49    
50        if (proc_role("sa_role") < 1)
51        begin
52            return (1)
53        end
54    
55        /* Get the class id corresponding to the server name being passed */
56        select @srvclass = srvclass from master.dbo.sysservers
57        where srvname = @servername
58    
59    
60        /*
61        ** Make sure that the class being passed, the server being passed and the
62        ** command being passed are valid commands
63        */
64        select @physname = srvnetname from master.dbo.sysservers
65        where srvclass = @srvclass and srvname = @servername
66    
67        if @@rowcount = 0
68        begin
69            /* 
70            ** 18888, "The server name specified does not exist."
71            */
72            raiserror 18888
73            return (1)
74        end
75        /* EJB Resolve : Put these commands into spt_values */
76    
77        if (@upper_command != "START" AND @upper_command != "STOP" AND @upper_command != "STATUS")
78        begin
79            /*
80            ** 18889, "The specified command '%1!' does not exist."
81            */
82            raiserror 18889, @command
83            return (1)
84        end
85    
86        /* Commands associate with the EJB Class of Server */
87        if (@srvclass = 10)
88        begin
89            if (@upper_command = "START")
90            begin
91                /* Server entry exists, start the server */
92                dbcc extengine(@physname, @srvclass, @command)
93                if (@@error != 0)
94                begin
95                    raiserror 18892
96                    return (1)
97                end
98            end
99            if (@upper_command = "STOP")
100           begin
101               /* Server entry exists, start the server */
102               dbcc extengine(@physname, @srvclass, @command)
103               if (@@error != 0)
104               begin
105                   raiserror 18893
106                   return (1)
107               end
108           end
109           if (@upper_command = "STATUS")
110           begin
111               /* Server entry exists, start the server */
112               dbcc extengine(@physname, @srvclass, @command)
113               if (@@error != 0)
114               begin
115                   raiserror 18894
116                   return (1)
117               end
118           end
119       end
120   


exec sp_procxmode 'sp_extengine', 'AnyMode'
go

Grant Execute on sp_extengine to public
go
DEFECTS
 MTYP 4 Assignment type mismatch @physname: varchar(32) = varchar(255) 64
 MGTP 3 Grant to public master..sysservers  
 MGTP 3 Grant to public sybsystemprocs..sp_extengine  
 MUCO 3 Useless Code Useless Brackets 39
 MUCO 3 Useless Code Useless Brackets 50
 MUCO 3 Useless Code Useless Brackets 52
 MUCO 3 Useless Code Useless Brackets 73
 MUCO 3 Useless Code Useless Brackets 77
 MUCO 3 Useless Code Useless Brackets 83
 MUCO 3 Useless Code Useless Brackets 87
 MUCO 3 Useless Code Useless Brackets 89
 MUCO 3 Useless Code Useless Brackets 93
 MUCO 3 Useless Code Useless Brackets 96
 MUCO 3 Useless Code Useless Brackets 99
 MUCO 3 Useless Code Useless Brackets 103
 MUCO 3 Useless Code Useless Brackets 106
 MUCO 3 Useless Code Useless Brackets 109
 MUCO 3 Useless Code Useless Brackets 113
 MUCO 3 Useless Code Useless Brackets 116
 QISO 3 Set isolation level 48
 VUNU 3 Variable is not used @msg 25
 MTR1 2 Metrics: Comments Ratio Comments: 47% 18
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 8 = 14dec - 8exi + 2 18
 MTR3 2 Metrics: Query Complexity Complexity: 55 18

DEPENDENCIES
PROCS AND TABLES USED
reads table master..sysservers (1)