mirror of
https://github.com/go-gitea/gitea
synced 2025-07-11 21:17:19 +00:00
fix MSSQL bug on org (#3405)
This commit is contained in:
21
vendor/github.com/go-xorm/xorm/session_update.go
generated
vendored
21
vendor/github.com/go-xorm/xorm/session_update.go
generated
vendored
@ -242,10 +242,23 @@ func (session *Session) Update(bean interface{}, condiBean ...interface{}) (int6
|
||||
|
||||
var autoCond builder.Cond
|
||||
if !session.statement.noAutoCondition && len(condiBean) > 0 {
|
||||
var err error
|
||||
autoCond, err = session.statement.buildConds(session.statement.RefTable, condiBean[0], true, true, false, true, false)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
if c, ok := condiBean[0].(map[string]interface{}); ok {
|
||||
autoCond = builder.Eq(c)
|
||||
} else {
|
||||
ct := reflect.TypeOf(condiBean[0])
|
||||
k := ct.Kind()
|
||||
if k == reflect.Ptr {
|
||||
k = ct.Elem().Kind()
|
||||
}
|
||||
if k == reflect.Struct {
|
||||
var err error
|
||||
autoCond, err = session.statement.buildConds(session.statement.RefTable, condiBean[0], true, true, false, true, false)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
} else {
|
||||
return 0, ErrConditionType
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user