Commit Graph

110 Commits

Author SHA1 Message Date
CyJaySong 0a32882a51 Merge branch 'xorm-v1' into cyjay-v1 2024-10-14 14:08:35 +08:00
Dacian Stanciu 4e74c80b67 fix: Legacy MsSQL - legacy offset select sql command bug #2446 (#2448)
fix for MsSQL legacy bug

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2448
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Dacian Stanciu <daci28@yahoo.com>
Co-committed-by: Dacian Stanciu <daci28@yahoo.com>
2024-04-24 13:47:05 +00:00
CyJaySong 805f4ebdaf Merge branch 'xorm-v1' into cyjay-v1 2024-04-09 14:09:51 +08:00
tylerthail2019 589acfff86 Add includeNil requiredField Check when custom struct field IsZero in Update method. (#2438)
Add includeNil requiredField Check when custom struct field IsZero in Update method.

Co-authored-by: tyler <tyler@mbp.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2438
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: tylerthail2019 <tylerthail2019@noreply.gitea.com>
Co-committed-by: tylerthail2019 <tylerthail2019@noreply.gitea.com>
2024-04-02 04:26:41 +00:00
tylerthail2019 34e62e9b4c add IsZero check for custom struct column in the Update method (#2417)
Co-authored-by: tyler <tyler@mbp.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2417
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: tylerthail2019 <tylerthail2019@noreply.gitea.com>
Co-committed-by: tylerthail2019 <tylerthail2019@noreply.gitea.com>
2024-03-18 06:43:33 +00:00
CyJaySong 8f07aa25b9 💥 NoAutoCondition 不再影响deleted条件生成,deleted条件仅由Unscoped控制 2024-02-26 09:46:34 +08:00
CyJaySong 63222312b2 Fix the issue of incorrect insertion of data in non UTC time zone zero for numeric types (#2413)
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>
2024-02-25 16:16:56 +00:00
CyJaySong 3e6294dc7e Merge remote-tracking branch 'xorm/v1' into v1 2024-02-20 14:31:15 +08:00
Kos 11e96d9654 Update internal/statements/legacy_select.go (#2400)
fix #2399, When Oracle enables USE_LEGACY_LIMIT_OFFSET, the Where condition fails

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2400
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Kos <kos@noreply.gitea.com>
Co-committed-by: Kos <kos@noreply.gitea.com>
2024-02-05 11:13:17 +00: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
CyJaySong 2255193c57 Fix code 2023-10-30 09:23:20 +08:00
CyJaySong 056952e17a Fix code 2023-10-30 09:17:50 +08:00
CyJaySong 408217218b Fix code 2023-10-28 16:19:00 +08:00
CyJaySong d3926afde6 Fix code 2023-10-28 16:09:58 +08:00
CyJaySong 85502d4779 Revert "Revert "Fix deleted tag attribute zeroTime is not DatabaseTZ (#2299)" (#2341)"
This reverts commit dbe49909
2023-10-28 15:39:42 +08:00
CyJaySong f758792496 Merge branch 'master' into main2
# Conflicts:
#	tests/session_insert_test.go
2023-10-28 15:25:15 +08:00
CyJaySong 6f9df57c50 Fix code 2023-10-28 15:19:43 +08:00
CyJaySong 747a357ea9 Fix the issue of incorrect insertion of data in non UTC time zone zero for numeric types 2023-10-28 15:18:48 +08:00
Lunny Xiao 37fd7d3c15 some refactors for write functions (#2342)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2342
(cherry picked from commit 0f085408af)
2023-10-28 10:05:02 +08:00
FlyingOnion c73fc585bb 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>
(cherry picked from commit 551de3767c)
2023-10-28 09:53:09 +08:00
CyJaySong ad73876977 Merge remote-tracking branch 'cyjay/master' 2023-10-28 09:51:12 +08:00
CyJaySong 24540c9e23 Fix the issue of incorrect insertion of data in non UTC time zone zero for numeric types 2023-10-28 09:49:51 +08: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
CyJaySong 9e362d7913 Merge branch 'master'
# Conflicts:
#	convert/time.go
2023-07-26 15:35:54 +08: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
CyJay 48cf8bb174 Merge branch 'master'
# Conflicts:
#	convert/time.go
2023-07-21 09:07:56 +08:00
Lunny Xiao 2df56f033a Some refactors (#2293)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2293
2023-07-20 14:45:31 +00:00
CyJaySong a6b31d79d7 fix conditions build on MSSQL 2023-07-14 17:50:54 +08: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