Lunny Xiao
f29e003dc2
fix
2023-10-27 22:09:50 +08:00
Lunny Xiao
663ef134ae
mod tidy
2023-10-27 22:07:58 +08:00
Lunny Xiao
918945760b
Fix test
2023-10-27 22:05:37 +08:00
Lunny Xiao
7676174223
Merge branch 'main' into lunny/v2
2023-10-27 13:58:36 +00:00
Lunny Xiao
3b4c1be57a
cache tools ( #2353 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2353
2023-10-27 13:58:13 +00:00
Lunny Xiao
909e80116c
Merge branch 'main' into lunny/v2
2023-10-27 17:23:03 +08:00
Lunny Xiao
05a8643056
Remove mymysql driver since it's unmaintained for a long time ( #2349 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2349
2023-10-27 09:21:35 +00:00
Lunny Xiao
8eeb1ef8ac
Some refactors ( #2348 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2348
2023-10-27 09:16:46 +00:00
Lunny Xiao
c4bd79183d
update documentations
2023-10-27 16:30:08 +08:00
Lunny Xiao
41154ea9ae
start v2
2023-10-27 15:32:38 +08:00
Lunny Xiao
6ef0a7798f
Fix bug when join with alias start with `a` ( #2343 )
...
Fix #2331
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2343
2023-10-25 11:01:46 +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
zzdboy
3eda0f7805
fix KingbaseES version ( #2335 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2335
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zzdboy <28206697@qq.com>
Co-committed-by: zzdboy <28206697@qq.com>
2023-09-24 03:52:50 +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
Ryan Liu
ac88a5705a
fix the error in mysql: unknown colType UNSIGNED FLOAT ( #2143 )
...
Error: unknown colType UNSIGNED FLOAT
in mysql 5.6.27 or 5.7.32
Fix #2123
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2143
Co-authored-by: Ryan Liu <azhai@126.com>
Co-committed-by: Ryan Liu <azhai@126.com>
2023-09-16 15:43:12 +00:00
6543
e5be0f4129
Remove dead code from session.SyncWithOptions() ( #2323 )
...
db7c264062/sync.go (L229-L231)
as oriIndex only is **not** nil if index.Equal(index2)
and index.Equal(index2) check if `oriIndex.Type == index.Type` ... so it always is false
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2323
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
Co-committed-by: 6543 <6543@obermui.de>
2023-09-16 14:41:02 +00:00
zzdboy
2885c88b77
fix PostgreSQL version ( #2332 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2332
Co-authored-by: zzdboy <28206697@qq.com>
Co-committed-by: zzdboy <28206697@qq.com>
2023-09-16 13:49:19 +00:00
Lunny Xiao
407375c9b4
Add test for max ( id ) ( #2316 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2316
2023-09-16 13:48:49 +00:00
Lunny Xiao
eeacd22674
Fix ci ( #2330 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2330
2023-09-13 02:02:12 +00:00
6543
db7c264062
Add Sync options to ignore constrains and indices ( #2320 )
...
needed for https://github.com/woodpecker-ci/woodpecker/pull/2117
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2320
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
Co-committed-by: 6543 <6543@obermui.de>
2023-08-09 03:28:52 +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
c622cdaf89
Add ignore
2023-07-26 18:46:36 +08:00
Lunny Xiao
e2af77de3b
remove unused files
2023-07-26 18:45:28 +08:00
Lunny Xiao
ed1a37b1c5
Move integrations -> tests ( #2314 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2314
2023-07-26 10:44:41 +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
12ec038853
Add test for get customized types ( #2194 )
...
Fix #2097
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2194
2023-07-26 03:03:01 +00:00
takumin
1572367155
Add dialects/time_test.go ( #2169 )
...
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2169
Co-authored-by: takumin <takumiiinn@gmail.com>
Co-committed-by: takumin <takumiiinn@gmail.com>
2023-07-26 00:57:40 +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
4109ce1e23
Fix a serious bug when using rows and reuse the session ( #2309 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2309
2023-07-25 08:37:12 +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
arturwwl
24a672be3c
convert - String2Time accept HH:mm:ss format ( #2074 )
...
resolves #2073
Co-authored-by: arturwwl <>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2074
Co-authored-by: arturwwl <arturwwl@noreply.gitea.com>
Co-committed-by: arturwwl <arturwwl@noreply.gitea.com>
2023-07-23 02:34:10 +00:00
Lunny Xiao
3626de1459
mod tidy ( #2303 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2303
2023-07-23 01:31:59 +00:00
datbeohbbh
c0d09c0def
update go version in `go.mod` ( #2224 )
...
Hi! I would like to request an update to the `go.mod` file.
Co-authored-by: datbeohbbh <phongtomfapp@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2224
Co-authored-by: datbeohbbh <datbeohbbh@noreply.gitea.com>
Co-committed-by: datbeohbbh <datbeohbbh@noreply.gitea.com>
2023-07-23 01:30:49 +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
dabcb4c0ee
Return error if count returned no row ( #2298 )
...
Fix #2139
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2298
2023-07-20 14:48:29 +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
LinkinStars
9b71cb49cc
The loadTableInfo function supports passing the context. ( #2297 )
...
## `loadTableInfo` add context parameter
### Main change
```diff
+++ func (engine *Engine) loadTableInfo(ctx context.Context, table *schemas.Table) error
--- func (engine *Engine) loadTableInfo(table *schemas.Table) error
```
### Situation
After #2200 , I built custom dialect to control the SQL. I find that everything else is fine, except when the `SYNC` method executes with an exception.
The reason is that the `loadTableInfo` method calls the `GetIndexes` and `GetColumns` methods with the dialect during execution. **The context passed to these two methods are all `engine.defaultContext` not the current session's context.** So, I think the `loadTableInfo` method should add the context parameter to ensure that the correct context is used during execution.
### Review Note
1. dialect's `GetColumns` and `GetIndexes` methods are **only** used here, if the context here is incorrect, then the context parameter is invalid.
2. `loadTableInfo` method is only used in `SYNC` and `DBMetas` methods, `SYNC` should pass the session's context, while `DBMetas` has no problem passing `engine.defaultContext`.
All in all, I think this change should not affect other function.
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2297
Co-authored-by: LinkinStars <linkinstar@foxmail.com>
Co-committed-by: LinkinStars <linkinstar@foxmail.com>
2023-07-14 07:35:35 +00:00
CyJaySong
0b18440d73
fix time parse layout ( #2296 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2296
Co-authored-by: CyJaySong <cyjaysong@gmail.com>
Co-committed-by: CyJaySong <cyjaysong@gmail.com>
2023-07-14 07:34:02 +00:00
Lunny Xiao
f33221df74
Fix question mark replacement on postgres ( #2202 )
...
Fix #2112
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2202
2023-07-12 13:22:32 +00:00
takumin
722f1cc141
Generate coverage html ( #2170 )
...
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2170
Co-authored-by: takumin <takumiiinn@gmail.com>
Co-committed-by: takumin <takumiiinn@gmail.com>
2023-07-12 13:01:34 +00:00
Lunny Xiao
3b53a5f847
upgrade dependencies ( #2223 )
...
Fix #2209
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2223
2023-07-12 11:06:39 +00:00
洪坤安
73eee961cc
Performance Optimization: reduce slice2Bean calling times of strings.ToLower and map creation times ( #2255 )
...
1. 优化性能:减少func (session *Session) slice2Bean方法中的strings.ToLower调用次数以及减少map创建和访问次数(见工单 https://gitea.com/xorm/xorm/issues/2243)
2. 新增SetDefaultJSONHandler方法,用于用户自行设置DefaultJSONHandler(见工单 https://gitea.com/xorm/xorm/issues/2129)
优化前:
加载耗时=16.079s,总记录数=4028940
加载耗时=15.775s,总记录数=4028940
加载耗时=15.946s,总记录数=4028940
优化后:
加载耗时=10.863s,总记录数=4028940
加载耗时=11.257s,总记录数=4028940
加载耗时=11.155s,总记录数=4028940
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2255
Co-authored-by: 洪坤安 <wuzili1234@163.com>
Co-committed-by: 洪坤安 <wuzili1234@163.com>
2023-07-12 09:53:19 +00:00
martinvigg
55d9407390
mysql: add CHAIN, RANK to reserved word list ( #2282 )
...
Reference: https://dev.mysql.com/doc/refman/8.0/en/keywords.html
Co-authored-by: Martin Viggiano <martin.viggiano@stonebranch.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2282
Co-authored-by: martinvigg <martinvigg@noreply.gitea.com>
Co-committed-by: martinvigg <martinvigg@noreply.gitea.com>
2023-07-12 08:52:23 +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