Fix the issue of incorrect insertion of data in non-UTC time zone zero for numeric types
Co-authored-by: CyJay <cyjay@MacBook-Pro.lan>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2413
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: CyJaySong <CyJaySong@gmail.com>
Co-committed-by: CyJaySong <CyJaySong@gmail.com>
The behavior of multi insertion of null differs from that of single insertion.
On the other hand, behavior between single and bulk insertion of null using pointer of struct field is identical.
Please see the example below.
```go
s := engineGroup.NewSession()
type User struct {
ID int `xorm:"not null pk autoincr INT(10)"`
Name string `xorm:"not null VARCHAR(191)"`
Age int64 `xorm:"null BIGINT(20)"`
}
list := []*User{
{
Name: "John",
},
{
Name: "Wick",
},
}
s.Nullable("age")
// Single insertion works
_, err := s.Insert(list[0]) // [table] `user` INSERT INTO `user` (`name`,`age`) VALUES (?, ?) [John <nil>]
s.Nullable("age")
// Bulk insertion does not work
_, err := s.Insert(list) // [table] `user` INSERT INTO `user` (`name,`age`) VALUES (?, ?),(?, ?) [John, 0, Wick, 0]
//---------------------------------
//Using pointer, which is nullable, the generated sql has no difference.
//---------------------------------
type User struct {
ID int `xorm:"not null pk autoincr INT(10)"`
Name string `xorm:"not null VARCHAR(191)"`
Age *int64 `xorm:"null BIGINT(20)"`
}
list := []*User{
{
Name: "John",
},
{
Name: "Wick",
},
}
s.Nullable("age")
// Single insertion works
_, err := s.Insert(list[0]) // [table] `user` INSERT INTO `user` (`name`,`age`) VALUES (?, ?) [John <nil>]
s.Nullable("age")
// Bulk insertion does not work
_, err := s.Insert(list) // [table] `user` INSERT INTO `user` (`name,`age`) VALUES (?, ?),(?, ?) [John, <nil>, Wick, <nil>]
```
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2077
Co-authored-by: satorunooshie <satorunooshie@noreply.gitea.io>
Co-committed-by: satorunooshie <satorunooshie@noreply.gitea.io>
Since `conversion.Conversion` has been referenced by external package, it should not be moved as internal package.
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2030
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
Now `Datetime` support `Datime(6)` to indicate the time scale. For different database , the max scale is not different.
`Datetime` means `Datetime(0)`.
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2021
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
sql server doesn't accept to insert a blank datetime like `0001-01-01 00:00:00`. So that we have a break change here that deleted column should not have a notnull tag.
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1936
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
Remove depreciated functions and move some functions to schemas
Move zero functions to a standalone package
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1548
Merge branch 'master' into jcsalem/fix/nil_ptr_is_nullable
fix bug when buffersize with iterate (#941)
Merge branch 'master' into lunny/fix_buffer_iterate
Exclude schema from index name (#1505)
Merge branch 'master' into fix-schema-idx
SetExpr support more go types (#1499)
Improve tests
SetExpr support more go types
fix vet
fix drone lint
remove go1.10 test on drone
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499
fix vet
fix drone lint
remove go1.10 test on drone
Exclude schema from the index name
Co-authored-by: Guillermo Prandi <guillep2k@users.noreply.github.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1505
fix test
fix bug
fix bug when buffersize with iterate
SetExpr support more go types (#1499)
Improve tests
SetExpr support more go types
fix vet
fix drone lint
remove go1.10 test on drone
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499
fix vet
fix drone lint
remove go1.10 test on drone
Fix update with Alias (#1455)
Co-authored-by: Guillermo Prandi <guillep2k@noreply.gitea.io>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/941
fix update map with version (#1448)
fix test
fix update map with version
SetExpr support more go types (#1499)
Improve tests
SetExpr support more go types
fix vet
fix drone lint
remove go1.10 test on drone
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499
fix vet
fix drone lint
remove go1.10 test on drone
Fix update with Alias (#1455)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1448
Exclude schema from index name (#1505)
Merge branch 'master' into fix-schema-idx
SetExpr support more go types (#1499)
Improve tests
SetExpr support more go types
fix vet
fix drone lint
remove go1.10 test on drone
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499
fix vet
fix drone lint
remove go1.10 test on drone
Exclude schema from the index name
Co-authored-by: Guillermo Prandi <guillep2k@users.noreply.github.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1505
SetExpr support more go types (#1499)
Improve tests
SetExpr support more go types
fix vet
fix drone lint
remove go1.10 test on drone
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499
For nullable columns, store nil values as NULL
fix vet
fix drone lint
remove go1.10 test on drone
Fix update with Alias (#1455)
Improve ci tests (#1477)
Rewrite Engine.QuoteTo() to accept multi-part identifiers (#1476)
Support local sql log (#1338)
Fix go mod and update version (#1460)
Move github.com/go-xorm/xorm to xorm.io/xorm (#1459)
add support custom type Nullfloat64 (#1450)
fix bug when query map condtion with no quote (#1449)
Don't warn when bool column default is 1 but not true (#1447)
* don't warn when bool column default is 1 but not true
* fix default case sensitive
Fix sync2 with custom table name (#1445)
* fix sync2 with custom table name
* fix bug on postgres
* fix bug on postgres
fix bug when update with setexpr (#1446)
add tidb tests on drone ci (#1444)
improve sync2 (#1443)
Fix wrong dbmetas (#1442)
* add tests for db metas
* add more tests
* fix bug on mssql
Fix default value parse bugs (#1437)
* fix default value
* fix default value tags
* fix postgres default
* fix default on postgres
* fix default on postgres
* fix mssql default
fix arg conversion (#1441)
* fix arg conversion
* fix bugs
* fix bug on postgres
* use traditional positional parameters on insert into select
* remove unnecessary tests
upgrade core (#1440)
add tests (#1439)
add go1.13 tests on drone (#1416)
Fix bug on insert where (#1436)
* fix bug on insert where
* fix bug
* fix lint
fix bug when insert multiple slices with customize table name (#1433)
* fix bug when insert multiple slices with customize table name
* fix tests on mssql
* fix tests
fix insert where with bool bug on mssql (#1432)
fix setexpr missing big quotes (#1431)
* fix setexpr missing big quotes
* fix tests
* fix tests
Add support subquery on SetExpr (#1428)
* add support subquery on SetExpr
* fix tests
fix go mod (#1427)
fix tests (#1429)
Use strings.Builder instead of builder.StringBuilder (#1417)
* use strings.Builder instead of builder.StringBuilder
* fix dependency
* fix dependency
Remove unuse get cols code (#1413)
Add mssql ci test (#1410)
* add mssql ci test
* fix drone test
Add insert select where support (#1401)
Use drone new format (#1388)
* use drone new format
fix get customize type bug (#1382)
fix bugs (#1375)
update drone (#1374)
Add tests for get var (#1305)
* add test for SQL get
* fix tests
fix error when get null var (#890)
* fix error when get null var
* add support get for null var
* fix bug
Remove quotestr totally (#1366)
* remove QuoteStr() totally
* update xorm.core -> v0.7.0
* update dialect Quote
remove QuoteStr() usage in dialects (#1364)
document of FindAndCount() (#1365)
remove QuoteStr() usage (#1360)
make sure timeout in context timeout t...
Co-authored-by: Guillermo Prandi <guillep2k@noreply.gitea.io>
Co-authored-by: Jim Salem <jim@komand.com>
Co-authored-by: Guillermo Prandi <guillep2k@noreply@gitea.io>
Co-authored-by: yudppp <yu.d.ppp@gmail.com>
Co-authored-by: BetaCat <outman99@hotmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/531
* add SetSchema for engine
* fix user
* fix postgres with schema
* fix test
* fix test
* fix test
* fix tablename
* refactor tableName
* fix schema support
* improve the interface of EngineInterface