Lunny Xiao
1c0a25c2b7
Fix distinct count
2024-01-31 18:04:27 +08:00
Lunny Xiao
0398dee813
Implement update join ( #2383 ) ( #2385 )
...
backport #2383
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2383
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2385
2023-12-30 10:50:02 +00:00
Lunny Xiao
cc28d99161
Fix use hint with join bug ( #2384 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2384
2023-12-30 06:28:44 +00:00
Lunny Xiao
7ae7474bcb
Add missing index hint parameter ( #2378 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2378
2023-12-19 04:54:04 +00:00
Lunny Xiao
b571d91858
Add index hint support ( #2375 )
...
Fix #1456
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2375
2023-12-15 02:17:13 +00:00
Lunny Xiao
c855ca4e59
Some refactors ( #2348 ) ( #2352 )
...
backport #2348
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2348
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2352
2023-10-27 14:01:14 +00:00
Lunny Xiao
0f085408af
some refactors for write functions ( #2342 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2342
2023-10-25 07:11:18 +00:00
lng2020
dbe499091a
Revert "Fix deleted tag attribute zeroTime is not DatabaseTZ ( #2299 )" ( #2341 )
...
Related #2339
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2341
Co-authored-by: lng2020 <nanguanlin6@gmail.com>
Co-committed-by: lng2020 <nanguanlin6@gmail.com>
2023-10-17 09:41:42 +00:00
FlyingOnion
551de3767c
modify limit offset implement ( #2188 )
...
Oracle and SQLServer specific: When `LIMIT OFFSET` function is needed, use `OFFSET <offset> ROWS FETCH NEXT <limit> ROWS ONLY` to replace legacy subquery.
SQLServer specific: When `ORDER BY` is not set and `OFFSET FETCH` is set, set `statement.orderStr` to `1` (`ORDER BY 1`). See [here](https://learn.microsoft.com/zh-cn/sql/t-sql/queries/select-order-by-clause-transact-sql?view=sql-server-ver16 ).
MySQL specific: When limit is 0 and offset > 0, use `LIMIT 9223372036854775807` ($2^{63}-1$). See comments [here](15d171ea55/internal/statements/query.go (L314)
).
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2188
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: FlyingOnion <731677080@qq.com>
Co-committed-by: FlyingOnion <731677080@qq.com>
2023-09-20 02:07:03 +00:00
Lunny Xiao
ac84217e14
Exec support conversion data ( #1970 )
...
Fix #1803
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1970
2023-08-07 10:54:57 +00:00
CyJaySong
94882e39df
Fix deleted tag attribute zeroTime is not DatabaseTZ ( #2299 )
...
Co-authored-by: CyJay <cyjay@MacBook-Pro.lan>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2299
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: CyJaySong <CyJaySong@gmail.com>
Co-committed-by: CyJaySong <CyJaySong@gmail.com>
2023-08-07 04:28:55 +00:00
Lunny Xiao
47003ff937
Delete Limit with start will return error because it's not supported by database ( #1895 )
...
Fix #1894
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1895
2023-07-26 06:58:55 +00:00
Lunny Xiao
59b727260d
Check orderby validate ( #2313 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2313
2023-07-25 14:02:38 +00:00
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
datbeohbbh
52855dae32
update go version to v1.17 in .drone.yml ( #2219 )
...
issue: #2218
Co-authored-by: datbeohbbh <phongtomfapp@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2219
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: datbeohbbh <datbeohbbh@noreply.gitea.io>
Co-committed-by: datbeohbbh <datbeohbbh@noreply.gitea.io>
2023-02-12 11:16:53 +08: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
dbc2de380b
Refactor find ( #2031 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2031
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-08-11 21:17:23 +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
Lunny Xiao
5240459858
Move assign functions to convert package ( #2015 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2015
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-28 15:15:35 +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
raizen666
5950824e37
Support build flag go-json to replace default json ( #1982 )
...
`go build -tags=gojson` to use `github.com/goccy/go-json` as default json handler
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1982
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: raizen666 <raizen666@noreply.gitea.io>
Co-committed-by: raizen666 <raizen666@noreply.gitea.io>
2021-07-19 12:49:50 +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