From 0861fafd9e17323ddd19b2f7ff8d059d3bab2bcf Mon Sep 17 00:00:00 2001 From: linzhoukai Date: Sat, 9 May 2020 02:43:46 +0000 Subject: [PATCH] fix bug: year==0 will be resolved to the wrong value: 1900 --- replication/row_event.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/replication/row_event.go b/replication/row_event.go index 6427c89cc..a114b32e3 100644 --- a/replication/row_event.go +++ b/replication/row_event.go @@ -787,7 +787,12 @@ func (e *RowsEvent) decodeValue(data []byte, tp byte, meta uint16) (v interface{ case MYSQL_TYPE_YEAR: n = 1 - v = int(data[0]) + 1900 + year := int(data[0]) + if year == 0 { + v = year + } else { + v = year + 1900 + } case MYSQL_TYPE_ENUM: l := meta & 0xFF switch l {