From d973423802b86e23ba31dbbdbf332cfe967c910c Mon Sep 17 00:00:00 2001 From: Andrew Thornton Date: Fri, 23 Jul 2021 09:01:49 +0800 Subject: [PATCH] Fix issue with byte representation in MSSQL (#1957) There is a missing cast to string in BuildUpdates which leads to a failure to call str2ucs and ucs2str for converts on MSSQL. Ref: https://github.com/go-gitea/gitea/issues/16252 Signed-off-by: Andrew Thornton Reviewed-on: https://gitea.com/xorm/xorm/pulls/1957 Co-authored-by: Andrew Thornton Co-committed-by: Andrew Thornton --- internal/statements/update.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/statements/update.go b/internal/statements/update.go index be6ed885..39a7f829 100644 --- a/internal/statements/update.go +++ b/internal/statements/update.go @@ -129,6 +129,9 @@ func (statement *Statement) BuildUpdates(tableValue reflect.Value, } if data != nil { val = data + if !col.SQLType.IsBlob() { + val = string(data) + } } goto APPEND } @@ -141,6 +144,9 @@ func (statement *Statement) BuildUpdates(tableValue reflect.Value, } if data != nil { val = data + if !col.SQLType.IsBlob() { + val = string(data) + } } goto APPEND }