DatabaseProcApplicationCreatedLinks
sybsystemprocssp_deletesmobj  31 Aug 14Defects Dependencies

1     
2     
3     /*
4     ** This procedure deletes Backup objects backed up at Storage Manager.
5     ** It sends bs_deletesmobj RPC to the Backup Server, passing all the 
6     ** parameters to the stored procedure as it is. The parsing of all the 
7     ** options is done by the Backup Server. The actual Query operation is 
8     ** performed by Backup Server using the syb_deleteobj() API call of the 
9     ** API interface supplied as an argument.
10    **
11    ** This can be issued only by users with SA role or oper_role.
12    */
13    
14    /*
15    ** Messages for "sp_deletesmobj"
16    **
17    ** 17260, "Can't run %1! from within a transaction."
18    ** 18255, "%1! cannot be NULL."
19    ** 19980, "You are not authorized to execute this stored procedure.
20    ** Only the System Administrator (SA) or a user with oper_role
21    ** authorization can execute this stored procedure."
22    **
23    */
24    
25    create procedure sp_deletesmobj
26        @sm_api_name varchar(30) = NULL, /* SM Interface Stream name*/
27        @server_name varchar(30) = NULL, /* Server Instance name */
28        @database_name varchar(30) = NULL, /* Database name */
29        @object_name varchar(255) = NULL, /* Archive object name */
30        @dump_type varchar(30) = NULL, /* Database dump type */
31        @until_time varchar(30) = NULL, /* Until point in time */
32        @bs_name varchar(30) = NULL /* Backup Server name */
33    as
34    
35        begin
36    
37            declare @status int /* RPC status */
38            declare @bs_rpc varchar(255) /* RPC site and proc name */
39    
40            if @@trancount > 0
41            begin
42                /* 17260, "Can't run %1! from within a transaction." */
43                raiserror 17260, "sp_deletesmobj"
44                return (1)
45            end
46    
47    
48            /* 
49            ** Only the accounts with either SA role or oper_role can execute this
50            ** procedure.
51            **
52            ** If user does not have either the sa role or the oper_role, we cannot
53            ** continue any further.
54            */
55            if ((proc_role("oper_role") = 0) and (proc_role("sa_role") = 0))
56            begin
57                raiserror 19980
58                return (1)
59            end
60    
61            /*
62            ** Check for mandatory parameters supplied.
63            **
64            */
65            if (@sm_api_name is NULL)
66            begin
67                raiserror 18255, "Storage Manager API module name"
68                return (1)
69            end
70    
71            if (@server_name is NULL)
72            begin
73                raiserror 18255, "Server name"
74                return (1)
75            end
76    
77            /* Select SYB_BACKUP as default Backup Server */
78            if (@bs_name is NULL)
79            begin
80                select @bs_rpc = 'SYB_BACKUP...bs_deletesmobj'
81            end
82            else
83            begin
84                select @bs_rpc = @bs_name + '...bs_deletesmobj'
85            end
86    
87            /* Issue bs_deletesmobj RPC to Backup Server */
88            exec @status = @bs_rpc @sm_api_name, @server_name, @database_name, @object_name, @dump_type, @until_time, @bs_name
89    
90            return (@status)
91    
92        end
93    


exec sp_procxmode 'sp_deletesmobj', 'AnyMode'
go

Grant Execute on sp_deletesmobj to public
go
DEFECTS
 MGTP 3 Grant to public sybsystemprocs..sp_deletesmobj  
 MUCO 3 Useless Code Useless Begin-End Pair 35
 MUCO 3 Useless Code Useless Brackets 44
 MUCO 3 Useless Code Useless Brackets 55
 MUCO 3 Useless Code Useless Brackets 58
 MUCO 3 Useless Code Useless Brackets 65
 MUCO 3 Useless Code Useless Brackets 68
 MUCO 3 Useless Code Useless Brackets 71
 MUCO 3 Useless Code Useless Brackets 74
 MUCO 3 Useless Code Useless Brackets 78
 MUCO 3 Useless Code Useless Brackets 90
 MZMB 3 Zombie: use of non-existent object SYB_BACKUP...bs_deletesmobj 0
 MDYE 2 Dynamic Exec Marker exec @status 88
 MTR1 2 Metrics: Comments Ratio Comments: 53% 25
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 3 = 6dec - 5exi + 2 25
 MTR3 2 Metrics: Query Complexity Complexity: 26 25

DEPENDENCIES