Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Shardingsphere
提交
9b02c913
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,发现更多精彩内容 >>
未验证
提交
9b02c913
编写于
6月 05, 2019
作者:
L
Liang Zhang
提交者:
GitHub
6月 05, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2509 from tristaZero/dev
move sqltoken to rewrite package
上级
6aab8e47
feff6b2b
变更
32
展开全部
隐藏空白更改
内联
并排
Showing
32 changed file
with
94 addition
and
125 deletion
+94
-125
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/optimizer/select/SelectOptimizer.java
...ngsphere/core/parse/optimizer/select/SelectOptimizer.java
+2
-0
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/sql/statement/AbstractSQLStatement.java
...sphere/core/parse/sql/statement/AbstractSQLStatement.java
+0
-18
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/sql/statement/SQLStatement.java
...shardingsphere/core/parse/sql/statement/SQLStatement.java
+0
-16
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/sql/statement/dml/SelectStatement.java
...gsphere/core/parse/sql/statement/dml/SelectStatement.java
+3
-1
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/SQLRewriteEngine.java
.../apache/shardingsphere/core/rewrite/SQLRewriteEngine.java
+2
-2
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/rewriter/sql/BaseSQLRewriter.java
...dingsphere/core/rewrite/rewriter/sql/BaseSQLRewriter.java
+2
-1
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/rewriter/sql/EncryptSQLRewriter.java
...gsphere/core/rewrite/rewriter/sql/EncryptSQLRewriter.java
+1
-1
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/rewriter/sql/SQLRewriter.java
...shardingsphere/core/rewrite/rewriter/sql/SQLRewriter.java
+1
-1
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/rewriter/sql/ShardingSQLRewriter.java
...sphere/core/rewrite/rewriter/sql/ShardingSQLRewriter.java
+1
-1
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/SQLTokenGenerateEngine.java
...dingsphere/core/rewrite/token/SQLTokenGenerateEngine.java
+1
-1
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/generator/CollectionSQLTokenGenerator.java
.../rewrite/token/generator/CollectionSQLTokenGenerator.java
+1
-1
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/generator/OptionalSQLTokenGenerator.java
...re/rewrite/token/generator/OptionalSQLTokenGenerator.java
+1
-1
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/generator/OrderByTokenGenerator.java
...e/core/rewrite/token/generator/OrderByTokenGenerator.java
+1
-1
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/AggregationDistinctToken.java
...ere/core/rewrite/token/pojo/AggregationDistinctToken.java
+0
-1
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/EncryptColumnToken.java
...ingsphere/core/rewrite/token/pojo/EncryptColumnToken.java
+0
-1
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/IndexToken.java
...he/shardingsphere/core/rewrite/token/pojo/IndexToken.java
+0
-1
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/InsertAssistedColumnsToken.java
...e/core/rewrite/token/pojo/InsertAssistedColumnsToken.java
+0
-1
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/InsertColumnsToken.java
...ingsphere/core/rewrite/token/pojo/InsertColumnsToken.java
+0
-1
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/InsertGeneratedKeyToken.java
...here/core/rewrite/token/pojo/InsertGeneratedKeyToken.java
+0
-1
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/InsertSetAddAssistedColumnsToken.java
.../rewrite/token/pojo/InsertSetAddAssistedColumnsToken.java
+0
-1
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/InsertSetAddGeneratedKeyToken.java
...ore/rewrite/token/pojo/InsertSetAddGeneratedKeyToken.java
+0
-1
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/InsertSetEncryptValueToken.java
...e/core/rewrite/token/pojo/InsertSetEncryptValueToken.java
+0
-1
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/InsertValuesToken.java
...dingsphere/core/rewrite/token/pojo/InsertValuesToken.java
+0
-1
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/OffsetToken.java
...e/shardingsphere/core/rewrite/token/pojo/OffsetToken.java
+0
-1
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/OrderByToken.java
.../shardingsphere/core/rewrite/token/pojo/OrderByToken.java
+0
-2
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/RemoveToken.java
...e/shardingsphere/core/rewrite/token/pojo/RemoveToken.java
+0
-1
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/RowCountToken.java
...shardingsphere/core/rewrite/token/pojo/RowCountToken.java
+0
-1
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/SQLToken.java
...ache/shardingsphere/core/rewrite/token/pojo/SQLToken.java
+1
-1
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/SelectItemPrefixToken.java
...sphere/core/rewrite/token/pojo/SelectItemPrefixToken.java
+0
-1
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/SelectItemsToken.java
...rdingsphere/core/rewrite/token/pojo/SelectItemsToken.java
+0
-1
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/TableToken.java
...he/shardingsphere/core/rewrite/token/pojo/TableToken.java
+0
-1
sharding-core/sharding-core-rewrite/src/test/java/org/apache/shardingsphere/core/rewrite/rewriter/ShardingSQLRewriterTest.java
...sphere/core/rewrite/rewriter/ShardingSQLRewriterTest.java
+77
-61
未找到文件。
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/optimizer/select/SelectOptimizer.java
浏览文件 @
9b02c913
...
@@ -49,6 +49,7 @@ public final class SelectOptimizer implements SQLStatementOptimizer {
...
@@ -49,6 +49,7 @@ public final class SelectOptimizer implements SQLStatementOptimizer {
@Override
@Override
public
void
optimize
(
final
SQLStatement
sqlStatement
,
final
ShardingTableMetaData
shardingTableMetaData
)
{
public
void
optimize
(
final
SQLStatement
sqlStatement
,
final
ShardingTableMetaData
shardingTableMetaData
)
{
appendDerivedColumns
((
SelectStatement
)
sqlStatement
,
shardingTableMetaData
);
appendDerivedColumns
((
SelectStatement
)
sqlStatement
,
shardingTableMetaData
);
appendDerivedOrderBy
((
SelectStatement
)
sqlStatement
);
appendDerivedOrderBy
((
SelectStatement
)
sqlStatement
);
addSubqueryCondition
(
sqlStatement
);
addSubqueryCondition
(
sqlStatement
);
...
@@ -170,6 +171,7 @@ public final class SelectOptimizer implements SQLStatementOptimizer {
...
@@ -170,6 +171,7 @@ public final class SelectOptimizer implements SQLStatementOptimizer {
private
void
appendDerivedOrderBy
(
final
SelectStatement
selectStatement
)
{
private
void
appendDerivedOrderBy
(
final
SelectStatement
selectStatement
)
{
if
(!
selectStatement
.
getGroupByItems
().
isEmpty
()
&&
selectStatement
.
getOrderByItems
().
isEmpty
())
{
if
(!
selectStatement
.
getGroupByItems
().
isEmpty
()
&&
selectStatement
.
getOrderByItems
().
isEmpty
())
{
selectStatement
.
getOrderByItems
().
addAll
(
selectStatement
.
getGroupByItems
());
selectStatement
.
getOrderByItems
().
addAll
(
selectStatement
.
getGroupByItems
());
selectStatement
.
setToAppendOrderByItems
(
true
);
}
}
}
}
...
...
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/sql/statement/AbstractSQLStatement.java
浏览文件 @
9b02c913
...
@@ -18,7 +18,6 @@
...
@@ -18,7 +18,6 @@
package
org.apache.shardingsphere.core.parse.sql.statement
;
package
org.apache.shardingsphere.core.parse.sql.statement
;
import
com.google.common.base.Optional
;
import
com.google.common.base.Optional
;
import
lombok.AccessLevel
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.Setter
;
import
lombok.Setter
;
...
@@ -27,12 +26,9 @@ import org.apache.shardingsphere.core.constant.SQLType;
...
@@ -27,12 +26,9 @@ import org.apache.shardingsphere.core.constant.SQLType;
import
org.apache.shardingsphere.core.parse.sql.context.condition.ParseCondition
;
import
org.apache.shardingsphere.core.parse.sql.context.condition.ParseCondition
;
import
org.apache.shardingsphere.core.parse.sql.context.table.Tables
;
import
org.apache.shardingsphere.core.parse.sql.context.table.Tables
;
import
org.apache.shardingsphere.core.parse.sql.segment.SQLSegment
;
import
org.apache.shardingsphere.core.parse.sql.segment.SQLSegment
;
import
org.apache.shardingsphere.core.parse.sql.token.SQLToken
;
import
java.util.Collection
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.LinkedList
;
import
java.util.LinkedList
;
import
java.util.List
;
/**
/**
* SQL statement abstract class.
* SQL statement abstract class.
...
@@ -56,24 +52,10 @@ public abstract class AbstractSQLStatement implements SQLStatement {
...
@@ -56,24 +52,10 @@ public abstract class AbstractSQLStatement implements SQLStatement {
private
final
ParseCondition
encryptCondition
=
new
ParseCondition
();
private
final
ParseCondition
encryptCondition
=
new
ParseCondition
();
@Getter
(
AccessLevel
.
NONE
)
private
final
List
<
SQLToken
>
sqlTokens
=
new
LinkedList
<>();
private
int
parametersIndex
;
private
int
parametersIndex
;
private
String
logicSQL
;
private
String
logicSQL
;
@Override
public
final
void
addSQLToken
(
final
SQLToken
sqlToken
)
{
sqlTokens
.
add
(
sqlToken
);
}
@Override
public
final
List
<
SQLToken
>
getSQLTokens
()
{
Collections
.
sort
(
sqlTokens
);
return
sqlTokens
;
}
@Override
@Override
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
public
final
<
T
extends
SQLSegment
>
Optional
<
T
>
findSQLSegment
(
final
Class
<
T
>
sqlSegmentType
)
{
public
final
<
T
extends
SQLSegment
>
Optional
<
T
>
findSQLSegment
(
final
Class
<
T
>
sqlSegmentType
)
{
...
...
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/sql/statement/SQLStatement.java
浏览文件 @
9b02c913
...
@@ -22,10 +22,8 @@ import org.apache.shardingsphere.core.constant.SQLType;
...
@@ -22,10 +22,8 @@ import org.apache.shardingsphere.core.constant.SQLType;
import
org.apache.shardingsphere.core.parse.sql.context.condition.ParseCondition
;
import
org.apache.shardingsphere.core.parse.sql.context.condition.ParseCondition
;
import
org.apache.shardingsphere.core.parse.sql.context.table.Tables
;
import
org.apache.shardingsphere.core.parse.sql.context.table.Tables
;
import
org.apache.shardingsphere.core.parse.sql.segment.SQLSegment
;
import
org.apache.shardingsphere.core.parse.sql.segment.SQLSegment
;
import
org.apache.shardingsphere.core.parse.sql.token.SQLToken
;
import
java.util.Collection
;
import
java.util.Collection
;
import
java.util.List
;
/**
/**
* SQL statement.
* SQL statement.
...
@@ -69,20 +67,6 @@ public interface SQLStatement {
...
@@ -69,20 +67,6 @@ public interface SQLStatement {
*/
*/
ParseCondition
getEncryptCondition
();
ParseCondition
getEncryptCondition
();
/**
* Add SQL token.
*
* @param sqlToken SQL token
*/
void
addSQLToken
(
SQLToken
sqlToken
);
/**
* Get SQL tokens.
*
* @return SQL tokens
*/
List
<
SQLToken
>
getSQLTokens
();
/**
/**
* Get index of parameters.
* Get index of parameters.
*
*
...
...
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/sql/statement/dml/SelectStatement.java
浏览文件 @
9b02c913
...
@@ -61,6 +61,8 @@ public final class SelectStatement extends DQLStatement {
...
@@ -61,6 +61,8 @@ public final class SelectStatement extends DQLStatement {
private
final
List
<
OrderByItemSegment
>
orderByItems
=
new
LinkedList
<>();
private
final
List
<
OrderByItemSegment
>
orderByItems
=
new
LinkedList
<>();
private
boolean
toAppendOrderByItems
;
private
boolean
containStar
;
private
boolean
containStar
;
private
int
firstSelectItemStartIndex
;
private
int
firstSelectItemStartIndex
;
...
@@ -69,7 +71,7 @@ public final class SelectStatement extends DQLStatement {
...
@@ -69,7 +71,7 @@ public final class SelectStatement extends DQLStatement {
private
int
groupByLastIndex
;
private
int
groupByLastIndex
;
private
LimitSegment
limit
;
private
LimitSegment
limit
;
private
SelectStatement
parentStatement
;
private
SelectStatement
parentStatement
;
...
...
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/SQLRewriteEngine.java
浏览文件 @
9b02c913
...
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.core.rewrite;
...
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.core.rewrite;
import
com.google.common.base.Optional
;
import
com.google.common.base.Optional
;
import
org.apache.shardingsphere.core.parse.sql.statement.SQLStatement
;
import
org.apache.shardingsphere.core.parse.sql.statement.SQLStatement
;
import
org.apache.shardingsphere.core.parse.sql.token.SQLToken
;
import
org.apache.shardingsphere.core.rewrite.builder.ParameterBuilder
;
import
org.apache.shardingsphere.core.rewrite.builder.ParameterBuilder
;
import
org.apache.shardingsphere.core.rewrite.builder.SQLBuilder
;
import
org.apache.shardingsphere.core.rewrite.builder.SQLBuilder
;
import
org.apache.shardingsphere.core.rewrite.rewriter.parameter.ParameterRewriter
;
import
org.apache.shardingsphere.core.rewrite.rewriter.parameter.ParameterRewriter
;
...
@@ -29,6 +28,7 @@ import org.apache.shardingsphere.core.rewrite.token.BaseTokenGenerateEngine;
...
@@ -29,6 +28,7 @@ import org.apache.shardingsphere.core.rewrite.token.BaseTokenGenerateEngine;
import
org.apache.shardingsphere.core.rewrite.token.EncryptTokenGenerateEngine
;
import
org.apache.shardingsphere.core.rewrite.token.EncryptTokenGenerateEngine
;
import
org.apache.shardingsphere.core.rewrite.token.MasterSlaveTokenGenerateEngine
;
import
org.apache.shardingsphere.core.rewrite.token.MasterSlaveTokenGenerateEngine
;
import
org.apache.shardingsphere.core.rewrite.token.ShardingTokenGenerateEngine
;
import
org.apache.shardingsphere.core.rewrite.token.ShardingTokenGenerateEngine
;
import
org.apache.shardingsphere.core.rewrite.token.pojo.SQLToken
;
import
org.apache.shardingsphere.core.route.SQLUnit
;
import
org.apache.shardingsphere.core.route.SQLUnit
;
import
org.apache.shardingsphere.core.route.type.RoutingUnit
;
import
org.apache.shardingsphere.core.route.type.RoutingUnit
;
import
org.apache.shardingsphere.core.route.type.TableUnit
;
import
org.apache.shardingsphere.core.route.type.TableUnit
;
...
@@ -92,7 +92,7 @@ public final class SQLRewriteEngine {
...
@@ -92,7 +92,7 @@ public final class SQLRewriteEngine {
}
}
private
List
<
SQLToken
>
createSQLTokens
(
final
BaseRule
baseRule
,
final
SQLStatement
sqlStatement
,
final
boolean
isSingleRoute
)
{
private
List
<
SQLToken
>
createSQLTokens
(
final
BaseRule
baseRule
,
final
SQLStatement
sqlStatement
,
final
boolean
isSingleRoute
)
{
List
<
SQLToken
>
result
=
new
LinkedList
<>(
sqlStatement
.
getSQLTokens
()
);
List
<
SQLToken
>
result
=
new
LinkedList
<>();
result
.
addAll
(
new
BaseTokenGenerateEngine
().
generateSQLTokens
(
sqlStatement
,
baseRule
,
isSingleRoute
));
result
.
addAll
(
new
BaseTokenGenerateEngine
().
generateSQLTokens
(
sqlStatement
,
baseRule
,
isSingleRoute
));
if
(
baseRule
instanceof
ShardingRule
)
{
if
(
baseRule
instanceof
ShardingRule
)
{
ShardingRule
shardingRule
=
(
ShardingRule
)
baseRule
;
ShardingRule
shardingRule
=
(
ShardingRule
)
baseRule
;
...
...
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/rewriter/sql/BaseSQLRewriter.java
浏览文件 @
9b02c913
...
@@ -19,15 +19,16 @@ package org.apache.shardingsphere.core.rewrite.rewriter.sql;
...
@@ -19,15 +19,16 @@ package org.apache.shardingsphere.core.rewrite.rewriter.sql;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
org.apache.shardingsphere.core.parse.sql.statement.SQLStatement
;
import
org.apache.shardingsphere.core.parse.sql.statement.SQLStatement
;
import
org.apache.shardingsphere.core.parse.sql.token.SQLToken
;
import
org.apache.shardingsphere.core.rewrite.builder.ParameterBuilder
;
import
org.apache.shardingsphere.core.rewrite.builder.ParameterBuilder
;
import
org.apache.shardingsphere.core.rewrite.builder.SQLBuilder
;
import
org.apache.shardingsphere.core.rewrite.builder.SQLBuilder
;
import
org.apache.shardingsphere.core.rewrite.placeholder.InsertColumnsPlaceholder
;
import
org.apache.shardingsphere.core.rewrite.placeholder.InsertColumnsPlaceholder
;
import
org.apache.shardingsphere.core.rewrite.token.pojo.InsertColumnsToken
;
import
org.apache.shardingsphere.core.rewrite.token.pojo.InsertColumnsToken
;
import
org.apache.shardingsphere.core.rewrite.token.pojo.SQLToken
;
import
org.apache.shardingsphere.core.rewrite.token.pojo.Substitutable
;
import
org.apache.shardingsphere.core.rewrite.token.pojo.Substitutable
;
import
java.util.List
;
import
java.util.List
;
/**
/**
* Base SQL rewriter.
* Base SQL rewriter.
*
*
...
...
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/rewriter/sql/EncryptSQLRewriter.java
浏览文件 @
9b02c913
...
@@ -29,7 +29,6 @@ import org.apache.shardingsphere.core.parse.sql.segment.dml.expr.simple.Paramete
...
@@ -29,7 +29,6 @@ import org.apache.shardingsphere.core.parse.sql.segment.dml.expr.simple.Paramete
import
org.apache.shardingsphere.core.parse.sql.segment.dml.predicate.PredicateSegment
;
import
org.apache.shardingsphere.core.parse.sql.segment.dml.predicate.PredicateSegment
;
import
org.apache.shardingsphere.core.parse.sql.statement.SQLStatement
;
import
org.apache.shardingsphere.core.parse.sql.statement.SQLStatement
;
import
org.apache.shardingsphere.core.parse.sql.statement.dml.UpdateStatement
;
import
org.apache.shardingsphere.core.parse.sql.statement.dml.UpdateStatement
;
import
org.apache.shardingsphere.core.parse.sql.token.SQLToken
;
import
org.apache.shardingsphere.core.rewrite.builder.ParameterBuilder
;
import
org.apache.shardingsphere.core.rewrite.builder.ParameterBuilder
;
import
org.apache.shardingsphere.core.rewrite.builder.SQLBuilder
;
import
org.apache.shardingsphere.core.rewrite.builder.SQLBuilder
;
import
org.apache.shardingsphere.core.rewrite.placeholder.InsertAssistedColumnsPlaceholder
;
import
org.apache.shardingsphere.core.rewrite.placeholder.InsertAssistedColumnsPlaceholder
;
...
@@ -46,6 +45,7 @@ import org.apache.shardingsphere.core.rewrite.token.pojo.InsertAssistedColumnsTo
...
@@ -46,6 +45,7 @@ import org.apache.shardingsphere.core.rewrite.token.pojo.InsertAssistedColumnsTo
import
org.apache.shardingsphere.core.rewrite.token.pojo.InsertSetAddAssistedColumnsToken
;
import
org.apache.shardingsphere.core.rewrite.token.pojo.InsertSetAddAssistedColumnsToken
;
import
org.apache.shardingsphere.core.rewrite.token.pojo.InsertSetEncryptValueToken
;
import
org.apache.shardingsphere.core.rewrite.token.pojo.InsertSetEncryptValueToken
;
import
org.apache.shardingsphere.core.rewrite.token.pojo.InsertValuesToken
;
import
org.apache.shardingsphere.core.rewrite.token.pojo.InsertValuesToken
;
import
org.apache.shardingsphere.core.rewrite.token.pojo.SQLToken
;
import
org.apache.shardingsphere.core.rule.ColumnNode
;
import
org.apache.shardingsphere.core.rule.ColumnNode
;
import
org.apache.shardingsphere.core.strategy.encrypt.ShardingEncryptorEngine
;
import
org.apache.shardingsphere.core.strategy.encrypt.ShardingEncryptorEngine
;
import
org.apache.shardingsphere.spi.encrypt.ShardingEncryptor
;
import
org.apache.shardingsphere.spi.encrypt.ShardingEncryptor
;
...
...
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/rewriter/sql/SQLRewriter.java
浏览文件 @
9b02c913
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
package
org.apache.shardingsphere.core.rewrite.rewriter.sql
;
package
org.apache.shardingsphere.core.rewrite.rewriter.sql
;
import
org.apache.shardingsphere.core.
parse.sql.token
.SQLToken
;
import
org.apache.shardingsphere.core.
rewrite.token.pojo
.SQLToken
;
import
org.apache.shardingsphere.core.rewrite.builder.ParameterBuilder
;
import
org.apache.shardingsphere.core.rewrite.builder.ParameterBuilder
;
import
org.apache.shardingsphere.core.rewrite.builder.SQLBuilder
;
import
org.apache.shardingsphere.core.rewrite.builder.SQLBuilder
;
...
...
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/rewriter/sql/ShardingSQLRewriter.java
浏览文件 @
9b02c913
...
@@ -25,7 +25,6 @@ import org.apache.shardingsphere.core.optimize.result.insert.InsertOptimizeResul
...
@@ -25,7 +25,6 @@ import org.apache.shardingsphere.core.optimize.result.insert.InsertOptimizeResul
import
org.apache.shardingsphere.core.parse.sql.segment.dml.order.item.OrderByItemSegment
;
import
org.apache.shardingsphere.core.parse.sql.segment.dml.order.item.OrderByItemSegment
;
import
org.apache.shardingsphere.core.parse.sql.segment.dml.order.item.TextOrderByItemSegment
;
import
org.apache.shardingsphere.core.parse.sql.segment.dml.order.item.TextOrderByItemSegment
;
import
org.apache.shardingsphere.core.parse.sql.statement.dml.SelectStatement
;
import
org.apache.shardingsphere.core.parse.sql.statement.dml.SelectStatement
;
import
org.apache.shardingsphere.core.parse.sql.token.SQLToken
;
import
org.apache.shardingsphere.core.rewrite.builder.ParameterBuilder
;
import
org.apache.shardingsphere.core.rewrite.builder.ParameterBuilder
;
import
org.apache.shardingsphere.core.rewrite.builder.SQLBuilder
;
import
org.apache.shardingsphere.core.rewrite.builder.SQLBuilder
;
import
org.apache.shardingsphere.core.rewrite.placeholder.AggregationDistinctPlaceholder
;
import
org.apache.shardingsphere.core.rewrite.placeholder.AggregationDistinctPlaceholder
;
...
@@ -45,6 +44,7 @@ import org.apache.shardingsphere.core.rewrite.token.pojo.InsertSetAddGeneratedKe
...
@@ -45,6 +44,7 @@ import org.apache.shardingsphere.core.rewrite.token.pojo.InsertSetAddGeneratedKe
import
org.apache.shardingsphere.core.rewrite.token.pojo.OffsetToken
;
import
org.apache.shardingsphere.core.rewrite.token.pojo.OffsetToken
;
import
org.apache.shardingsphere.core.rewrite.token.pojo.OrderByToken
;
import
org.apache.shardingsphere.core.rewrite.token.pojo.OrderByToken
;
import
org.apache.shardingsphere.core.rewrite.token.pojo.RowCountToken
;
import
org.apache.shardingsphere.core.rewrite.token.pojo.RowCountToken
;
import
org.apache.shardingsphere.core.rewrite.token.pojo.SQLToken
;
import
org.apache.shardingsphere.core.rewrite.token.pojo.SelectItemPrefixToken
;
import
org.apache.shardingsphere.core.rewrite.token.pojo.SelectItemPrefixToken
;
import
org.apache.shardingsphere.core.rewrite.token.pojo.SelectItemsToken
;
import
org.apache.shardingsphere.core.rewrite.token.pojo.SelectItemsToken
;
import
org.apache.shardingsphere.core.rewrite.token.pojo.TableToken
;
import
org.apache.shardingsphere.core.rewrite.token.pojo.TableToken
;
...
...
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/SQLTokenGenerateEngine.java
浏览文件 @
9b02c913
...
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.core.rewrite.token;
...
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.core.rewrite.token;
import
com.google.common.base.Optional
;
import
com.google.common.base.Optional
;
import
org.apache.shardingsphere.core.parse.sql.statement.SQLStatement
;
import
org.apache.shardingsphere.core.parse.sql.statement.SQLStatement
;
import
org.apache.shardingsphere.core.
parse.sql.token
.SQLToken
;
import
org.apache.shardingsphere.core.
rewrite.token.pojo
.SQLToken
;
import
org.apache.shardingsphere.core.rewrite.token.generator.CollectionSQLTokenGenerator
;
import
org.apache.shardingsphere.core.rewrite.token.generator.CollectionSQLTokenGenerator
;
import
org.apache.shardingsphere.core.rewrite.token.generator.IgnoreForSingleRoute
;
import
org.apache.shardingsphere.core.rewrite.token.generator.IgnoreForSingleRoute
;
import
org.apache.shardingsphere.core.rewrite.token.generator.OptionalSQLTokenGenerator
;
import
org.apache.shardingsphere.core.rewrite.token.generator.OptionalSQLTokenGenerator
;
...
...
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/generator/CollectionSQLTokenGenerator.java
浏览文件 @
9b02c913
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
package
org.apache.shardingsphere.core.rewrite.token.generator
;
package
org.apache.shardingsphere.core.rewrite.token.generator
;
import
org.apache.shardingsphere.core.parse.sql.statement.SQLStatement
;
import
org.apache.shardingsphere.core.parse.sql.statement.SQLStatement
;
import
org.apache.shardingsphere.core.
parse.sql.token
.SQLToken
;
import
org.apache.shardingsphere.core.
rewrite.token.pojo
.SQLToken
;
import
org.apache.shardingsphere.core.rule.BaseRule
;
import
org.apache.shardingsphere.core.rule.BaseRule
;
import
java.util.Collection
;
import
java.util.Collection
;
...
...
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/generator/OptionalSQLTokenGenerator.java
浏览文件 @
9b02c913
...
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.core.rewrite.token.generator;
...
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.core.rewrite.token.generator;
import
com.google.common.base.Optional
;
import
com.google.common.base.Optional
;
import
org.apache.shardingsphere.core.parse.sql.statement.SQLStatement
;
import
org.apache.shardingsphere.core.parse.sql.statement.SQLStatement
;
import
org.apache.shardingsphere.core.
parse.sql.token
.SQLToken
;
import
org.apache.shardingsphere.core.
rewrite.token.pojo
.SQLToken
;
import
org.apache.shardingsphere.core.rule.BaseRule
;
import
org.apache.shardingsphere.core.rule.BaseRule
;
/**
/**
...
...
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/generator/OrderByTokenGenerator.java
浏览文件 @
9b02c913
...
@@ -35,7 +35,7 @@ public final class OrderByTokenGenerator implements OptionalSQLTokenGenerator<Sh
...
@@ -35,7 +35,7 @@ public final class OrderByTokenGenerator implements OptionalSQLTokenGenerator<Sh
if
(!(
sqlStatement
instanceof
SelectStatement
))
{
if
(!(
sqlStatement
instanceof
SelectStatement
))
{
return
Optional
.
absent
();
return
Optional
.
absent
();
}
}
if
(
!((
SelectStatement
)
sqlStatement
).
getGroupByItems
().
isEmpty
()
&&
((
SelectStatement
)
sqlStatement
).
getOrderByItems
().
isEmpty
())
{
if
(
((
SelectStatement
)
sqlStatement
).
isToAppendOrderByItems
())
{
return
Optional
.
of
(
new
OrderByToken
(((
SelectStatement
)
sqlStatement
).
getGroupByLastIndex
()
+
1
));
return
Optional
.
of
(
new
OrderByToken
(((
SelectStatement
)
sqlStatement
).
getGroupByLastIndex
()
+
1
));
}
}
return
Optional
.
absent
();
return
Optional
.
absent
();
...
...
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/AggregationDistinctToken.java
浏览文件 @
9b02c913
...
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.core.rewrite.token.pojo;
...
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.core.rewrite.token.pojo;
import
com.google.common.base.Optional
;
import
com.google.common.base.Optional
;
import
lombok.Getter
;
import
lombok.Getter
;
import
org.apache.shardingsphere.core.parse.sql.token.SQLToken
;
/**
/**
* Aggregation distinct token.
* Aggregation distinct token.
...
...
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/EncryptColumnToken.java
浏览文件 @
9b02c913
...
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.core.rewrite.token.pojo;
...
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.core.rewrite.token.pojo;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.ToString
;
import
lombok.ToString
;
import
org.apache.shardingsphere.core.parse.sql.context.condition.Column
;
import
org.apache.shardingsphere.core.parse.sql.context.condition.Column
;
import
org.apache.shardingsphere.core.parse.sql.token.SQLToken
;
/**
/**
* Encrypt column token.
* Encrypt column token.
...
...
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/IndexToken.java
浏览文件 @
9b02c913
...
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.core.rewrite.token.pojo;
...
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.core.rewrite.token.pojo;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.ToString
;
import
lombok.ToString
;
import
org.apache.shardingsphere.core.parse.constant.QuoteCharacter
;
import
org.apache.shardingsphere.core.parse.constant.QuoteCharacter
;
import
org.apache.shardingsphere.core.parse.sql.token.SQLToken
;
/**
/**
* Index token.
* Index token.
...
...
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/InsertAssistedColumnsToken.java
浏览文件 @
9b02c913
...
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.core.rewrite.token.pojo;
...
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.core.rewrite.token.pojo;
import
lombok.EqualsAndHashCode
;
import
lombok.EqualsAndHashCode
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.ToString
;
import
lombok.ToString
;
import
org.apache.shardingsphere.core.parse.sql.token.SQLToken
;
import
java.util.Collection
;
import
java.util.Collection
;
...
...
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/InsertColumnsToken.java
浏览文件 @
9b02c913
...
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.core.rewrite.token.pojo;
...
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.core.rewrite.token.pojo;
import
lombok.EqualsAndHashCode
;
import
lombok.EqualsAndHashCode
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.ToString
;
import
lombok.ToString
;
import
org.apache.shardingsphere.core.parse.sql.token.SQLToken
;
import
java.util.Collection
;
import
java.util.Collection
;
...
...
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/InsertGeneratedKeyToken.java
浏览文件 @
9b02c913
...
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.core.rewrite.token.pojo;
...
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.core.rewrite.token.pojo;
import
lombok.EqualsAndHashCode
;
import
lombok.EqualsAndHashCode
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.ToString
;
import
lombok.ToString
;
import
org.apache.shardingsphere.core.parse.sql.token.SQLToken
;
/**
/**
* Insert generated key columns token.
* Insert generated key columns token.
...
...
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/InsertSetAddAssistedColumnsToken.java
浏览文件 @
9b02c913
...
@@ -18,7 +18,6 @@
...
@@ -18,7 +18,6 @@
package
org.apache.shardingsphere.core.rewrite.token.pojo
;
package
org.apache.shardingsphere.core.rewrite.token.pojo
;
import
lombok.Getter
;
import
lombok.Getter
;
import
org.apache.shardingsphere.core.parse.sql.token.SQLToken
;
import
java.util.Collection
;
import
java.util.Collection
;
...
...
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/InsertSetAddGeneratedKeyToken.java
浏览文件 @
9b02c913
...
@@ -18,7 +18,6 @@
...
@@ -18,7 +18,6 @@
package
org.apache.shardingsphere.core.rewrite.token.pojo
;
package
org.apache.shardingsphere.core.rewrite.token.pojo
;
import
lombok.Getter
;
import
lombok.Getter
;
import
org.apache.shardingsphere.core.parse.sql.token.SQLToken
;
/**
/**
* Insert set add generated key token.
* Insert set add generated key token.
...
...
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/InsertSetEncryptValueToken.java
浏览文件 @
9b02c913
...
@@ -18,7 +18,6 @@
...
@@ -18,7 +18,6 @@
package
org.apache.shardingsphere.core.rewrite.token.pojo
;
package
org.apache.shardingsphere.core.rewrite.token.pojo
;
import
lombok.Getter
;
import
lombok.Getter
;
import
org.apache.shardingsphere.core.parse.sql.token.SQLToken
;
/**
/**
* Insert set encrypt value token.
* Insert set encrypt value token.
...
...
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/InsertValuesToken.java
浏览文件 @
9b02c913
...
@@ -18,7 +18,6 @@
...
@@ -18,7 +18,6 @@
package
org.apache.shardingsphere.core.rewrite.token.pojo
;
package
org.apache.shardingsphere.core.rewrite.token.pojo
;
import
lombok.Getter
;
import
lombok.Getter
;
import
org.apache.shardingsphere.core.parse.sql.token.SQLToken
;
/**
/**
* Insert values token.
* Insert values token.
...
...
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/OffsetToken.java
浏览文件 @
9b02c913
...
@@ -18,7 +18,6 @@
...
@@ -18,7 +18,6 @@
package
org.apache.shardingsphere.core.rewrite.token.pojo
;
package
org.apache.shardingsphere.core.rewrite.token.pojo
;
import
lombok.Getter
;
import
lombok.Getter
;
import
org.apache.shardingsphere.core.parse.sql.token.SQLToken
;
/**
/**
* Offset token for limit.
* Offset token for limit.
...
...
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/OrderByToken.java
浏览文件 @
9b02c913
...
@@ -17,8 +17,6 @@
...
@@ -17,8 +17,6 @@
package
org.apache.shardingsphere.core.rewrite.token.pojo
;
package
org.apache.shardingsphere.core.rewrite.token.pojo
;
import
org.apache.shardingsphere.core.parse.sql.token.SQLToken
;
/**
/**
* Order by token.
* Order by token.
*
*
...
...
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/RemoveToken.java
浏览文件 @
9b02c913
...
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.core.rewrite.token.pojo;
...
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.core.rewrite.token.pojo;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.ToString
;
import
lombok.ToString
;
import
org.apache.shardingsphere.core.parse.sql.token.SQLToken
;
/**
/**
* Remove token.
* Remove token.
...
...
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/RowCountToken.java
浏览文件 @
9b02c913
...
@@ -18,7 +18,6 @@
...
@@ -18,7 +18,6 @@
package
org.apache.shardingsphere.core.rewrite.token.pojo
;
package
org.apache.shardingsphere.core.rewrite.token.pojo
;
import
lombok.Getter
;
import
lombok.Getter
;
import
org.apache.shardingsphere.core.parse.sql.token.SQLToken
;
/**
/**
* Row count token for limit.
* Row count token for limit.
...
...
sharding-core/sharding-core-
parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/sql/token
/SQLToken.java
→
sharding-core/sharding-core-
rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo
/SQLToken.java
浏览文件 @
9b02c913
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
* limitations under the License.
* limitations under the License.
*/
*/
package
org.apache.shardingsphere.core.
parse.sql.token
;
package
org.apache.shardingsphere.core.
rewrite.token.pojo
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
...
...
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/SelectItemPrefixToken.java
浏览文件 @
9b02c913
...
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.core.rewrite.token.pojo;
...
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.core.rewrite.token.pojo;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.Setter
;
import
org.apache.shardingsphere.core.parse.sql.token.SQLToken
;
/**
/**
* Select item prefix token.
* Select item prefix token.
...
...
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/SelectItemsToken.java
浏览文件 @
9b02c913
...
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.core.rewrite.token.pojo;
...
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.core.rewrite.token.pojo;
import
lombok.EqualsAndHashCode
;
import
lombok.EqualsAndHashCode
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.ToString
;
import
lombok.ToString
;
import
org.apache.shardingsphere.core.parse.sql.token.SQLToken
;
import
java.util.Collection
;
import
java.util.Collection
;
...
...
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/token/pojo/TableToken.java
浏览文件 @
9b02c913
...
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.core.rewrite.token.pojo;
...
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.core.rewrite.token.pojo;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.ToString
;
import
lombok.ToString
;
import
org.apache.shardingsphere.core.parse.constant.QuoteCharacter
;
import
org.apache.shardingsphere.core.parse.constant.QuoteCharacter
;
import
org.apache.shardingsphere.core.parse.sql.token.SQLToken
;
import
org.apache.shardingsphere.core.parse.util.SQLUtil
;
import
org.apache.shardingsphere.core.parse.util.SQLUtil
;
/**
/**
...
...
sharding-core/sharding-core-rewrite/src/test/java/org/apache/shardingsphere/core/rewrite/rewriter/ShardingSQLRewriterTest.java
浏览文件 @
9b02c913
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录