1
1
forked from xorm/xorm

master #2

Merged
hsfish merged 13 commits from xorm/xorm:master into master 2023-07-03 10:15:53 +00:00
Owner
No description provided.
hsfish added 13 commits 2023-07-03 10:15:31 +00:00
This pr fixes a bug caused when a timestmap in TZ format with milliseconds (`2023-04-05T15:50:48.256816Z` or `2023-04-05T15:50:48.256816+08:00`) is being parsed.

- The bug is happens in the function `String2Time` in `convert/time.go`
- if the timestamp contains milliseconds a layout with the structure `2006-01-02 15:04:05.` is used to parse it
- This layout contains an space between the date and the hour, if the timestamp returned by the db contains a `T` the parser fails and an error is returned

This pr adds a check for the `T` and milliseconds in the timestamp, if both conditions are present the date is parsed using the RFC3339 layout

Added test cases to check timestamps in this format

Solves [#2244](xorm/xorm#2244)

Reviewed-on: xorm/xorm#2246
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Alberto Garcia <agarcia@circutor.com>
Co-committed-by: Alberto Garcia <agarcia@circutor.com>
Fix session insert interface slice commit panic(#2259)
-- TestInsertMulti2InterfaceTransaction is the test case

Reviewed-on: xorm/xorm#2260
Co-authored-by: Abei1uo <2676567028@qq.com>
Co-committed-by: Abei1uo <2676567028@qq.com>
- Fixed quotes on drop table SQL statement.
- Implemented IsSequenceExists function for oracle dialect.

Reviewed-on: xorm/xorm#2265
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Martin Viggiano <martinvigg@gmail.com>
Co-committed-by: Martin Viggiano <martinvigg@gmail.com>
业务场景中,需要预留(1 ~ 100)的ID给系统规则使用。所以会先使用插入将AutoIncrement列的id偏移到一个特定的值(如:100),然后“带ID调用Insert插入系统规则”。 当带ID插入时,由于没有commit,会被rollback掉。

Reviewed-on: xorm/xorm#2264
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: brookechen <brookechen@noreply.gitea.io>
Co-committed-by: brookechen <brookechen@noreply.gitea.io>
Reviewed-on: xorm/xorm#2258
The image has already specified the entrypoint so we don't need to call `/cockroach/cockroach` in `cmd`.
![image](/attachments/669496c1-5673-4609-abc7-f42846e4d479)

Reviewed-on: xorm/xorm#2269
Co-authored-by: Zettat123 <zettat123@gmail.com>
Co-committed-by: Zettat123 <zettat123@gmail.com>
```diff
// Filter is an interface to filter SQL
type Filter interface {
---	Do(sql string) string
+++	Do(ctx context.Context, sql string) string
}
```

### Adds a `Context` parameter to the `Do` method of the Filter interface.

Developers can rewrite SQL through the `Filter` `Do` method and **need to get the necessary data from the Context** to assist.

For example, get user information through `Context`, so that different users can use different tables. Another example is to get the flags through `Context` to add annotations to the SQL, and use the annotations to let the subsequent `DB-Proxy` to achieve read/write separation.

Reviewed-on: xorm/xorm#2270
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: LinkinStars <linkinstar@foxmail.com>
Co-committed-by: LinkinStars <linkinstar@foxmail.com>
Reviewed-on: xorm/xorm#2272
Copy the sql.RawBytes when converting to []byte.
Fix issue xorm/xorm#2273

Co-authored-by: Bingjia Chen <bingjia.chen@seamoney.com>
Reviewed-on: xorm/xorm#2274
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: ccbhj <ccbhj@noreply.gitea.com>
Co-committed-by: ccbhj <ccbhj@noreply.gitea.com>
Reviewed-on: xorm/xorm#2279
Reviewed-on: xorm/xorm#2280
Fix #237
Fix #2179

Reviewed-on: xorm/xorm#2283
PostgreSQL有两种char类型:`character`和`"char"`: https://www.postgresql.org/docs/current/datatype-character.html.

`pg_class`里的`relkind`是`"char"`类型,所以`GetColumns`这里应该转成`::"char"`或者和本PR里请求的一样去掉转换。这样对于PostgreSQL以及其他兼容PostgreSQL的数据库容错性更好,在做比较时它们通常都会被隐式转换。
```sql
postgres=# select pg_typeof(relkind), pg_typeof('a'::char), pg_typeof('a'::"char") from pg_class limit 1;
 pg_typeof | pg_typeof | pg_typeof
-----------+-----------+-----------
 "char"    | character | "char"
(1 row)
```

Co-authored-by: August <pin@singularity-data.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: xorm/xorm#2278
Co-authored-by: flyingpigge <flyingpigge@noreply.gitea.com>
Co-committed-by: flyingpigge <flyingpigge@noreply.gitea.com>
hsfish merged commit fa474ab33e into master 2023-07-03 10:15:53 +00:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: hsfish/xorm#2
No description provided.