Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Shardingsphere
提交
55427d08
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,发现更多精彩内容 >>
提交
55427d08
编写于
9月 04, 2019
作者:
beckhampu
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'upstream/dev' into sharding-ui
上级
99aa151d
924f0131
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
30 addition
and
60 deletion
+30
-60
sharding-core/sharding-core-optimize/src/main/java/org/apache/shardingsphere/core/optimize/encrypt/engine/dml/EncryptInsertOptimizeEngine.java
...imize/encrypt/engine/dml/EncryptInsertOptimizeEngine.java
+0
-23
sharding-core/sharding-core-optimize/src/main/java/org/apache/shardingsphere/core/optimize/sharding/engnie/dml/ShardingInsertOptimizeEngine.java
...ize/sharding/engnie/dml/ShardingInsertOptimizeEngine.java
+0
-25
sharding-core/sharding-core-optimize/src/test/java/org/apache/shardingsphere/core/optimize/encrypt/engine/EncryptInsertOptimizeEngineTest.java
...imize/encrypt/engine/EncryptInsertOptimizeEngineTest.java
+1
-8
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/SQLRewriteEngine.java
.../apache/shardingsphere/core/rewrite/SQLRewriteEngine.java
+25
-0
sharding-distribution/sharding-proxy-distribution/pom.xml
sharding-distribution/sharding-proxy-distribution/pom.xml
+1
-1
sharding-distribution/sharding-proxy-distribution/src/main/docker/Dockerfile
...on/sharding-proxy-distribution/src/main/docker/Dockerfile
+1
-1
sharding-orchestration/sharding-orchestration-zookeeper-curator-integration-test/pom.xml
...-orchestration-zookeeper-curator-integration-test/pom.xml
+1
-1
sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/transport/mysql/constant/MySQLServerInfo.java
...ardingproxy/transport/mysql/constant/MySQLServerInfo.java
+1
-1
未找到文件。
sharding-core/sharding-core-optimize/src/main/java/org/apache/shardingsphere/core/optimize/encrypt/engine/dml/EncryptInsertOptimizeEngine.java
浏览文件 @
55427d08
...
...
@@ -47,12 +47,6 @@ public final class EncryptInsertOptimizeEngine implements EncryptOptimizeEngine<
for
(
Collection
<
ExpressionSegment
>
each
:
sqlStatement
.
getAllValueExpressions
())
{
InsertValue
insertValue
=
createInsertValue
(
columnNames
,
encryptDerivedColumnNames
,
each
,
derivedColumnCount
,
parameters
,
parametersOffset
);
result
.
getInsertValues
().
add
(
insertValue
);
if
(
encryptRule
.
containsQueryAssistedColumn
(
tableName
))
{
fillAssistedQueryInsertValue
(
encryptRule
,
insertValue
.
getParameters
(),
tableName
,
columnNames
,
insertValue
);
}
if
(
encryptRule
.
containsPlainColumn
(
tableName
))
{
fillPlainInsertValue
(
encryptRule
,
insertValue
.
getParameters
(),
tableName
,
columnNames
,
insertValue
);
}
parametersOffset
+=
insertValue
.
getParametersCount
();
}
return
result
;
...
...
@@ -64,21 +58,4 @@ public final class EncryptInsertOptimizeEngine implements EncryptOptimizeEngine<
allColumnNames
.
addAll
(
derivedColumnNames
);
return
new
InsertValue
(
allColumnNames
,
assignments
,
derivedColumnsCount
,
parameters
,
parametersOffset
);
}
private
void
fillAssistedQueryInsertValue
(
final
EncryptRule
encryptRule
,
final
List
<
Object
>
parameters
,
final
String
tableName
,
final
Collection
<
String
>
columnNames
,
final
InsertValue
insertValue
)
{
for
(
String
each
:
columnNames
)
{
if
(
encryptRule
.
getAssistedQueryColumn
(
tableName
,
each
).
isPresent
())
{
insertValue
.
appendValue
((
Comparable
<?>)
insertValue
.
getValue
(
each
),
parameters
);
}
}
}
private
void
fillPlainInsertValue
(
final
EncryptRule
encryptRule
,
final
List
<
Object
>
parameters
,
final
String
tableName
,
final
Collection
<
String
>
columnNames
,
final
InsertValue
insertValue
)
{
for
(
String
each
:
columnNames
)
{
if
(
encryptRule
.
getPlainColumn
(
tableName
,
each
).
isPresent
())
{
insertValue
.
appendValue
((
Comparable
<?>)
insertValue
.
getValue
(
each
),
parameters
);
}
}
}
}
sharding-core/sharding-core-optimize/src/main/java/org/apache/shardingsphere/core/optimize/sharding/engnie/dml/ShardingInsertOptimizeEngine.java
浏览文件 @
55427d08
...
...
@@ -30,7 +30,6 @@ import org.apache.shardingsphere.core.parse.sql.segment.dml.column.ColumnSegment
import
org.apache.shardingsphere.core.parse.sql.segment.dml.column.OnDuplicateKeyColumnsSegment
;
import
org.apache.shardingsphere.core.parse.sql.segment.dml.expr.ExpressionSegment
;
import
org.apache.shardingsphere.core.parse.sql.statement.dml.InsertStatement
;
import
org.apache.shardingsphere.core.rule.EncryptRule
;
import
org.apache.shardingsphere.core.rule.ShardingRule
;
import
java.util.Collection
;
...
...
@@ -77,13 +76,6 @@ public final class ShardingInsertOptimizeEngine implements ShardingOptimizeEngin
if
(
isGeneratedValue
)
{
insertValue
.
appendValue
(
generatedValues
.
next
(),
insertValue
.
getParameters
());
}
EncryptRule
encryptRule
=
shardingRule
.
getEncryptRule
();
if
(
encryptRule
.
containsQueryAssistedColumn
(
tableName
))
{
fillAssistedQueryInsertValue
(
encryptRule
,
insertValue
.
getParameters
(),
tableName
,
columnNames
,
insertValue
);
}
if
(
encryptRule
.
containsPlainColumn
(
tableName
))
{
fillPlainInsertValue
(
encryptRule
,
insertValue
.
getParameters
(),
tableName
,
columnNames
,
insertValue
);
}
parametersOffset
+=
insertValue
.
getParametersCount
();
}
return
result
;
...
...
@@ -126,21 +118,4 @@ public final class ShardingInsertOptimizeEngine implements ShardingOptimizeEngin
allColumnNames
.
addAll
(
derivedColumnNames
);
return
new
InsertValue
(
allColumnNames
,
assignments
,
derivedColumnsCount
,
parameters
,
parametersOffset
);
}
private
void
fillAssistedQueryInsertValue
(
final
EncryptRule
encryptRule
,
final
List
<
Object
>
parameters
,
final
String
tableName
,
final
Collection
<
String
>
columnNames
,
final
InsertValue
insertValue
)
{
for
(
String
each
:
columnNames
)
{
if
(
encryptRule
.
getAssistedQueryColumn
(
tableName
,
each
).
isPresent
())
{
insertValue
.
appendValue
((
Comparable
<?>)
insertValue
.
getValue
(
each
),
parameters
);
}
}
}
private
void
fillPlainInsertValue
(
final
EncryptRule
encryptRule
,
final
List
<
Object
>
parameters
,
final
String
tableName
,
final
Collection
<
String
>
columnNames
,
final
InsertValue
insertValue
)
{
for
(
String
each
:
columnNames
)
{
if
(
encryptRule
.
getPlainColumn
(
tableName
,
each
).
isPresent
())
{
insertValue
.
appendValue
((
Comparable
<?>)
insertValue
.
getValue
(
each
),
parameters
);
}
}
}
}
sharding-core/sharding-core-optimize/src/test/java/org/apache/shardingsphere/core/optimize/encrypt/engine/EncryptInsertOptimizeEngineTest.java
浏览文件 @
55427d08
...
...
@@ -120,9 +120,6 @@ public final class EncryptInsertOptimizeEngineTest {
assertTrue
(
actual
.
getInsertValues
().
get
(
0
).
getParameters
().
isEmpty
());
assertThat
(
actual
.
getInsertValues
().
get
(
0
).
getValue
(
"col1"
),
is
((
Object
)
1
));
assertThat
(
actual
.
getInsertValues
().
get
(
0
).
getValue
(
"col2"
),
is
((
Object
)
2
));
assertThat
(
actual
.
getInsertValues
().
get
(
0
).
getValue
(
"query1"
),
is
((
Object
)
1
));
assertThat
(
actual
.
getInsertValues
().
get
(
0
).
getValue
(
"query2"
),
is
((
Object
)
2
));
}
private
InsertStatement
createInsertStatementWithValuesWithoutPlaceHolderWithQueryEncrypt
()
{
...
...
@@ -143,7 +140,6 @@ public final class EncryptInsertOptimizeEngineTest {
assertTrue
(
actual
.
getInsertValues
().
get
(
0
).
getParameters
().
isEmpty
());
assertThat
(
actual
.
getInsertValues
().
get
(
0
).
getValue
(
"col1"
),
is
((
Object
)
1
));
assertThat
(
actual
.
getInsertValues
().
get
(
0
).
getValue
(
"col2"
),
is
((
Object
)
2
));
}
private
InsertStatement
createInsertStatementWithSetWithoutPlaceHolderWithEncrypt
()
{
...
...
@@ -162,12 +158,9 @@ public final class EncryptInsertOptimizeEngineTest {
EncryptInsertOptimizeEngine
optimizeEngine
=
new
EncryptInsertOptimizeEngine
();
EncryptInsertOptimizedStatement
actual
=
optimizeEngine
.
optimize
(
encryptRule
,
mock
(
TableMetas
.
class
),
""
,
parametersWithValues
,
insertStatement
);
assertThat
(
actual
.
getInsertValues
().
size
(),
is
(
1
));
assertThat
(
actual
.
getInsertValues
().
get
(
0
).
getParameters
().
size
(),
is
(
4
));
assertThat
(
actual
.
getInsertValues
().
get
(
0
).
getParameters
().
size
(),
is
(
2
));
assertThat
(
actual
.
getInsertValues
().
get
(
0
).
getParameters
().
get
(
0
),
is
((
Object
)
1
));
assertThat
(
actual
.
getInsertValues
().
get
(
0
).
getParameters
().
get
(
1
),
is
((
Object
)
2
));
assertThat
(
actual
.
getInsertValues
().
get
(
0
).
getParameters
().
get
(
2
),
is
((
Object
)
1
));
assertThat
(
actual
.
getInsertValues
().
get
(
0
).
getParameters
().
get
(
3
),
is
((
Object
)
2
));
}
private
InsertStatement
createInsertStatementWithSetWithPlaceHolderWithQueryEncrypt
()
{
...
...
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/SQLRewriteEngine.java
浏览文件 @
55427d08
...
...
@@ -43,6 +43,7 @@ import org.apache.shardingsphere.core.rule.ShardingRule;
import
org.apache.shardingsphere.spi.encrypt.ShardingEncryptor
;
import
org.apache.shardingsphere.spi.encrypt.ShardingQueryAssistedEncryptor
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.LinkedList
;
import
java.util.List
;
...
...
@@ -115,13 +116,37 @@ public final class SQLRewriteEngine {
}
private
void
encryptInsertOptimizedStatement
(
final
EncryptRule
encryptRule
,
final
EncryptInsertOptimizedStatement
insertOptimizedStatement
)
{
String
tableName
=
insertOptimizedStatement
.
getTables
().
getSingleTableName
();
for
(
InsertValue
insertValue
:
insertOptimizedStatement
.
getInsertValues
())
{
if
(
encryptRule
.
containsQueryAssistedColumn
(
tableName
))
{
fillAssistedQueryInsertValue
(
encryptRule
,
insertValue
.
getParameters
(),
tableName
,
insertOptimizedStatement
.
getColumnNames
(),
insertValue
);
}
if
(
encryptRule
.
containsPlainColumn
(
tableName
))
{
fillPlainInsertValue
(
encryptRule
,
insertValue
.
getParameters
(),
tableName
,
insertOptimizedStatement
.
getColumnNames
(),
insertValue
);
}
for
(
String
each
:
insertOptimizedStatement
.
getColumnNames
())
{
encryptInsertValue
(
encryptRule
,
insertValue
,
insertOptimizedStatement
.
getTables
().
getSingleTableName
(),
each
);
}
}
}
private
void
fillAssistedQueryInsertValue
(
final
EncryptRule
encryptRule
,
final
List
<
Object
>
parameters
,
final
String
tableName
,
final
Collection
<
String
>
columnNames
,
final
InsertValue
insertValue
)
{
for
(
String
each
:
columnNames
)
{
if
(
encryptRule
.
getAssistedQueryColumn
(
tableName
,
each
).
isPresent
())
{
insertValue
.
appendValue
((
Comparable
<?>)
insertValue
.
getValue
(
each
),
parameters
);
}
}
}
private
void
fillPlainInsertValue
(
final
EncryptRule
encryptRule
,
final
List
<
Object
>
parameters
,
final
String
tableName
,
final
Collection
<
String
>
columnNames
,
final
InsertValue
insertValue
)
{
for
(
String
each
:
columnNames
)
{
if
(
encryptRule
.
getPlainColumn
(
tableName
,
each
).
isPresent
())
{
insertValue
.
appendValue
((
Comparable
<?>)
insertValue
.
getValue
(
each
),
parameters
);
}
}
}
private
void
encryptInsertValue
(
final
EncryptRule
encryptRule
,
final
InsertValue
insertValue
,
final
String
tableName
,
final
String
columnName
)
{
Optional
<
ShardingEncryptor
>
shardingEncryptor
=
encryptRule
.
getShardingEncryptor
(
tableName
,
columnName
);
if
(!
shardingEncryptor
.
isPresent
())
{
...
...
sharding-distribution/sharding-proxy-distribution/pom.xml
浏览文件 @
55427d08
...
...
@@ -58,7 +58,7 @@
<groupId>
com.spotify
</groupId>
<artifactId>
docker-maven-plugin
</artifactId>
<configuration>
<imageName>
shardingsphere/sharding-proxy:4.0.0-RC2
</imageName>
<imageName>
apache/sharding-proxy:4.0.0-RC3
</imageName>
<dockerDirectory>
${project.basedir}/src/main/docker
</dockerDirectory>
<resources>
<resource>
...
...
sharding-distribution/sharding-proxy-distribution/src/main/docker/Dockerfile
浏览文件 @
55427d08
...
...
@@ -18,7 +18,7 @@
FROM
java:7
MAINTAINER
ShardingSphere "dev@shardingsphere.incubator.apache.org"
ENV
CURRENT_VERSION 4.0.0-RC
2
ENV
CURRENT_VERSION 4.0.0-RC
3
ENV
APP_NAME apache-shardingsphere-incubating
ENV
MODULE_NAME sharding-proxy
ENV
LOCAL_PATH /opt/sharding-proxy
...
...
sharding-orchestration/sharding-orchestration-zookeeper-curator-integration-test/pom.xml
浏览文件 @
55427d08
...
...
@@ -21,7 +21,7 @@
<parent>
<groupId>
org.apache.shardingsphere
</groupId>
<artifactId>
sharding-orchestration
</artifactId>
<version>
4.0.0-RC
2
-SNAPSHOT
</version>
<version>
4.0.0-RC
3
-SNAPSHOT
</version>
</parent>
<artifactId>
sharding-orchestration-zookeeper-curator-integration-test
</artifactId>
<name>
${project.artifactId}
</name>
...
...
sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/transport/mysql/constant/MySQLServerInfo.java
浏览文件 @
55427d08
...
...
@@ -36,7 +36,7 @@ public final class MySQLServerInfo {
/**
* Server version.
*/
public
static
final
String
SERVER_VERSION
=
"5.6.0-Sharding-Proxy 4.0.0-RC
2
"
;
public
static
final
String
SERVER_VERSION
=
"5.6.0-Sharding-Proxy 4.0.0-RC
3
"
;
/**
* Charset code 0x21 is utf8_general_ci.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录