@@ -427,7 +427,7 @@ func (e *TableMapEvent) Dump(w io.Writer) {
427
427
fmt .Fprintf (w , "Primary key prefix: %v\n " , e .PrimaryKeyPrefix )
428
428
fmt .Fprintf (w , "Enum/set default charset: %v\n " , e .EnumSetDefaultCharset )
429
429
fmt .Fprintf (w , "Enum/set column charset: %v\n " , e .EnumSetColumnCharset )
430
- fmt .Fprintf (w , "Invisible Column bitmap: \n %s" , hex .Dump (e .VisibilityBitmap ))
430
+ fmt .Fprintf (w , "Visible Column bitmap: \n %s" , hex .Dump (e .VisibilityBitmap ))
431
431
432
432
unsignedMap := e .UnsignedMap ()
433
433
fmt .Fprintf (w , "UnsignedMap: %#v\n " , unsignedMap )
@@ -618,16 +618,21 @@ func (e *TableMapEvent) UnsignedMap() map[int]bool {
618
618
if len (e .SignednessBitmap ) == 0 {
619
619
return nil
620
620
}
621
- p := 0
622
621
ret := make (map [int ]bool )
623
- for i := 0 ; i < int (e .ColumnCount ); i ++ {
624
- if ! e .IsNumericColumn (i ) {
625
- continue
622
+ i := 0
623
+ for _ , field := range e .SignednessBitmap {
624
+ for c := 0x80 ; c != 0 ; c >>= 1 {
625
+ if ! e .IsNumericColumn (i ) {
626
+ continue
627
+ }
628
+ ret [i ] = field & byte (c ) != 0
629
+ i ++
630
+ if uint64 (i ) >= e .ColumnCount {
631
+ return ret
632
+ }
626
633
}
627
- ret [i ] = e .SignednessBitmap [p / 8 ]& (1 << uint (7 - p % 8 )) != 0
628
- p ++
629
634
}
630
- return ret
635
+ return nil
631
636
}
632
637
633
638
// CollationMap returns a map: column index -> collation id.
@@ -747,13 +752,18 @@ func (e *TableMapEvent) VisibilityMap() map[int]bool {
747
752
if len (e .VisibilityBitmap ) == 0 {
748
753
return nil
749
754
}
750
- p := 0
751
755
ret := make (map [int ]bool )
752
- for i := 0 ; i < int (e .ColumnCount ); i ++ {
753
- ret [i ] = e .VisibilityBitmap [p / 8 ]& (1 << uint (7 - p % 8 )) != 0
754
- p ++
756
+ i := 0
757
+ for _ , field := range e .VisibilityBitmap {
758
+ for c := 0x80 ; c != 0 ; c >>= 1 {
759
+ ret [i ] = field & byte (c ) != 0
760
+ i ++
761
+ if uint64 (i ) >= e .ColumnCount {
762
+ return ret
763
+ }
764
+ }
755
765
}
756
- return ret
766
+ return nil
757
767
}
758
768
759
769
// Below realType and IsXXXColumn are base from:
0 commit comments