Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Shardingsphere
提交
fcab73c4
Shardingsphere
项目概览
apache
/
Shardingsphere
通知
56
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Shardingsphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fcab73c4
编写于
6月 05, 2019
作者:
T
terrymanu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
for #2441, refactor Limit's constructor
上级
9b02c913
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
8 addition
and
20 deletion
+8
-20
sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/limit/Limit.java
...ava/org/apache/shardingsphere/core/route/limit/Limit.java
+8
-20
未找到文件。
sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/limit/Limit.java
浏览文件 @
fcab73c4
...
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.core.route.limit;
...
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.core.route.limit;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.ToString
;
import
lombok.ToString
;
import
org.apache.shardingsphere.core.parse.exception.SQLParsingException
;
import
org.apache.shardingsphere.core.util.NumberUtil
;
import
org.apache.shardingsphere.core.util.NumberUtil
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -37,30 +36,19 @@ import java.util.Map;
...
@@ -37,30 +36,19 @@ import java.util.Map;
@ToString
@ToString
public
final
class
Limit
{
public
final
class
Limit
{
private
LimitValue
offset
;
private
final
LimitValue
offset
;
private
LimitValue
rowCount
;
private
final
LimitValue
rowCount
;
public
Limit
(
final
LimitValue
offset
,
final
LimitValue
rowCount
,
final
List
<
Object
>
parameters
)
{
public
Limit
(
final
LimitValue
offset
,
final
LimitValue
rowCount
,
final
List
<
Object
>
parameters
)
{
this
.
offset
=
offset
;
if
(
null
!=
offset
)
{
this
.
rowCount
=
rowCount
;
offset
.
setValue
(-
1
==
offset
.
getIndex
()
?
getOffsetValue
()
:
NumberUtil
.
roundHalfUp
(
parameters
.
get
(
offset
.
getIndex
())));
fillParameters
(
parameters
);
}
private
void
fillParameters
(
final
List
<
Object
>
parameters
)
{
int
offset
=
0
;
if
(
null
!=
this
.
offset
)
{
offset
=
-
1
==
this
.
offset
.
getIndex
()
?
getOffsetValue
()
:
NumberUtil
.
roundHalfUp
(
parameters
.
get
(
this
.
offset
.
getIndex
()));
this
.
offset
.
setValue
(
offset
);
}
}
int
rowCount
=
0
;
this
.
offset
=
offset
;
if
(
null
!=
this
.
rowCount
)
{
if
(
null
!=
rowCount
)
{
rowCount
=
-
1
==
this
.
rowCount
.
getIndex
()
?
getRowCountValue
()
:
NumberUtil
.
roundHalfUp
(
parameters
.
get
(
this
.
rowCount
.
getIndex
()));
rowCount
.
setValue
(-
1
==
rowCount
.
getIndex
()
?
getRowCountValue
()
:
NumberUtil
.
roundHalfUp
(
parameters
.
get
(
rowCount
.
getIndex
())));
this
.
rowCount
.
setValue
(
rowCount
);
}
if
(
offset
<
0
||
rowCount
<
0
)
{
throw
new
SQLParsingException
(
"LIMIT offset and row count can not be a negative value."
);
}
}
this
.
rowCount
=
rowCount
;
}
}
/**
/**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录