Skip to content

Commit c6129ea

Browse files
committed
6.1.0 更新日志,写文档好麻烦。
1 parent fb434e5 commit c6129ea

File tree

2 files changed

+141
-0
lines changed

2 files changed

+141
-0
lines changed

wikis/en/Changelog.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,80 @@
11
## Changelog
22

3+
- Released version 6.1.0, PageHelper provides direct dependency on jsqlparser as intermediate interfaces, allowing
4+
default implementation replacement through SPI.
5+
- Upgraded jsqlparser version to 4.7, re-implemented order by, pagination, and count queries.
6+
- Simplified pom.xml configuration, removed shade-embedded jsqlparser approach, and switched to selecting different
7+
jsqlparser versions through external dependencies, allowing self-SPI extension.
8+
- jsqlparser parsing no longer uses a thread pool, supporting SPI extension to override SqlParser implementation.
9+
- Changed SqlServer pagination to SqlServerSqlParser interface, added parameter sqlServerSqlParser to override the
10+
default value.
11+
- Extracted OrderByParser to OrderBySqlParser interface, added orderBySqlParser parameter to override the default
12+
implementation.
13+
- Changed static methods of OrderByParser to regular methods, preparing for future interface changes.
14+
- JSqlParser interface is no longer needed after JDK 8+, removed the interface, and marked the parameter in the
15+
documentation (_This parameter was used in the early stages to support special configuration for SQL Server_).
16+
Compatible with jsqlparser 4.7 version. Rui 2023/12/3 15:15.
17+
- Fixed maven-compiler-plugin version to remove warnings and improve build stability. qxo
18+
- Added .vscode to .gitignore for vscode IDE. qxo
19+
- Fixed bug https://github.com/pagehelper/Mybatis-PageHelper/issues/779. chenyuehui
20+
21+
To ensure compatibility with jsqlparser 4.5, 4.7, and possible future versions,
22+
a new project called pagehelper-sqlparser has been created.
23+
Currently, it provides two implementations: 4.5 and 4.7.
24+
To use it, exclude jsqlparser from pagehelper and select one jsqlparser implementation.
25+
The current version defaults to using the code from version 4.7.
26+
If you want to switch to the 4.5 implementation, follow the configuration steps below:
27+
28+
```xml
29+
<dependency>
30+
<groupId>com.github.pagehelper</groupId>
31+
<artifactId>pagehelper</artifactId>
32+
<version>6.1.0</version>
33+
<exclusions>
34+
<exclusion>
35+
<groupId>com.github.jsqlparser</groupId>
36+
<artifactId>jsqlparser</artifactId>
37+
</exclusion>
38+
</exclusions>
39+
</dependency>
40+
<dependency>
41+
<groupId>com.github.pagehelper</groupId>
42+
<artifactId>sqlparser4.5</artifactId>
43+
<version>6.1.0</version>
44+
</dependency>
45+
```
46+
47+
The priority of replacing default values with SPI is lower than the implementations specified by the sqlServerSqlParser,
48+
orderBySqlParser, and countSqlParser parameters.
49+
If no specific implementation is specified, the SPI implementation will take effect if available.
50+
You can refer to the code in the pagehelper-sqlsource module for SPI implementation examples.
51+
52+
By default, JSqlParser uses a temporarily created `Executors.newSingleThreadExecutor()` for parsing SQL.
53+
Here, the thread pool is bypassed through the API:
54+
55+
```java
56+
CCJSqlParser parser = CCJSqlParserUtil.newParser(statementReader);
57+
parser.
58+
59+
withSquareBracketQuotation(true);
60+
return parser.
61+
62+
Statement();
63+
```
64+
65+
The purpose of using a thread pool in JSqlParser is to prevent parsing timeouts. Therefore, if you have encountered
66+
timeout situations,
67+
you can introduce the following dependency (which overrides the default implementation through SPI with a timeout of 10
68+
seconds):
69+
70+
```xml
71+
<dependency>
72+
<groupId>com.github.pagehelper</groupId>
73+
<artifactId>sqlparser-timeout</artifactId>
74+
<version>6.1.0</version>
75+
</dependency>
76+
```
77+
378
### 6.0.0 - 2023-11-05
479

