Skip to content

Commit 6b953b6

Browse files
committed
Add doc for TableMapEvent.IsCharacterColumn
Move some code in TableMapEvent.realType
1 parent acade6e commit 6b953b6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: replication/row_event.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -741,11 +741,10 @@ func (e *TableMapEvent) GeometryTypeMap() map[int]uint64 {
741741
func (e *TableMapEvent) realType(i int) byte {
742742

743743
typ := e.ColumnType[i]
744-
meta := e.ColumnMeta[i]
745744

746745
switch typ {
747746
case MYSQL_TYPE_STRING:
748-
rtyp := byte(meta >> 8)
747+
rtyp := byte(e.ColumnMeta[i] >> 8)
749748
if rtyp == MYSQL_TYPE_ENUM || rtyp == MYSQL_TYPE_SET {
750749
return rtyp
751750
}
@@ -776,6 +775,9 @@ func (e *TableMapEvent) IsNumericColumn(i int) bool {
776775

777776
}
778777

778+
// IsCharacterColumn returns true if the column type is considered as character type.
779+
// Note that JSON/GEOMETRY types are treated as character type in mariadb.
780+
// (JSON is an alias for LONGTEXT in mariadb: https://mariadb.com/kb/en/json-data-type/)
779781
func (e *TableMapEvent) IsCharacterColumn(i int) bool {
780782

781783
switch e.realType(i) {

0 commit comments

Comments
 (0)