forked from kevadesu/forgejo
Upgrade xorm to v1.1.1 (#16339)
This commit is contained in:
parent
32fd11395b
commit
760af187ba
39 changed files with 989 additions and 1201 deletions
23
vendor/xorm.io/xorm/session_insert.go
generated
vendored
23
vendor/xorm.io/xorm/session_insert.go
generated
vendored
|
@ -11,6 +11,7 @@ import (
|
|||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"xorm.io/xorm/internal/utils"
|
||||
"xorm.io/xorm/schemas"
|
||||
|
@ -374,9 +375,7 @@ func (session *Session) innerInsert(bean interface{}) (int64, error) {
|
|||
return 1, nil
|
||||
}
|
||||
|
||||
aiValue.Set(int64ToIntValue(id, aiValue.Type()))
|
||||
|
||||
return 1, nil
|
||||
return 1, convertAssignV(aiValue.Addr(), id)
|
||||
} else if len(table.AutoIncrement) > 0 && (session.engine.dialect.URI().DBType == schemas.POSTGRES ||
|
||||
session.engine.dialect.URI().DBType == schemas.MSSQL) {
|
||||
res, err := session.queryBytes(sqlStr, args...)
|
||||
|
@ -416,9 +415,7 @@ func (session *Session) innerInsert(bean interface{}) (int64, error) {
|
|||
return 1, nil
|
||||
}
|
||||
|
||||
aiValue.Set(int64ToIntValue(id, aiValue.Type()))
|
||||
|
||||
return 1, nil
|
||||
return 1, convertAssignV(aiValue.Addr(), id)
|
||||
}
|
||||
|
||||
res, err := session.exec(sqlStr, args...)
|
||||
|
@ -458,7 +455,9 @@ func (session *Session) innerInsert(bean interface{}) (int64, error) {
|
|||
return res.RowsAffected()
|
||||
}
|
||||
|
||||
aiValue.Set(int64ToIntValue(id, aiValue.Type()))
|
||||
if err := convertAssignV(aiValue.Addr(), id); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return res.RowsAffected()
|
||||
}
|
||||
|
@ -499,6 +498,16 @@ func (session *Session) genInsertColumns(bean interface{}) ([]string, []interfac
|
|||
}
|
||||
|
||||
if col.IsDeleted {
|
||||
colNames = append(colNames, col.Name)
|
||||
if !col.Nullable {
|
||||
if col.SQLType.IsNumeric() {
|
||||
args = append(args, 0)
|
||||
} else {
|
||||
args = append(args, time.Time{}.Format("2006-01-02 15:04:05"))
|
||||
}
|
||||
} else {
|
||||
args = append(args, nil)
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue