Skip to content

Commit b607f34

Browse files
authored
drainer: escape quote in value of column (#1132)
ref #1131
1 parent 4246eae commit b607f34

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/loader/model.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,10 @@ func genOracleValue(column *model.ColumnInfo, value interface{}) string {
519519
mysql.TypeYear, mysql.TypeFloat, mysql.TypeDouble, mysql.TypeNewDecimal:
520520
return fmt.Sprintf("%v", value)
521521
default:
522-
return fmt.Sprintf("'%v'", value)
522+
return fmt.Sprintf("'%s'", processOracleQuoteStringValue(fmt.Sprintf("%v", value)))
523523
}
524524
}
525+
526+
func processOracleQuoteStringValue(data string) string {
527+
return strings.ReplaceAll(data, "'", "''")
528+
}

0 commit comments

Comments
 (0)