From 80387d91603b6ca1a0c38d9a0bb987843604f3c6 Mon Sep 17 00:00:00 2001 From: Shlomi Noach Date: Tue, 15 May 2018 12:45:45 +0300 Subject: [PATCH] experiment: handle zero MYSQL_TYPE_DATETIME --- .../github.com/siddontang/go-mysql/replication/row_event.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vendor/github.com/siddontang/go-mysql/replication/row_event.go b/vendor/github.com/siddontang/go-mysql/replication/row_event.go index c30d9ae..0465947 100644 --- a/vendor/github.com/siddontang/go-mysql/replication/row_event.go +++ b/vendor/github.com/siddontang/go-mysql/replication/row_event.go @@ -400,6 +400,10 @@ func (e *RowsEvent) decodeValue(data []byte, tp byte, meta uint16) (v interface{ case MYSQL_TYPE_DATETIME: n = 8 i64 := binary.LittleEndian.Uint64(data) + + if i64 == 0 { + return "0000-00-00 00:00:00", n, nil + } d := i64 / 1000000 t := i64 % 1000000 v = time.Date(int(d/10000),