DatabaseProcApplicationCreatedLinks
sybsystemprocssyb_aux_expandbitmap  31 Aug 14Defects Dependencies

1     
2     /* Sccsid = "%Z% generic/sproc/src/%M% %I% %G%" */
3     
4     
5     create procedure syb_aux_expandbitmap
6         @colcount smallint, /* no of columns in the table */
7         @expandmap varbinary(133) output /* expanded column map with all 1's */
8     as
9     
10        declare @colleft smallint /* tracks number of columns left in the bit map */
11    
12    
13        /* 
14        ** if the number of columns are less than 8, it is a special case because
15        ** bit 0 is treated differently in the column bit map
16        */
17        if (@colcount < 8)
18        begin
19            if (@colcount = 1)
20                select @expandmap = 0x02
21            else if (@colcount = 2)
22                select @expandmap = 0x06
23            else if (@colcount = 3)
24                select @expandmap = 0x0e
25            else if (@colcount = 4)
26                select @expandmap = 0x1e
27            else if (@colcount = 5)
28                select @expandmap = 0x3e
29            else if (@colcount = 6)
30                select @expandmap = 0x7e
31            else if (@colcount = 7)
32                select @expandmap = 0xfe
33            return
34        end
35    
36        /*
37        ** column count was more than 7, thus set up the bit map for the first byte
38        ** and set the column left variable
39        */
40        select @expandmap = 0xfe
41        select @colleft = @colcount - 7
42    
43        /* 
44        ** for chunk of 8 columns, set the bit map to all 1s for that byte
45        */
46        while (@colleft >= 8)
47        begin
48            select @expandmap = @expandmap + 0xff
49            select @colleft = @colleft - 8
50        end
51    
52        /*
53        ** if no column left, return 
54        */
55        if (@colleft = 0)
56            return
57    
58        /* 
59        ** now the number of left columns has to be between 1 and 7. So setup
60        ** the bit map for the last byte
61        */
62        if (@colleft = 1)
63            select @expandmap = @expandmap + 0x01
64        else if (@colleft = 2)
65            select @expandmap = @expandmap + 0x03
66        else if (@colleft = 3)
67            select @expandmap = @expandmap + 0x07
68        else if (@colleft = 4)
69            select @expandmap = @expandmap + 0x0f
70        else if (@colleft = 5)
71            select @expandmap = @expandmap + 0x1f
72        else if (@colleft = 6)
73            select @expandmap = @expandmap + 0x3f
74        else if (@colleft = 7)
75            select @expandmap = @expandmap + 0x7f
76    
77    


exec sp_procxmode 'syb_aux_expandbitmap', 'AnyMode'
go

Grant Execute on syb_aux_expandbitmap to public
go
DEFECTS
 MBLI 3 Integer Value of Binary Literal is Platform Dependant 20
 MBLI 3 Integer Value of Binary Literal is Platform Dependant 22
 MBLI 3 Integer Value of Binary Literal is Platform Dependant 24
 MBLI 3 Integer Value of Binary Literal is Platform Dependant 26
 MBLI 3 Integer Value of Binary Literal is Platform Dependant 28
 MBLI 3 Integer Value of Binary Literal is Platform Dependant 30
 MBLI 3 Integer Value of Binary Literal is Platform Dependant 32
 MBLI 3 Integer Value of Binary Literal is Platform Dependant 40
 MBLI 3 Integer Value of Binary Literal is Platform Dependant 48
 MBLI 3 Integer Value of Binary Literal is Platform Dependant 63
 MBLI 3 Integer Value of Binary Literal is Platform Dependant 65
 MBLI 3 Integer Value of Binary Literal is Platform Dependant 67
 MBLI 3 Integer Value of Binary Literal is Platform Dependant 69
 MBLI 3 Integer Value of Binary Literal is Platform Dependant 71
 MBLI 3 Integer Value of Binary Literal is Platform Dependant 73
 MBLI 3 Integer Value of Binary Literal is Platform Dependant 75
 MGTP 3 Grant to public sybsystemprocs..syb_aux_expandbitmap  
 MUCO 3 Useless Code Useless Brackets 17
 MUCO 3 Useless Code Useless Brackets 19
 MUCO 3 Useless Code Useless Brackets 21
 MUCO 3 Useless Code Useless Brackets 23
 MUCO 3 Useless Code Useless Brackets 25
 MUCO 3 Useless Code Useless Brackets 27
 MUCO 3 Useless Code Useless Brackets 29
 MUCO 3 Useless Code Useless Brackets 31
 MUCO 3 Useless Code Useless Brackets 46
 MUCO 3 Useless Code Useless Brackets 55
 MUCO 3 Useless Code Useless Brackets 62
 MUCO 3 Useless Code Useless Brackets 64
 MUCO 3 Useless Code Useless Brackets 66
 MUCO 3 Useless Code Useless Brackets 68
 MUCO 3 Useless Code Useless Brackets 70
 MUCO 3 Useless Code Useless Brackets 72
 MUCO 3 Useless Code Useless Brackets 74
 MTR1 2 Metrics: Comments Ratio Comments: 30% 5
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 17 = 17dec - 2exi + 2 5
 MTR3 2 Metrics: Query Complexity Complexity: 56 5

DEPENDENCIES
CALLERS
called by proc sybsystemprocs..syb_aux_privnots  
   called by proc sybsystemprocs..sp_changegroup  
called by proc sybsystemprocs..syb_aux_privexor  
   called by proc sybsystemprocs..sp_changegroup  
   called by proc sybsystemprocs..sp_ijdbc_aux_computeprivs  
   called by proc sybsystemprocs..sp_odbc_computeprivs  
      called by proc sybsystemprocs..sp_odbc_getcolumnprivileges  
      called by proc sybsystemprocs..sp_odbc_gettableprivileges  
   called by proc sybsystemprocs..sp_oledb_computeprivs  
      called by proc sybsystemprocs..sp_oledb_getcolumnprivileges  
      called by proc sybsystemprocs..sp_oledb_gettableprivileges  
   called by proc sybsystemprocs..sp_aux_computeprivs  
      called by proc sybsystemprocs..sp_column_privileges  
      called by proc sybsystemprocs..sp_table_privileges  
   called by proc sybsystemprocs..sp_jdbc_getcolumnprivileges  
   called by proc sybsystemprocs..sp_jdbc_computeprivs  
      called by proc sybsystemprocs..sp_jdbc_gettableprivileges  
called by proc sybsystemprocs..syb_aux_privsand  
   called by proc sybsystemprocs..sp_changegroup