Skip to content

Commit

Permalink
🐛 修复 UPDATE 子句数据未处理值类型的问题
Browse files Browse the repository at this point in the history
Signed-off-by: liutianqi <zixizixi@vip.qq.com>
  • Loading branch information
iTanken committed Jan 12, 2024
1 parent afff9b8 commit d6ae191
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions update.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ func Update(config *callbacks.Config) func(db *gorm.DB) {
checkMissingWhereConditions(db)

if !db.DryRun && db.Error == nil {
for i, val := range stmt.Vars {
// HACK: replace values one by one, assuming its value layout will be the same all the time, i.e. aligned
stmt.Vars[i] = convertValue(val)
}
if ok, mode := hasReturning(db, supportReturning); ok {
if rows, err := stmt.ConnPool.QueryContext(stmt.Context, stmt.SQL.String(), stmt.Vars...); db.AddError(err) == nil {
dest := stmt.Dest
Expand Down

0 comments on commit d6ae191

Please sign in to comment.