From 9943966a862752d4dd0f7fe7297fcbf82e46f587 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 29 Sep 2020 22:53:44 +0800 Subject: [PATCH] improva function formatSql for package gdb --- database/gdb/gdb_func.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/database/gdb/gdb_func.go b/database/gdb/gdb_func.go index ff6ed45b8..810b5c8bf 100644 --- a/database/gdb/gdb_func.go +++ b/database/gdb/gdb_func.go @@ -342,9 +342,10 @@ func GetPrimaryKeyCondition(primary string, where ...interface{}) (newWhereCondi // The internal handleArguments function might be called twice during the SQL procedure, // but do not worry about it, it's safe and efficient. func formatSql(sql string, args []interface{}) (newSql string, newArgs []interface{}) { - sql = gstr.Trim(sql) - sql = gstr.Replace(sql, "\n", " ") - sql, _ = gregex.ReplaceString(`\s{2,}`, ` `, sql) + // DO NOT do this as there may be multiple lines and comments in the sql. + // sql = gstr.Trim(sql) + // sql = gstr.Replace(sql, "\n", " ") + // sql, _ = gregex.ReplaceString(`\s{2,}`, ` `, sql) return handleArguments(sql, args) }