DatabaseProcApplicationCreatedLinks
sybsystemprocssyb_aux_printprivs  14 déc. 14Defects Propagation Dependencies

1     
2     /* Sccsid = "%Z% generic/sproc/src/%M% %I% %G%" */
3     
4     /*
5     **  syb_aux_printprivs
6     **
7     **  Parameters:
8     **	calledfrom_colpriv	- Is call made to print column privileges
9     **				  (or table privileges)
10    **	col_pos			- Id of column to print privileges for.
11    **	tab_priv		- Are there privileges on any table in column?
12    **	tab_priv_g		- Are there any grantable privileges?
13    **	col_priv		- Bit map of column privileges.
14    **	col_priv_g		- Bit map of grantable column privileges.
15    **	colprivileges		- Are column level privileges being processed?
16    **	grantable [output]	- "YES" if grantable privileges, "NO" otherwise.
17    **	is_printable [output]	- Is the privilege printable?
18    */
19    create or replace procedure syb_aux_printprivs(
20        @calledfrom_colpriv tinyint,
21        @col_pos smallint,
22        @tab_priv tinyint,
23        @tab_priv_g tinyint,
24        @col_priv varbinary(133),
25        @col_priv_g varbinary(133),
26        @colprivileges tinyint,
27        @grantable varchar(3) output,
28        @is_printable tinyint output)
29    as
30        declare @bitset tinyint
31        declare @bitset_g tinyint
32    
33        select @grantable = 'NO'
34        select @is_printable = 0
35        /* 
36        ** check if the privilege info is to be computed for a table level privilege
37        ** i.e. for insert or delete
38        */
39        if (@colprivileges = 0)
40        begin
41            begin
42                if ((@tab_priv = 0) and (@tab_priv_g = 0))
43                    /* no privileges on any column of this table */
44                    return (0)
45    
46                if (@tab_priv_g <> 0x00)
47                    select @grantable = 'YES'
48    
49            end
50            select @is_printable = 1
51            return (0)
52        end
53    
54    
55        /*
56        ** The privilege information is to be printed for column level
57        ** i.e. select, update, reference
58        */
59    
60        if ((@col_priv = 0x00) and (@col_priv_g = 0x00))
61            /* empty bit map..so nothing to be printed */
62            return (0)
63    
64        if (@calledfrom_colpriv = 0)
65        /* we are printing privileges for sp_table_privilege procedure call. Thus
66        if any of the bit is one, the privilege is printable*/
67    
68        begin
69            if (@col_priv_g <> 0x00)
70                select @grantable = 'YES'
71    
72            select @is_printable = 1
73            return (0)
74        end
75    
76        /* 
77        ** we are called from sp_column_privileges . Need to check if the colbit specified
78        ** by the @col_pos is set or not
79        */
80        exec sybsystemprocs.dbo.syb_aux_colbit @col_pos, @col_priv_g, @bitset_g output
81    
82        if (@bitset_g > 0)
83            select @grantable = 'YES'
84    
85        exec sybsystemprocs.dbo.syb_aux_colbit @col_pos, @col_priv, @bitset output
86    
87        /*
88        ** if none of the bits are set, return
89        */
90        if ((@bitset = 0) and (@bitset_g = 0))
91            return (0)
92    
93        /*
94        ** the privilege is printable
95        */
96    
97        select @is_printable = 1
98        return (0)
99    
100   

DEFECTS
 MBLI 3 Integer Value of Binary Literal is Platform Dependant 46
 MBLI 3 Integer Value of Binary Literal is Platform Dependant 60
 MBLI 3 Integer Value of Binary Literal is Platform Dependant 69
 MNER 3 No Error Check should check return value of exec 80
 MNER 3 No Error Check should check return value of exec 85
 MUCO 3 Useless Code Useless Brackets in create proc 19
 MUCO 3 Useless Code Useless Brackets 39
 MUCO 3 Useless Code Useless Brackets 42
 MUCO 3 Useless Code Useless Brackets 44
 MUCO 3 Useless Code Useless Brackets 46
 MUCO 3 Useless Code Useless Brackets 51
 MUCO 3 Useless Code Useless Brackets 60
 MUCO 3 Useless Code Useless Brackets 62
 MUCO 3 Useless Code Useless Brackets 64
 MUCO 3 Useless Code Useless Brackets 69
 MUCO 3 Useless Code Useless Brackets 73
 MUCO 3 Useless Code Useless Brackets 82
 MUCO 3 Useless Code Useless Brackets 90
 MUCO 3 Useless Code Useless Brackets 91
 MUCO 3 Useless Code Useless Brackets 98
 MTR1 2 Metrics: Comments Ratio Comments: 47% 19
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 10 = 12dec - 4exi + 2 19
 MTR3 2 Metrics: Query Complexity Complexity: 38 19

DEPENDENCIES
PROCS AND TABLES USED
calls proc sybsystemprocs..syb_aux_colbit  

CALLERS
called by proc sybsystemprocs..sp_jdbc_computeprivs  
called by proc sybsystemprocs..sp_ijdbc_aux_computeprivs  
called by proc sybsystemprocs..sp_aux_computeprivs  
   called by proc sybsystemprocs..sp_table_privileges  
   called by proc sybsystemprocs..sp_column_privileges