Skip to content

Commit

Permalink
drainer: escape quote in value of column (#1132)
Browse files Browse the repository at this point in the history
ref #1131
  • Loading branch information
cartersz authored Jan 21, 2022
1 parent 4246eae commit b607f34
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/loader/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.ReplaceAll(data, "'", "''")
}

0 comments on commit b607f34

Please sign in to comment.