580
- Based on JDK 8 adaptation, JDK 6 and 7 are not supported from 6.0 onwards, and 5.x versions can be used if necessary

wikis/zh/Changelog.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,71 @@
11
## 更新日志
22

3+
### 6.1.0 - 2023-12-16
4+
5+
- 发布6.1.0,PageHelper 提供 jsqlparser直接依赖都是中间接口,可以通过SPI替换默认实现
6+
- 升级jsqlparser版本4.7,重新实现order by,分页,count查询
7+
- 简化pom.xml配置,去掉shade内嵌jsqlparser方式,改为通过外部依赖选择不同的jsqlparser版本,允许自己SPI扩展
8+
- jsqlparser解析不使用线程池,支持SPI扩展覆盖SqlParser实现
9+
- SqlServer分页改为SqlServerSqlParser接口,添加参数 sqlServerSqlParser 覆盖默认值
10+
- OrderByParser提取OrderBySqlParser接口,增加 orderBySqlParser 参数,可以覆盖默认实现
11+
- OrderByParser静态方法改为普通方法,为后续改接口做准备
12+
- jdk8+后不再需要JSqlParser接口,移除该接口,文档标记该参数(_该参数早期用于支持sqlserver特殊配置_
13+
兼容jsqlparser4.7版本 Rui 2023/12/3 15:15
14+
- maven-compiler-plugin固定版本以去除警告,并增加构建稳定性 qxo
15+
- gitignore .vscode for vscode ide qxo
16+
- 修改bug https://github.com/pagehelper/Mybatis-PageHelper/issues/779 chenyuehui
17+
18+
为了兼容 jsqlparser 4.5 和 4.7,以及后续可能存在的其他版本,新建了一个 pagehelper-sqlparser 项目,目前提供了 4.5 和 4.7
19+
两个实现,
20+
使用时从 pagehelper 排除 jsqlparser,然后选择一个 jsqlparser 实现即可,当前版本默认使用的 4.7 版本的代码,
21+
因此如果想换 4.5 的实现,可以按照下面方式进行配置:
22+
23+
```xml
24+
25+
<dependency>
26+
<groupId>com.github.pagehelper</groupId>
27+
<artifactId>pagehelper</artifactId>
28+
<version>6.1.0</version>
29+
<exclusions>
30+
<exclusion>
31+
<groupId>com.github.jsqlparser</groupId>
32+
<artifactId>jsqlparser</artifactId>
33+
</exclusion>
34+
</exclusions>
35+
</dependency>
36+
<dependency>
37+
<groupId>com.github.pagehelper</groupId>
38+
<artifactId>sqlparser4.5</artifactId>
39+
<version>6.1.0</version>
40+
</dependency>
41+
```
42+
43+
SPI 替换默认值的优先级低于 `sqlServerSqlParser`,`orderBySqlParser`,`countSqlParser` 参数指定的实现,不指定时如果存在SPI实现,即可生效,
44+
SPI 可以参考 pagehelper-sqlsource 模块代码。
45+
46+
JSqlParser 默认解析 SQL 会使用临时创建的 `Executors.newSingleThreadExecutor()`,这里通过 API 跳过了线程池:
47+
48+
```java
49+
CCJSqlParser parser = CCJSqlParserUtil.newParser(statementReader);
50+
parser.
51+
52+
withSquareBracketQuotation(true);
53+
return parser.
54+
55+
Statement();
56+
```
57+
58+
JSqlParser 使用线程池的目的是为了防止解析超时,因此如果你遇到过超时的情况,可以引入下面的依赖(通过SPI覆盖了默认实现,超时时间10秒):
59+
60+
```xml
61+
62+
<dependency>
63+
<groupId>com.github.pagehelper</groupId>
64+
<artifactId>sqlparser-timeout</artifactId>
65+
<version>6.1.0</version>
66+
</dependency>
67+
```
68+
369
### 6.0.0 - 2023-11-05
470

571
- 基于jdk8适配,6.0开始不支持jdk6和7,如果有需要可以使用5.x版本

0 commit comments

Comments
 (0)