Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Shardingsphere
提交
fc1a9fb8
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,发现更多精彩内容 >>
提交
fc1a9fb8
编写于
4月 26, 2017
作者:
T
terrymanu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor SQLContext
上级
735f5da6
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
18 addition
and
31 deletion
+18
-31
sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parser/sql/context/AbstractSQLContext.java
...e/rdb/sharding/parser/sql/context/AbstractSQLContext.java
+14
-3
sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parser/sql/context/DeleteSQLContext.java
...ame/rdb/sharding/parser/sql/context/DeleteSQLContext.java
+1
-6
sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parser/sql/context/InsertSQLContext.java
...ame/rdb/sharding/parser/sql/context/InsertSQLContext.java
+1
-6
sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parser/sql/context/SelectSQLContext.java
...ame/rdb/sharding/parser/sql/context/SelectSQLContext.java
+1
-10
sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parser/sql/context/UpdateSQLContext.java
...ame/rdb/sharding/parser/sql/context/UpdateSQLContext.java
+1
-6
未找到文件。
sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parser/sql/context/AbstractSQLContext.java
浏览文件 @
fc1a9fb8
...
...
@@ -20,13 +20,13 @@ package com.dangdang.ddframe.rdb.sharding.parser.sql.context;
import
com.dangdang.ddframe.rdb.sharding.parser.result.router.Condition
;
import
com.dangdang.ddframe.rdb.sharding.parser.result.router.ConditionContext
;
import
com.dangdang.ddframe.rdb.sharding.parser.result.router.SQLBuilder
;
import
com.dangdang.ddframe.rdb.sharding.parser.result.router.SQLStatementType
;
import
com.dangdang.ddframe.rdb.sharding.parser.sql.expr.SQLExpr
;
import
com.dangdang.ddframe.rdb.sharding.parser.sql.expr.SQLIdentifierExpr
;
import
com.dangdang.ddframe.rdb.sharding.parser.sql.expr.SQLPropertyExpr
;
import
com.dangdang.ddframe.rdb.sharding.util.SQLUtil
;
import
com.google.common.base.Optional
;
import
lombok.Getter
;
import
lombok.RequiredArgsConstructor
;
import
java.io.IOException
;
import
java.util.ArrayList
;
...
...
@@ -41,18 +41,29 @@ import java.util.List;
*
* @author zhangliang
*/
@RequiredArgsConstructor
@Getter
public
abstract
class
AbstractSQLContext
implements
SQLContext
{
private
final
String
originalSQL
;
private
List
<
TableContext
>
tables
=
new
ArrayList
<>();
private
final
SQLStatementType
type
;
private
final
List
<
TableContext
>
tables
=
new
ArrayList
<>();
private
final
Collection
<
ConditionContext
>
conditionContexts
=
new
LinkedList
<>();
private
final
List
<
SQLToken
>
sqlTokens
=
new
LinkedList
<>();
public
AbstractSQLContext
(
final
String
originalSQL
,
final
SQLStatementType
type
)
{
this
.
originalSQL
=
originalSQL
;
this
.
type
=
type
;
}
@Override
public
final
SQLStatementType
getType
()
{
return
type
;
}
@Override
public
Optional
<
Condition
.
Column
>
findColumn
(
final
SQLExpr
expr
)
{
if
(
expr
instanceof
SQLPropertyExpr
)
{
...
...
sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parser/sql/context/DeleteSQLContext.java
浏览文件 @
fc1a9fb8
...
...
@@ -29,11 +29,6 @@ import lombok.Getter;
public
final
class
DeleteSQLContext
extends
AbstractSQLContext
{
public
DeleteSQLContext
(
final
String
originalSQL
)
{
super
(
originalSQL
);
}
@Override
public
SQLStatementType
getType
()
{
return
SQLStatementType
.
DELETE
;
super
(
originalSQL
,
SQLStatementType
.
DELETE
);
}
}
sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parser/sql/context/InsertSQLContext.java
浏览文件 @
fc1a9fb8
...
...
@@ -32,12 +32,7 @@ public final class InsertSQLContext extends AbstractSQLContext {
private
final
GeneratedKeyContext
generatedKeyContext
;
public
InsertSQLContext
(
final
String
originalSQL
)
{
super
(
originalSQL
);
super
(
originalSQL
,
SQLStatementType
.
INSERT
);
generatedKeyContext
=
new
GeneratedKeyContext
();
}
@Override
public
SQLStatementType
getType
()
{
return
SQLStatementType
.
INSERT
;
}
}
sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parser/sql/context/SelectSQLContext.java
浏览文件 @
fc1a9fb8
...
...
@@ -47,16 +47,7 @@ public final class SelectSQLContext extends AbstractSQLContext {
private
LimitContext
limitContext
;
private
SelectSQLContext
parent
;
private
List
<
SelectSQLContext
>
children
=
new
LinkedList
<>();
public
SelectSQLContext
(
final
String
originalSQL
)
{
super
(
originalSQL
);
}
@Override
public
SQLStatementType
getType
()
{
return
SQLStatementType
.
SELECT
;
super
(
originalSQL
,
SQLStatementType
.
SELECT
);
}
}
sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parser/sql/context/UpdateSQLContext.java
浏览文件 @
fc1a9fb8
...
...
@@ -27,11 +27,6 @@ import com.dangdang.ddframe.rdb.sharding.parser.result.router.SQLStatementType;
public
final
class
UpdateSQLContext
extends
AbstractSQLContext
{
public
UpdateSQLContext
(
final
String
originalSQL
)
{
super
(
originalSQL
);
}
@Override
public
SQLStatementType
getType
()
{
return
SQLStatementType
.
UPDATE
;
super
(
originalSQL
,
SQLStatementType
.
UPDATE
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录