Commit Graph

64 Commits

Author SHA1 Message Date
Lunny Xiao cb4f310151 Refactor write update (#2310)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2310
2023-07-25 10:49:55 +00:00
Lunny Xiao 9aab1f689c Count will ignore order by as before (#2307)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2307
2023-07-25 09:27:25 +00:00
Lunny Xiao a13564976c refactor write update sql (#2304)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2304
2023-07-24 07:57:05 +00:00
Lunny Xiao 6c29ab378e refactor write insert sql (#2302)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2302
2023-07-22 15:24:19 +00:00
Lunny Xiao 9988dac44d improve write order by (#2301)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2301
2023-07-22 11:52:38 +00:00
Lunny Xiao 96ed5584e3 move sql geneartion for update to statement (#2300)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2300
2023-07-21 16:25:58 +00:00
Lunny Xiao 2df56f033a Some refactors (#2293)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2293
2023-07-20 14:45:31 +00:00
Lunny Xiao f1f5e7cd1a Some refactor (#2292)
replace #2285

Reviewed-on: https://gitea.com/xorm/xorm/pulls/2292
2023-07-12 07:53:25 +00:00
Lunny Xiao 79a8bc804b Fix join problem (#2291)
Fix #2284

Reviewed-on: https://gitea.com/xorm/xorm/pulls/2291
2023-07-12 02:01:56 +00:00
Lunny Xiao caa8a029c6 some optimzation (#2272)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2272
2023-06-02 14:16:30 +00:00
Lunny Xiao f1bfc5ce98 join support condition (#2201)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2201
2022-12-09 23:37:26 +08:00
Lunny Xiao f9a6990ecb Refactor orderby and support arguments (#2150)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2150
2022-05-31 11:00:28 +08:00
Andrew Thornton 60540cbabe Remove const insertSelectPlaceholder and associated dead code (#2151)
`insertSelectPlaceholder` is an unexported const set at true. No code changes this nor can any build environment change it.

Therefore we should remove it and the associated dead code.

Close #2146

Signed-off-by: Andrew Thornton <art27@cantab.net>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2151
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-committed-by: Andrew Thornton <art27@cantab.net>
2022-05-30 00:29:03 +08:00
Lunny Xiao f7e9fb74ac return a clear error for set TEXT type as compare condition (#2062)
Fix #523

Reviewed-on: https://gitea.com/xorm/xorm/pulls/2062
2022-04-23 17:19:37 +08:00
fuge d13b607d75 oracle分页,start 为 0 的bug (#2098)
删除前面判断即可。

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2098
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: fuge <fuge@noreply.gitea.io>
Co-committed-by: fuge <fuge@noreply.gitea.io>
2022-01-16 18:04:24 +08:00
Lunny Xiao a2d3669edf Add README and fix some lints (#2079)
as title.

Reviewed-on: https://gitea.com/xorm/xorm/pulls/2079
2021-12-14 09:00:35 +08:00
linbaozhong 4f8f829913 exist方法sql语句优化 (#2075)
本地没有mssql和oracle,所以没法测试,但是,mysql 使用select 1 from TABLENAME where CONDITION limit 1可能更好

Reviewed-on: https://gitea.com/xorm/xorm/pulls/2075
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: linbaozhong <linbaozhong@noreply.gitea.io>
Co-committed-by: linbaozhong <linbaozhong@noreply.gitea.io>
2021-12-01 13:54:47 +08:00
Lunny Xiao 16cf2442f6 Some performance optimization for get (#2043)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2043
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-09-07 16:03:08 +08:00
finelog e5c89cf55e fix panic when convert sql and args with nil time.Time pointer (#2038)
this pr fix a panic, when using nil time.Time pointer for input.
not sure if there are others similar code.
please review it, thanks!

Co-authored-by: finelog <kaicltw@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2038
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: finelog <finelog@noreply.gitea.io>
Co-committed-by: finelog <finelog@noreply.gitea.io>
2021-08-26 00:03:18 +08:00
Lunny Xiao c29b9649a9 Add dameng support (#2007)
driver: https://gitee.com/travelliu/dm
docker: https://download.dameng.com/eco/dm8/dm8_docker.tar

fix #1837

Reviewed-on: https://gitea.com/xorm/xorm/pulls/2007
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-08-24 13:46:08 +08:00
Lunny Xiao cace6862e2 Move convert back to xorm.io/xorm/convert (#2030)
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>
2021-08-10 23:20:53 +08:00
Lunny Xiao 42c2f158e8 Fix timesatmp (#2021)
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>
2021-08-04 16:12:10 +08:00
Lunny Xiao aeed22016f Support batch insert map (#2019)
Fix #1767

Reviewed-on: https://gitea.com/xorm/xorm/pulls/2019
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-29 16:12:09 +08:00
Andrew Thornton d973423802 Fix issue with byte representation in MSSQL (#1957)
There is a missing cast to string in BuildUpdates which leads to a failure
to call str2ucs and ucs2str for converts on MSSQL.

Ref: https://github.com/go-gitea/gitea/issues/16252

Signed-off-by: Andrew Thornton <art27@cantab.net>

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1957
Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-committed-by: Andrew Thornton <art27@cantab.net>
2021-07-23 09:01:49 +08:00
Lunny Xiao 47cfe0347f Add test for limit with query (#1787)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1787
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-21 21:13:15 +08:00
Lunny Xiao 107bee4eb4 refactor conversion (#2001)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2001
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-21 11:46:41 +08:00
Lunny Xiao a7e010df2d refactor insert condition generation (#1998)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1998
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-20 13:46:24 +08:00
Lunny Xiao b296c8f1d7 Exec with time arg now will obey time zone settings on engine (#1989)
Fix #1770

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1989
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-14 12:20:26 +08:00
andreasgerstmayr 147328f629 fix possible null dereference in internal/statements/query.go (#1988)
Make sure that pLimitN is not `nil` before dereferencing the pointer.

Co-authored-by: Andreas Gerstmayr <agerstmayr@redhat.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1988
Co-authored-by: andreasgerstmayr <andreasgerstmayr@noreply.gitea.io>
Co-committed-by: andreasgerstmayr <andreasgerstmayr@noreply.gitea.io>
2021-07-12 23:51:50 +08:00
Lunny Xiao 394c4e1f17 Replace #1044 (#1935)
Fix #1372, #765

TODO:

- [x] Add tests

Co-authored-by: MURAOKA Taro <koron.kaoriya@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1935
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-11 21:33:01 +08:00
Lunny Xiao b754e78269 Support big.Float (#1973)
Now you can use big.Float for numeric type.

```go
type MyMoney struct {
	Id int64
    Money big.Float `xorm:"numeric(22,2)"`
}
```

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1973
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-07 14:00:16 +08:00
Lunny Xiao 962962bb64 Fix #929 (#1936)
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>
2021-07-03 20:26:49 +08:00
Lunny Xiao 8f8195a86b Improve get field value of bean (#1961)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1961
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-06-29 14:32:29 +08:00
Lunny Xiao 5a58a272bc fix lint (#1953)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1953
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-06-15 20:28:49 +08:00
Lunny Xiao bc25b4128b Fix #1663 (#1952)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1952
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-06-14 11:23:05 +08:00
Lunny Xiao 7864cb5ae6 refactor exprParam (#1825)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1825
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-06-09 09:05:50 +08:00
Lunny Xiao 0f69f1eda2 Fix exist (#1921)
Fix #1818

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1921
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-06-07 13:45:29 +08:00
Lunny Xiao 409cb7c0f1 Fix findandcount or count with groupby (#1915)
Fix #1022, #1221, #1726, #1836, #1910.

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1915
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-06-06 20:21:39 +08:00
Lunny Xiao ce2a743e88 Fix comments (#1896)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1896
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-04-12 16:00:07 +08:00
Lunny Xiao bd9535d781 Fix comments (#1893)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1893
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-04-12 09:19:08 +08:00
Lunny Xiao beac298c02 Fix json tag with other type (#1822)
Fix json tag with other type

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1822
Co-Authored-By: Lunny Xiao <xiaolunwen@gmail.com>
Co-Committed-By: Lunny Xiao <xiaolunwen@gmail.com>
2020-11-03 17:10:35 +08:00
Lunny Xiao 1b200bdcba Fix bug of ToDB when update on a nil pointer (#1786)
Fix test

Fix bug

Fix bug

Add test for insert nil struct field

Fix test

Fix bug of ToDB when update on a nil pointer

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1786
2020-09-08 15:40:26 +00:00
Lunny Xiao b08f962d7a Fix bug when ID used but no reference table given (#1709)
Fix bug when ID used but no reference table given

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1709
2020-06-13 01:20:25 +00:00
Lunny Xiao 8ebcb8b557 Fix find with another struct (#1666)
Fix find with another struct

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1666
2020-04-26 11:34:05 +00:00
rosbit 7e981f5f5e fix bug for mis-converting uint64 to int64 (#1647)
fix bug for mis-converting uint64 to int64

Co-authored-by: rosbit <me@rosbit.cn>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1647
2020-04-05 04:49:44 +00:00
Lunny Xiao 2ac051f075 Improve insert map generating SQL (#1634)
Fix writeArg

Improve insert map generating SQL

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1634
2020-03-27 03:13:25 +00:00
Lunny Xiao 656cf6e5d6 Fix find and count bug (#1622)
Fix find and count bug

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1622
2020-03-23 14:39:52 +00:00
Lunny Xiao 9500b23395 Fix pk bug (#1602)
Fix pk bug

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1602
2020-03-13 08:57:34 +00:00
Lunny Xiao 94fd254638 Support count with cols (#1595)
Support count with cols

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1595
2020-03-11 03:29:43 +00:00
Lunny Xiao 36e26e35ed 解决Conversion接口ToDB() ([]byte, error)方法返回*Type值为nil时,数据类型为[]byte(nil)的… (#1296)
add test

解决Conversion接口ToDB() ([]byte, error)方法返回*Type值为nil时,数据类型为[]byte(nil)的bug,解决*Type值为nil时插入数据变为""的bug

Co-authored-by: peihexian <peihexian@qq.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1296
2020-03-10 03:02:31 +00:00