DatabaseProcApplicationCreatedLinks
sybsystemprocssp_querysmobj  31 Aug 14Defects Dependencies

1     
2     
3     /*
4     ** This procedure performs queries Backup objects backed up at Storage Manager.
5     ** It sends bs_querysmobj 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_queryobj() 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_querysmobj"
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_querysmobj
26        @sm_api_name varchar(30) = NULL, /* SM Interface Stream name*/
27        @output_fname varchar(255) = NULL, /* Output filename path */
28        @server_name varchar(30) = NULL, /* Server Instance name */
29        @database_name varchar(30) = NULL, /* Database name */
30        @object_name varchar(255) = NULL, /* Archive object name */
31        @dump_type varchar(30) = NULL, /* Database dump type */
32        @until_time varchar(30) = NULL, /* Until point in time */
33        @bs_name varchar(30) = NULL /* Backup Server name */
34    as
35    
36        begin
37    
38            declare @status int /* RPC status */
39            declare @bs_rpc varchar(255) /* RPC site and proc name */
40    
41            if @@trancount > 0
42            begin
43                /* 17260, "Can't run %1! from within a transaction." */
44                raiserror 17260, "sp_querysmobj"
45                return (1)
46            end
47    
48    
49            /* 
50            ** Only the accounts with either SA role or oper_role can execute this 
51            ** procedure. 
52            **
53            ** If user does not have either the sa role or the oper_role, we cannot 
54            ** continue any further.
55            */
56            if ((proc_role("oper_role") = 0) and (proc_role("sa_role") = 0))
57            begin
58                raiserror 19980
59                return (1)
60            end
61    
62            /*
63            ** Check for mandatory parameters supplied.
64            **
65            */
66            if (@sm_api_name is NULL)
67            begin
68                raiserror 18255, "Storage Manager API module name"
69                return (1)
70            end
71    
72            if (@output_fname is NULL)
73            begin
74                raiserror 18255, "Query output filename"
75                return (1)
76            end
77    
78            if (@server_name is NULL)
79            begin
80                raiserror 18255, "Server name"
81                return (1)
82            end
83    
84            /* Select SYB_BACKUP as default Backup Server */
85            if (@bs_name is NULL)
86            begin
87                select @bs_rpc = 'SYB_BACKUP...bs_querysmobj'
88            end
89            else
90            begin
91                select @bs_rpc = @bs_name + '...bs_querysmobj'
92            end
93    
94            exec @status = @bs_rpc @sm_api_name, @output_fname, @server_name, @database_name, @object_name, @dump_type, @until_time, @bs_name
95    
96            return (@status)
97    
98        end
99    
100   


exec sp_procxmode 'sp_querysmobj', 'AnyMode'
go

Grant Execute on sp_querysmobj to public
go
DEFECTS
 MGTP 3 Grant to public sybsystemprocs..sp_querysmobj  
 MUCO 3 Useless Code Useless Begin-End Pair 36
 MUCO 3 Useless Code Useless Brackets 45
 MUCO 3 Useless Code Useless Brackets 56
 MUCO 3 Useless Code Useless Brackets 59
 MUCO 3 Useless Code Useless Brackets 66
 MUCO 3 Useless Code Useless Brackets 69
 MUCO 3 Useless Code Useless Brackets 72
 MUCO 3 Useless Code Useless Brackets 75
 MUCO 3 Useless Code Useless Brackets 78
 MUCO 3 Useless Code Useless Brackets 81
 MUCO 3 Useless Code Useless Brackets 85
 MUCO 3 Useless Code Useless Brackets 96
 MZMB 3 Zombie: use of non-existent object SYB_BACKUP...bs_querysmobj 0
 MDYE 2 Dynamic Exec Marker exec @status 94
 MTR1 2 Metrics: Comments Ratio Comments: 52% 25
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 3 = 7dec - 6exi + 2 25
 MTR3 2 Metrics: Query Complexity Complexity: 30 25

DEPENDENCIES