From 7600eef2061d581fa723d14421f5129aa59559ae Mon Sep 17 00:00:00 2001 From: cartersz Date: Thu, 20 Jan 2022 11:49:30 +0800 Subject: [PATCH 1/2] escape quote --- pkg/loader/model.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/loader/model.go b/pkg/loader/model.go index b85ff9e64..a8ae9c611 100644 --- a/pkg/loader/model.go +++ b/pkg/loader/model.go @@ -519,6 +519,10 @@ func genOracleValue(column *model.ColumnInfo, value interface{}) string { mysql.TypeYear, mysql.TypeFloat, mysql.TypeDouble, mysql.TypeNewDecimal: return fmt.Sprintf("%v", value) default: - return fmt.Sprintf("'%v'", value) + return fmt.Sprintf("'%s'", processOracleQuoteStringValue(fmt.Sprintf("%v", value))) } } + +func processOracleQuoteStringValue(data string) string { + return strings.Replace(data, "'", "''", -1) +} From ad8270e49298347812638a9eea17b277d0f331f0 Mon Sep 17 00:00:00 2001 From: cartersz Date: Thu, 20 Jan 2022 18:02:30 +0800 Subject: [PATCH 2/2] fix comment --- pkg/loader/model.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/loader/model.go b/pkg/loader/model.go index a8ae9c611..06aa86546 100644 --- a/pkg/loader/model.go +++ b/pkg/loader/model.go @@ -524,5 +524,5 @@ func genOracleValue(column *model.ColumnInfo, value interface{}) string { } func processOracleQuoteStringValue(data string) string { - return strings.Replace(data, "'", "''", -1) + return strings.ReplaceAll(data, "'", "''") }