Skip to content

Commit

Permalink
1.修复Oracle使用Replace出错的BUG
Browse files Browse the repository at this point in the history
2.降低框架在原版Oracle操作中可能出现删数据的风险
3.降低原版Execute执行器可能出现误删数据的风险
  • Loading branch information
tobycroft committed Oct 30, 2023
1 parent bba22d5 commit bc2d858
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions builder_oracle.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,7 @@ func (b *BuilderOracle) BuildExecuteOra(operType string) (sqlStr string, args []
sqlStr = fmt.Sprintf("DELETE FROM %s%s", b.BuildTable(), where)
break
case "replace":
if where == "" && b.IOrm.GetForce() == false {
err = errors.New("出于安全考虑, update时where条件不能为空, 如果真的不需要where条件, 请使用Force()(如: db.xxx.Force().Update())")
b.IOrm.GetISession().GetIEngin().GetLogger().Error(err.Error())
return
}
sqlStr = fmt.Sprintf("REPLACE INTO %s (%s) VALUES %s", b.BuildTable(), insertkey, insertval)
err = errors.New("Oracle不支持Replace查询,如需使用Replace()函数,可以手动在Fields()中输入")
break
}

Expand Down

0 comments on commit bc2d858

Please sign in to comment.