From 010ea95eb57b408aa0b2c77783926760ae7b4382 Mon Sep 17 00:00:00 2001 From: kinggo <1963359402@qq.com> Date: Tue, 15 Feb 2022 20:17:56 +0800 Subject: [PATCH] fix: isPrintable incorrect --- logger/sql.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/logger/sql.go b/logger/sql.go index e0be57c0..6ee722e2 100644 --- a/logger/sql.go +++ b/logger/sql.go @@ -19,9 +19,9 @@ const ( nullStr = "NULL" ) -func isPrintable(s []byte) bool { +func isPrintable(s string) bool { for _, r := range s { - if !unicode.IsPrint(rune(r)) { + if !unicode.IsPrint(r) { return false } } @@ -84,7 +84,7 @@ func ExplainSQL(sql string, numericPlaceholder *regexp.Regexp, escaper string, a } } case []byte: - if isPrintable(v) { + if isPrintable(string(v)) { vars[idx] = escaper + strings.Replace(string(v), escaper, "\\"+escaper, -1) + escaper } else { vars[idx] = escaper + "" + escaper