From 5d8e7fb74a5995089cfcd3a63ef5d22e6e52b700 Mon Sep 17 00:00:00 2001 From: tiansin Date: Sun, 27 Jul 2025 23:10:29 +0800 Subject: [PATCH 1/2] fix: :bug: Session write response error, connId: 10007, err: invalid TypeDatetime 0000-00-00 00:00:00.000 --- mysql/encoding.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql/encoding.go b/mysql/encoding.go index 9c1adb23..2ea7bf0f 100644 --- a/mysql/encoding.go +++ b/mysql/encoding.go @@ -551,7 +551,7 @@ func AppendBinaryValue(data []byte, fieldType uint8, value interface{}) ([]byte, case string: switch fieldType { case TypeDatetime, TypeTimestamp: - if v == "0000-00-00 00:00:00" { + if v == "0000-00-00 00:00:00" || v == "0000-00-00 00:00:00.000" { t = append(t, 0) } else { ts, err := time.Parse("2006-01-02 15:04:05", v) From 36fdec695efbf0b61df3ae8ccb8de5d4e168fd5a Mon Sep 17 00:00:00 2001 From: tiansin Date: Thu, 11 Dec 2025 17:38:33 +0800 Subject: [PATCH 2/2] update encoding.go --- mysql/encoding.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql/encoding.go b/mysql/encoding.go index 2ea7bf0f..e5599524 100644 --- a/mysql/encoding.go +++ b/mysql/encoding.go @@ -551,7 +551,7 @@ func AppendBinaryValue(data []byte, fieldType uint8, value interface{}) ([]byte, case string: switch fieldType { case TypeDatetime, TypeTimestamp: - if v == "0000-00-00 00:00:00" || v == "0000-00-00 00:00:00.000" { + if strings.HasPrefix(v, "0000-00-00 00:00:00"){ t = append(t, 0) } else { ts, err := time.Parse("2006-01-02 15:04:05", v)