From a23913685e9f5937956e556b5c3debbb04216ccf Mon Sep 17 00:00:00 2001 From: peihexian Date: Wed, 8 May 2019 11:26:36 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3Conversion=E6=8E=A5=E5=8F=A3T?= =?UTF-8?q?oDB()=20([]byte,=20error)=E6=96=B9=E6=B3=95=E8=BF=94=E5=9B=9E*T?= =?UTF-8?q?ype=E5=80=BC=E4=B8=BAnil=E6=97=B6,=E6=95=B0=E6=8D=AE=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E4=B8=BA[]byte(nil)=E7=9A=84bug,=E8=A7=A3=E5=86=B3*Ty?= =?UTF-8?q?pe=E5=80=BC=E4=B8=BAnil=E6=97=B6=E6=8F=92=E5=85=A5=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=8F=98=E4=B8=BA""=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- session_convert.go | 3 +++ statement.go | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/session_convert.go b/session_convert.go index 6b6fbdeaf..1ff003cdf 100644 --- a/session_convert.go +++ b/session_convert.go @@ -554,6 +554,9 @@ func (session *Session) value2Interface(col *core.Column, fieldValue reflect.Val if col.SQLType.IsBlob() { return data, nil } + if nil==data { + return nil,nil + } return string(data), nil } diff --git a/statement.go b/statement.go index ddff4493b..8216a012c 100644 --- a/statement.go +++ b/statement.go @@ -319,7 +319,11 @@ func (statement *Statement) buildUpdates(bean interface{}, if err != nil { engine.logger.Error(err) } else { - val = data + if nil==data { + val=nil + }else{ + val = data + } } goto APPEND }