mirror of
https://github.com/go-gitea/gitea
synced 2024-12-21 17:17:56 +01:00
Upgrade xorm to v1.0.5 (#12765)
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
3865ecbf13
commit
bea343ce09
2
go.mod
2
go.mod
@ -114,7 +114,7 @@ require (
|
||||
mvdan.cc/xurls/v2 v2.1.0
|
||||
strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251
|
||||
xorm.io/builder v0.3.7
|
||||
xorm.io/xorm v1.0.4
|
||||
xorm.io/xorm v1.0.5
|
||||
)
|
||||
|
||||
replace github.com/hashicorp/go-version => github.com/6543/go-version v1.2.3
|
||||
|
4
go.sum
4
go.sum
@ -1228,5 +1228,5 @@ xorm.io/builder v0.3.7/go.mod h1:aUW0S9eb9VCaPohFCH3j7czOx1PMW3i1HrSzbLYGBSE=
|
||||
xorm.io/core v0.7.2 h1:mEO22A2Z7a3fPaZMk6gKL/jMD80iiyNwRrX5HOv3XLw=
|
||||
xorm.io/core v0.7.2/go.mod h1:jJfd0UAEzZ4t87nbQYtVjmqpIODugN6PD2D9E+dJvdM=
|
||||
xorm.io/xorm v0.8.0/go.mod h1:ZkJLEYLoVyg7amJK/5r779bHyzs2AU8f8VMiP6BM7uY=
|
||||
xorm.io/xorm v1.0.4 h1:UBXA4I3NhiyjXfPqxXUkS2t5hMta9SSPATeMMaZg9oA=
|
||||
xorm.io/xorm v1.0.4/go.mod h1:uF9EtbhODq5kNWxMbnBEj8hRRZnlcNSz2t2N7HW/+A4=
|
||||
xorm.io/xorm v1.0.5 h1:LRr5PfOUb4ODPR63YwbowkNDwcolT2LnkwP/TUaMaB0=
|
||||
xorm.io/xorm v1.0.5/go.mod h1:uF9EtbhODq5kNWxMbnBEj8hRRZnlcNSz2t2N7HW/+A4=
|
||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -953,7 +953,7 @@ strk.kbt.io/projects/go/libravatar
|
||||
# xorm.io/builder v0.3.7
|
||||
## explicit
|
||||
xorm.io/builder
|
||||
# xorm.io/xorm v1.0.4
|
||||
# xorm.io/xorm v1.0.5
|
||||
## explicit
|
||||
xorm.io/xorm
|
||||
xorm.io/xorm/caches
|
||||
|
19
vendor/xorm.io/xorm/CHANGELOG.md
generated
vendored
19
vendor/xorm.io/xorm/CHANGELOG.md
generated
vendored
@ -3,6 +3,25 @@
|
||||
This changelog goes through all the changes that have been made in each release
|
||||
without substantial changes to our git log.
|
||||
|
||||
## [1.0.5](https://gitea.com/xorm/xorm/pulls?q=&type=all&state=closed&milestone=1299) - 2020-09-08
|
||||
|
||||
* BUGFIXES
|
||||
* Fix bug of ToDB when update on a nil pointer (#1786)
|
||||
* Fix warnings with schema Sync2 with default varchar as NVARCHAR (#1783)
|
||||
* Do not ever quote asterisk symbol. Fixes #1780 (#1781)
|
||||
* Fix bug on get columns for postgres (#1779)
|
||||
|
||||
## [1.0.4](https://gitea.com/xorm/xorm/pulls?q=&type=all&state=closed&milestone=1286) - 2020-09-02
|
||||
|
||||
* FEATURES
|
||||
* Add params for mssql to allow redefine varchar as nvarchar or char as nchar (#1741)
|
||||
* BUGFIXES
|
||||
* Fix mysql dialect error from invalid db identifier in orderby clause (#1743) (#1751)
|
||||
* ENHANCEMENTS
|
||||
* Support get dataSourceName on ContextHook for monitor which DB executed SQL (#1740)
|
||||
* MISC
|
||||
* Correct default detection in MariaDB >= 10.2.7 (#1778)
|
||||
|
||||
## [1.0.3](https://gitea.com/xorm/xorm/pulls?q=&type=all&state=closed&milestone=1281) - 2020-07-10
|
||||
|
||||
* BUGFIXES
|
||||
|
3
vendor/xorm.io/xorm/Makefile
generated
vendored
3
vendor/xorm.io/xorm/Makefile
generated
vendored
@ -22,6 +22,7 @@ TEST_MSSQL_USERNAME ?= sa
|
||||
TEST_MSSQL_PASSWORD ?= MwantsaSecurePassword1
|
||||
TEST_MSSQL_DEFAULT_VARCHAR ?= varchar
|
||||
TEST_MSSQL_DEFAULT_CHAR ?= char
|
||||
TEST_MSSQL_DO_NVARCHAR_OVERRIDE_TEST ?= true
|
||||
|
||||
TEST_MYSQL_HOST ?= mysql:3306
|
||||
TEST_MYSQL_CHARSET ?= utf8
|
||||
@ -147,6 +148,7 @@ test-mssql: go-check
|
||||
$(GO) test $(INTEGRATION_PACKAGES) -v -race -db=mssql -cache=$(TEST_CACHE_ENABLE) -quote=$(TEST_QUOTE_POLICY) \
|
||||
-conn_str="server=$(TEST_MSSQL_HOST);user id=$(TEST_MSSQL_USERNAME);password=$(TEST_MSSQL_PASSWORD);database=$(TEST_MSSQL_DBNAME)" \
|
||||
-default_varchar=$(TEST_MSSQL_DEFAULT_VARCHAR) -default_char=$(TEST_MSSQL_DEFAULT_CHAR) \
|
||||
-do_nvarchar_override_test=$(TEST_MSSQL_DO_NVARCHAR_OVERRIDE_TEST) \
|
||||
-coverprofile=mssql.$(TEST_QUOTE_POLICY).$(TEST_CACHE_ENABLE).coverage.out -covermode=atomic
|
||||
|
||||
.PNONY: test-mssql\#%
|
||||
@ -154,6 +156,7 @@ test-mssql\#%: go-check
|
||||
$(GO) test $(INTEGRATION_PACKAGES) -v -race -run $* -db=mssql -cache=$(TEST_CACHE_ENABLE) -quote=$(TEST_QUOTE_POLICY) \
|
||||
-conn_str="server=$(TEST_MSSQL_HOST);user id=$(TEST_MSSQL_USERNAME);password=$(TEST_MSSQL_PASSWORD);database=$(TEST_MSSQL_DBNAME)" \
|
||||
-default_varchar=$(TEST_MSSQL_DEFAULT_VARCHAR) -default_char=$(TEST_MSSQL_DEFAULT_CHAR) \
|
||||
-do_nvarchar_override_test=$(TEST_MSSQL_DO_NVARCHAR_OVERRIDE_TEST) \
|
||||
-coverprofile=mssql.$(TEST_QUOTE_POLICY).$(TEST_CACHE_ENABLE).coverage.out -covermode=atomic
|
||||
|
||||
.PNONY: test-mymysql
|
||||
|
32
vendor/xorm.io/xorm/dialects/mssql.go
generated
vendored
32
vendor/xorm.io/xorm/dialects/mssql.go
generated
vendored
@ -229,7 +229,7 @@ func (db *mssql) SetParams(params map[string]string) {
|
||||
var t = strings.ToUpper(defaultVarchar)
|
||||
switch t {
|
||||
case "NVARCHAR", "VARCHAR":
|
||||
db.defaultVarchar = defaultVarchar
|
||||
db.defaultVarchar = t
|
||||
default:
|
||||
db.defaultVarchar = "VARCHAR"
|
||||
}
|
||||
@ -242,7 +242,7 @@ func (db *mssql) SetParams(params map[string]string) {
|
||||
var t = strings.ToUpper(defaultChar)
|
||||
switch t {
|
||||
case "NCHAR", "CHAR":
|
||||
db.defaultChar = defaultChar
|
||||
db.defaultChar = t
|
||||
default:
|
||||
db.defaultChar = "CHAR"
|
||||
}
|
||||
@ -285,7 +285,7 @@ func (db *mssql) SQLType(c *schemas.Column) string {
|
||||
case schemas.MediumInt:
|
||||
res = schemas.Int
|
||||
case schemas.Text, schemas.MediumText, schemas.TinyText, schemas.LongText, schemas.Json:
|
||||
res = schemas.Varchar + "(MAX)"
|
||||
res = db.defaultVarchar + "(MAX)"
|
||||
case schemas.Double:
|
||||
res = schemas.Real
|
||||
case schemas.Uuid:
|
||||
@ -297,10 +297,26 @@ func (db *mssql) SQLType(c *schemas.Column) string {
|
||||
case schemas.BigInt:
|
||||
res = schemas.BigInt
|
||||
c.Length = 0
|
||||
case schemas.NVarchar:
|
||||
res = t
|
||||
if c.Length == -1 {
|
||||
res += "(MAX)"
|
||||
}
|
||||
case schemas.Varchar:
|
||||
res = db.defaultVarchar
|
||||
if c.Length == -1 {
|
||||
res += "(MAX)"
|
||||
}
|
||||
case schemas.Char:
|
||||
res = db.defaultChar
|
||||
if c.Length == -1 {
|
||||
res += "(MAX)"
|
||||
}
|
||||
case schemas.NChar:
|
||||
res = t
|
||||
if c.Length == -1 {
|
||||
res += "(MAX)"
|
||||
}
|
||||
default:
|
||||
res = t
|
||||
}
|
||||
@ -424,8 +440,18 @@ func (db *mssql) GetColumns(queryer core.Queryer, ctx context.Context, tableName
|
||||
col.SQLType = schemas.SQLType{Name: schemas.TimeStampz, DefaultLength: 0, DefaultLength2: 0}
|
||||
case "NVARCHAR":
|
||||
col.SQLType = schemas.SQLType{Name: schemas.NVarchar, DefaultLength: 0, DefaultLength2: 0}
|
||||
if col.Length > 0 {
|
||||
col.Length /= 2
|
||||
col.Length2 /= 2
|
||||
}
|
||||
case "IMAGE":
|
||||
col.SQLType = schemas.SQLType{Name: schemas.VarBinary, DefaultLength: 0, DefaultLength2: 0}
|
||||
case "NCHAR":
|
||||
if col.Length > 0 {
|
||||
col.Length /= 2
|
||||
col.Length2 /= 2
|
||||
}
|
||||
fallthrough
|
||||
default:
|
||||
if _, ok := schemas.SqlTypes[ct]; ok {
|
||||
col.SQLType = schemas.SQLType{Name: ct, DefaultLength: 0, DefaultLength2: 0}
|
||||
|
8
vendor/xorm.io/xorm/dialects/postgres.go
generated
vendored
8
vendor/xorm.io/xorm/dialects/postgres.go
generated
vendored
@ -857,6 +857,8 @@ func (db *postgres) SQLType(c *schemas.Column) string {
|
||||
res = schemas.Real
|
||||
case schemas.TinyText, schemas.MediumText, schemas.LongText:
|
||||
res = schemas.Text
|
||||
case schemas.NChar:
|
||||
res = schemas.Char
|
||||
case schemas.NVarchar:
|
||||
res = schemas.Varchar
|
||||
case schemas.Uuid:
|
||||
@ -1015,7 +1017,7 @@ WHERE n.nspname= s.table_schema AND c.relkind = 'r'::char AND c.relname = $1%s A
|
||||
|
||||
schema := db.getSchema()
|
||||
if schema != "" {
|
||||
s = fmt.Sprintf(s, "AND s.table_schema = $2")
|
||||
s = fmt.Sprintf(s, " AND s.table_schema = $2")
|
||||
args = append(args, schema)
|
||||
} else {
|
||||
s = fmt.Sprintf(s, "")
|
||||
@ -1086,8 +1088,10 @@ WHERE n.nspname= s.table_schema AND c.relkind = 'r'::char AND c.relname = $1%s A
|
||||
col.Nullable = (isNullable == "YES")
|
||||
|
||||
switch strings.ToLower(dataType) {
|
||||
case "character varying", "character", "string":
|
||||
case "character varying", "string":
|
||||
col.SQLType = schemas.SQLType{Name: schemas.Varchar, DefaultLength: 0, DefaultLength2: 0}
|
||||
case "character":
|
||||
col.SQLType = schemas.SQLType{Name: schemas.Char, DefaultLength: 0, DefaultLength2: 0}
|
||||
case "timestamp without time zone":
|
||||
col.SQLType = schemas.SQLType{Name: schemas.DateTime, DefaultLength: 0, DefaultLength2: 0}
|
||||
case "timestamp with time zone":
|
||||
|
2
vendor/xorm.io/xorm/internal/statements/update.go
generated
vendored
2
vendor/xorm.io/xorm/internal/statements/update.go
generated
vendored
@ -130,7 +130,7 @@ func (statement *Statement) BuildUpdates(tableValue reflect.Value,
|
||||
}
|
||||
}
|
||||
|
||||
if structConvert, ok := fieldValue.Interface().(convert.Conversion); ok {
|
||||
if structConvert, ok := fieldValue.Interface().(convert.Conversion); ok && !fieldValue.IsNil() {
|
||||
data, err := structConvert.ToDB()
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
|
3
vendor/xorm.io/xorm/internal/statements/values.go
generated
vendored
3
vendor/xorm.io/xorm/internal/statements/values.go
generated
vendored
@ -36,6 +36,8 @@ func (statement *Statement) Value2Interface(col *schemas.Column, fieldValue refl
|
||||
}
|
||||
}
|
||||
|
||||
isNil := fieldValue.Kind() == reflect.Ptr && fieldValue.IsNil()
|
||||
if !isNil {
|
||||
if fieldConvert, ok := fieldValue.Interface().(convert.Conversion); ok {
|
||||
data, err := fieldConvert.ToDB()
|
||||
if err != nil {
|
||||
@ -49,6 +51,7 @@ func (statement *Statement) Value2Interface(col *schemas.Column, fieldValue refl
|
||||
}
|
||||
return string(data), nil
|
||||
}
|
||||
}
|
||||
|
||||
fieldType := fieldValue.Type()
|
||||
k := fieldType.Kind()
|
||||
|
6
vendor/xorm.io/xorm/schemas/quote.go
generated
vendored
6
vendor/xorm.io/xorm/schemas/quote.go
generated
vendored
@ -82,10 +82,8 @@ func (q Quoter) JoinWrite(b *strings.Builder, a []string, sep string) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if s != "*" {
|
||||
q.QuoteTo(b, strings.TrimSpace(s))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -143,7 +141,7 @@ func (q Quoter) quoteWordTo(buf *strings.Builder, word string) error {
|
||||
}
|
||||
|
||||
isReserved := q.IsReserved(realWord)
|
||||
if isReserved {
|
||||
if isReserved && realWord != "*" {
|
||||
if err := buf.WriteByte(q.Prefix); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -151,7 +149,7 @@ func (q Quoter) quoteWordTo(buf *strings.Builder, word string) error {
|
||||
if _, err := buf.WriteString(realWord); err != nil {
|
||||
return err
|
||||
}
|
||||
if isReserved {
|
||||
if isReserved && realWord != "*" {
|
||||
return buf.WriteByte(q.Suffix)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user