File tree Expand file tree Collapse file tree 6 files changed +38
-6
lines changed
src/main/java/com/github/pagehelper/parser/impl Expand file tree Collapse file tree 6 files changed +38
-6
lines changed Original file line number Diff line number Diff line change 36
36
37
37
##分页插件支持MyBatis3.2.0~ 3.3.0(包含)
38
38
39
- ##分页插件最新版本为4.1.5
39
+ ##分页插件最新版本为4.1.6
40
40
41
41
###Maven坐标
42
42
43
43
``` xml
44
44
<dependency >
45
45
<groupId >com.github.pagehelper</groupId >
46
46
<artifactId >pagehelper</artifactId >
47
- <version >4.1.5 </version >
47
+ <version >4.1.6 </version >
48
48
</dependency >
49
49
```
50
50
66
66
67
67
- http://repo1.maven.org/maven2/com/github/jsqlparser/jsqlparser/0.9.1/
68
68
69
+ ##4 .1.6更新日志
70
+
71
+ - 通过间接处理字符串解决SqlServer中不支持` with(nolock) ` 的问题#86 ,详情可以看` SqlServerParser ` 和` SqlServer2012Dialect `
72
+
69
73
##4 .1.5更新日志
70
74
71
75
- 更新` PageProviderSqlSource ` ,支持3.4.0版本的` Provider ` 注解方式的分页#102
Original file line number Diff line number Diff line change 28
28
29
29
<groupId >com.github.pagehelper</groupId >
30
30
<artifactId >pagehelper</artifactId >
31
- <version >4.1.5 </version >
31
+ <version >4.1.6 </version >
32
32
<packaging >jar</packaging >
33
33
34
34
<name >pagehelper</name >
Original file line number Diff line number Diff line change 12
12
* in oder for OFFSET .. ROWS to work
13
13
*/
14
14
public class SqlServer2012Dialect extends AbstractParser {
15
+ //with(nolock)
16
+ protected static final String WITHNOLOCK = ", PAGEWITHNOLOCK" ;
17
+
18
+ @ Override
19
+ public String getCountSql (String sql ) {
20
+ sql = sql .replaceAll ("((?i)with\\ s*\\ (nolock\\ ))" , WITHNOLOCK );
21
+ sql = super .getCountSql (sql );
22
+ sql = sql .replace (WITHNOLOCK , " with(nolock)" );
23
+ return sql ;
24
+ }
15
25
16
26
@ Override
17
27
public String getPageSql (String sql ) {
Original file line number Diff line number Diff line change 41
41
public class SqlServerParser extends AbstractParser {
42
42
private static final SqlServer pageSql = new SqlServer ();
43
43
44
+ //with(nolock)
45
+ protected static final String WITHNOLOCK = ", PAGEWITHNOLOCK" ;
46
+
47
+ @ Override
48
+ public String getCountSql (String sql ) {
49
+ sql = sql .replaceAll ("((?i)with\\ s*\\ (nolock\\ ))" , WITHNOLOCK );
50
+ sql = super .getCountSql (sql );
51
+ sql = sql .replace (WITHNOLOCK , " with(nolock)" );
52
+ return sql ;
53
+ }
54
+
44
55
@ Override
45
56
public boolean isSupportedMappedStatementCache () {
46
57
//由于sqlserver每次分页参数都是直接写入到sql语句中,因此不能缓存MS
@@ -55,7 +66,10 @@ public List<ParameterMapping> getPageParameterMapping(Configuration configuratio
55
66
@ Override
56
67
public String getPageSql (String sql ) {
57
68
Page <?> page = SqlUtil .getLocalPage ();
58
- return pageSql .convertToPageSql (sql , page .getStartRow (), page .getPageSize ());
69
+ sql = sql .replaceAll ("((?i)with\\ s*\\ (nolock\\ ))" , WITHNOLOCK );
70
+ sql = pageSql .convertToPageSql (sql , page .getStartRow (), page .getPageSize ());
71
+ sql = sql .replace (WITHNOLOCK , " with(nolock)" );
72
+ return sql ;
59
73
}
60
74
61
75
@ Override
Original file line number Diff line number Diff line change 1
1
##更新日志
2
2
3
- ##4 .1.5 - 2016-05-29
3
+ ##4 .1.6 - 2016-06-05
4
+
5
+ - 通过间接处理字符串解决SqlServer中不支持` with(nolock) ` 的问题#86 ,详情可以看` SqlServerParser ` 和` SqlServer2012Dialect `
6
+
7
+ ###4 .1.5 - 2016-05-29
4
8
5
9
- 更新` PageProviderSqlSource ` ,支持3.4.0版本的` Provider ` 注解方式的分页#102
6
10
- 解决` SqlUtil ` 未初始化` PARAMS ` 属性导致的错误
Original file line number Diff line number Diff line change 26
26
<dependency >
27
27
<groupId >com.github.pagehelper</groupId >
28
28
<artifactId >pagehelper</artifactId >
29
- <version >4.1.5 </version >
29
+ <version >4.1.6 </version >
30
30
</dependency >
31
31
```
32
32
You can’t perform that action at this time.
0 commit comments