Database | Proc | Application | Created | Links |
sybsystemprocs | syb_aux_privexor | 31 Aug 14 | Defects Dependencies |
1 2 /* Sccsid = "%Z% generic/sproc/src/%M% %I% %G%" */ 3 4 5 create procedure syb_aux_privexor 6 @left_binary varbinary(133), /* left operand for the subtract */ 7 @right_binary varbinary(133), /* right operand for the subtract */ 8 @col_count smallint, /* number of columns in the table */ 9 @result_binary varbinary(133) output /* result of the subtract operation */ 10 as 11 12 declare @loop_count tinyint /* loop count for all 133 bytes in the varbinary */ 13 declare @left_opr tinyint /* integer representation of the left operand */ 14 declare @right_opr tinyint /* integer representation of the right operand */ 15 declare @result_opr tinyint /* result of subtract operation */ 16 declare @left_bin varbinary(133) /* expanded with 1's left operand */ 17 declare @loop_bound tinyint /* stores the loop upper bound */ 18 /* 19 ** initialize the loop_count 20 */ 21 select @loop_count = 1 22 23 /* 24 ** initialize loop_bound 25 */ 26 select @loop_bound = @col_count / 8 + 1 27 28 /* 29 ** check for boundary condition. If right operand is 0, there is nothing to subtract 30 */ 31 if (@right_binary = 0x00) 32 begin 33 select @result_binary = @left_binary 34 return 35 end 36 37 /* 38 ** check for boundary condition. If both oerands are equal, the result has to be 0 39 */ 40 if ((@left_binary = 0x01) and (@right_binary = 0x01)) 41 begin 42 select @result_binary = 0x00 43 return 44 end 45 46 /* 47 ** if the left oeprand is 0x01, the right operand can't be 0x01. Now we need to expand 48 ** the left opernad in order to subtract correctly 49 */ 50 if (@left_binary = 0x01) 51 exec sybsystemprocs.dbo.syb_aux_expandbitmap @col_count, @left_bin output 52 else 53 select @left_bin = @left_binary 54 55 /* 56 ** loop for all relevant bytes in the var binary operand 57 */ 58 while (@loop_count <= @loop_bound) 59 begin 60 select @left_opr = convert(tinyint, substring(@left_bin, @loop_count, 1)) 61 select @right_opr = convert(tinyint, substring(@right_binary, @loop_count, 1)) 62 63 /* do the binary operation */ 64 select @result_opr = @left_opr ^ @right_opr 65 if (@loop_count = 1) 66 begin 67 select @result_binary = convert(binary(1), @result_opr) 68 end 69 else 70 begin 71 select @result_binary = @result_binary + convert(binary(1), @result_opr) 72 end 73 74 select @loop_count = @loop_count + 1 75 end 76
exec sp_procxmode 'syb_aux_privexor', 'AnyMode' go Grant Execute on syb_aux_privexor to public go
DEFECTS | |
MBLI 3 Integer Value of Binary Literal is Platform Dependant | 31 |
MBLI 3 Integer Value of Binary Literal is Platform Dependant | 40 |
MBLI 3 Integer Value of Binary Literal is Platform Dependant | 42 |
MBLI 3 Integer Value of Binary Literal is Platform Dependant | 50 |
MGTP 3 Grant to public sybsystemprocs..syb_aux_privexor | |
MNER 3 No Error Check should check return value of exec | 51 |
MUCO 3 Useless Code Useless Brackets | 31 |
MUCO 3 Useless Code Useless Brackets | 40 |
MUCO 3 Useless Code Useless Brackets | 50 |
MUCO 3 Useless Code Useless Brackets | 58 |
MUCO 3 Useless Code Useless Brackets | 65 |
MTR1 2 Metrics: Comments Ratio Comments: 38% | 5 |
MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 5 = 6dec - 3exi + 2 | 5 |
MTR3 2 Metrics: Query Complexity Complexity: 32 | 5 |
DEPENDENCIES |
PROCS AND TABLES USED calls proc sybsystemprocs..syb_aux_expandbitmap CALLERS called by proc sybsystemprocs..sp_odbc_computeprivs called by proc sybsystemprocs..sp_odbc_gettableprivileges called by proc sybsystemprocs..sp_odbc_getcolumnprivileges called by proc sybsystemprocs..sp_ijdbc_aux_computeprivs 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_changegroup called by proc sybsystemprocs..sp_jdbc_getcolumnprivileges called by proc sybsystemprocs..sp_oledb_computeprivs called by proc sybsystemprocs..sp_oledb_gettableprivileges called by proc sybsystemprocs..sp_oledb_getcolumnprivileges called by proc sybsystemprocs..sp_jdbc_computeprivs called by proc sybsystemprocs..sp_jdbc_gettableprivileges |