Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Shardingsphere
提交
0b252b26
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,发现更多精彩内容 >>
提交
0b252b26
编写于
5月 31, 2019
作者:
T
tristaZero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
do not use shardingRule.getShardingEncryptorEngine()
上级
bbe932cf
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
12 addition
and
17 deletion
+12
-17
sharding-core/sharding-core-entry/src/main/java/org/apache/shardingsphere/core/BaseShardingEngine.java
...va/org/apache/shardingsphere/core/BaseShardingEngine.java
+1
-1
sharding-core/sharding-core-optimize/src/main/java/org/apache/shardingsphere/core/optimize/engine/sharding/insert/InsertOptimizeEngine.java
...optimize/engine/sharding/insert/InsertOptimizeEngine.java
+3
-3
sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/executor/PreparedStatementExecutor.java
...here/shardingjdbc/executor/PreparedStatementExecutor.java
+2
-2
sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/executor/StatementExecutor.java
...ardingsphere/shardingjdbc/executor/StatementExecutor.java
+2
-2
sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/adapter/AbstractResultSetAdapter.java
...e/shardingjdbc/jdbc/adapter/AbstractResultSetAdapter.java
+0
-5
sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/statement/ShardingPreparedStatement.java
...ngjdbc/jdbc/core/statement/ShardingPreparedStatement.java
+1
-1
sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/statement/ShardingStatement.java
...e/shardingjdbc/jdbc/core/statement/ShardingStatement.java
+1
-1
sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/execute/callback/ProxySQLExecuteCallback.java
...cation/jdbc/execute/callback/ProxySQLExecuteCallback.java
+2
-2
未找到文件。
sharding-core/sharding-core-entry/src/main/java/org/apache/shardingsphere/core/BaseShardingEngine.java
浏览文件 @
0b252b26
...
...
@@ -104,7 +104,7 @@ public abstract class BaseShardingEngine {
private
Collection
<
RouteUnit
>
rewriteAndConvert
(
final
List
<
Object
>
parameters
,
final
SQLRouteResult
sqlRouteResult
)
{
SQLRewriteEngine
rewriteEngine
=
new
SQLRewriteEngine
(
shardingRule
,
sqlRouteResult
.
getSqlStatement
(),
parameters
);
ShardingSQLRewriter
shardingSQLRewriter
=
new
ShardingSQLRewriter
(
shardingRule
,
databaseType
,
sqlRouteResult
);
EncryptSQLRewriter
encryptSQLRewriter
=
new
EncryptSQLRewriter
(
shardingRule
.
get
Sharding
EncryptorEngine
(),
sqlRouteResult
.
getSqlStatement
(),
sqlRouteResult
.
getOptimizeResult
());
EncryptSQLRewriter
encryptSQLRewriter
=
new
EncryptSQLRewriter
(
shardingRule
.
get
EncryptRule
().
get
EncryptorEngine
(),
sqlRouteResult
.
getSqlStatement
(),
sqlRouteResult
.
getOptimizeResult
());
rewriteEngine
.
init
(
shardingSQLRewriter
,
encryptSQLRewriter
);
Collection
<
RouteUnit
>
result
=
new
LinkedHashSet
<>();
for
(
RoutingUnit
each
:
sqlRouteResult
.
getRoutingResult
().
getRoutingUnits
())
{
...
...
sharding-core/sharding-core-optimize/src/main/java/org/apache/shardingsphere/core/optimize/engine/sharding/insert/InsertOptimizeEngine.java
浏览文件 @
0b252b26
...
...
@@ -114,7 +114,7 @@ public final class InsertOptimizeEngine implements OptimizeEngine {
result
+=
1
;
}
if
(
isNeededToAppendQueryAssistedColumn
())
{
result
+=
shardingRule
.
get
Sharding
EncryptorEngine
().
getAssistedQueryColumnCount
(
insertStatement
.
getTables
().
getSingleTableName
());
result
+=
shardingRule
.
get
EncryptRule
().
get
EncryptorEngine
().
getAssistedQueryColumnCount
(
insertStatement
.
getTables
().
getSingleTableName
());
}
return
result
;
}
...
...
@@ -154,14 +154,14 @@ public final class InsertOptimizeEngine implements OptimizeEngine {
}
private
boolean
isNeededToAppendQueryAssistedColumn
()
{
return
shardingRule
.
get
Sharding
EncryptorEngine
().
isHasShardingQueryAssistedEncryptor
(
insertStatement
.
getTables
().
getSingleTableName
());
return
shardingRule
.
get
EncryptRule
().
get
EncryptorEngine
().
isHasShardingQueryAssistedEncryptor
(
insertStatement
.
getTables
().
getSingleTableName
());
}
private
void
fillWithQueryAssistedColumn
(
final
InsertOptimizeResult
insertOptimizeResult
,
final
int
insertOptimizeResultIndex
)
{
Collection
<
String
>
assistedColumnNames
=
new
LinkedList
<>();
for
(
String
each
:
insertOptimizeResult
.
getColumnNames
())
{
InsertOptimizeResultUnit
unit
=
insertOptimizeResult
.
getUnits
().
get
(
insertOptimizeResultIndex
);
Optional
<
String
>
assistedColumnName
=
shardingRule
.
get
Sharding
EncryptorEngine
().
getAssistedQueryColumn
(
insertStatement
.
getTables
().
getSingleTableName
(),
each
);
Optional
<
String
>
assistedColumnName
=
shardingRule
.
get
EncryptRule
().
get
EncryptorEngine
().
getAssistedQueryColumn
(
insertStatement
.
getTables
().
getSingleTableName
(),
each
);
if
(
assistedColumnName
.
isPresent
())
{
assistedColumnNames
.
add
(
assistedColumnName
.
get
());
fillInsertOptimizeResultUnit
(
unit
,
(
Comparable
<?>)
unit
.
getColumnValue
(
each
));
...
...
sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/executor/PreparedStatementExecutor.java
浏览文件 @
0b252b26
...
...
@@ -115,8 +115,8 @@ public final class PreparedStatementExecutor extends AbstractStatementExecutor {
ResultSet
resultSet
=
preparedStatement
.
executeQuery
();
ShardingRule
shardingRule
=
getConnection
().
getShardingContext
().
getShardingRule
();
getResultSets
().
add
(
resultSet
);
return
ConnectionMode
.
MEMORY_STRICTLY
==
connectionMode
?
new
StreamQueryResult
(
resultSet
,
shardingRule
,
shardingRule
.
get
Sharding
EncryptorEngine
())
:
new
MemoryQueryResult
(
resultSet
,
shardingRule
,
shardingRule
.
get
Sharding
EncryptorEngine
());
return
ConnectionMode
.
MEMORY_STRICTLY
==
connectionMode
?
new
StreamQueryResult
(
resultSet
,
shardingRule
,
shardingRule
.
get
EncryptRule
().
get
EncryptorEngine
())
:
new
MemoryQueryResult
(
resultSet
,
shardingRule
,
shardingRule
.
get
EncryptRule
().
get
EncryptorEngine
());
}
/**
...
...
sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/executor/StatementExecutor.java
浏览文件 @
0b252b26
...
...
@@ -103,8 +103,8 @@ public final class StatementExecutor extends AbstractStatementExecutor {
ResultSet
resultSet
=
statement
.
executeQuery
(
routeUnit
.
getSqlUnit
().
getSql
());
ShardingRule
shardingRule
=
getConnection
().
getShardingContext
().
getShardingRule
();
getResultSets
().
add
(
resultSet
);
return
ConnectionMode
.
MEMORY_STRICTLY
==
connectionMode
?
new
StreamQueryResult
(
resultSet
,
shardingRule
,
shardingRule
.
get
Sharding
EncryptorEngine
())
:
new
MemoryQueryResult
(
resultSet
,
shardingRule
,
shardingRule
.
get
Sharding
EncryptorEngine
());
return
ConnectionMode
.
MEMORY_STRICTLY
==
connectionMode
?
new
StreamQueryResult
(
resultSet
,
shardingRule
,
shardingRule
.
get
EncryptRule
().
get
EncryptorEngine
())
:
new
MemoryQueryResult
(
resultSet
,
shardingRule
,
shardingRule
.
get
EncryptRule
().
get
EncryptorEngine
());
}
/**
...
...
sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/adapter/AbstractResultSetAdapter.java
浏览文件 @
0b252b26
...
...
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.shardingjdbc.jdbc.adapter;
import
com.google.common.base.Preconditions
;
import
lombok.Getter
;
import
org.apache.shardingsphere.core.rule.ShardingRule
;
import
org.apache.shardingsphere.core.strategy.encrypt.ShardingEncryptorEngine
;
import
org.apache.shardingsphere.shardingjdbc.jdbc.adapter.executor.ForceExecuteCallback
;
import
org.apache.shardingsphere.shardingjdbc.jdbc.adapter.executor.ForceExecuteTemplate
;
import
org.apache.shardingsphere.shardingjdbc.jdbc.core.resultset.ShardingResultSetMetaData
;
...
...
@@ -69,10 +68,6 @@ public abstract class AbstractResultSetAdapter extends AbstractUnsupportedOperat
:
((
ShardingStatement
)
statement
).
getConnection
().
getShardingContext
().
getShardingRule
();
}
protected
final
ShardingEncryptorEngine
getShardingEncryptorEngine
()
{
return
getShardingRule
().
getShardingEncryptorEngine
();
}
@Override
public
final
int
findColumn
(
final
String
columnLabel
)
throws
SQLException
{
return
resultSets
.
get
(
0
).
findColumn
(
columnLabel
);
...
...
sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/statement/ShardingPreparedStatement.java
浏览文件 @
0b252b26
...
...
@@ -133,7 +133,7 @@ public final class ShardingPreparedStatement extends AbstractShardingPreparedSta
ResultSet
resultSet
=
each
.
getResultSet
();
resultSets
.
add
(
resultSet
);
ShardingRule
shardingRule
=
connection
.
getShardingContext
().
getShardingRule
();
queryResults
.
add
(
new
StreamQueryResult
(
resultSet
,
shardingRule
,
shardingRule
.
get
Sharding
EncryptorEngine
()));
queryResults
.
add
(
new
StreamQueryResult
(
resultSet
,
shardingRule
,
shardingRule
.
get
EncryptRule
().
get
EncryptorEngine
()));
}
if
(
routeResult
.
getSqlStatement
()
instanceof
SelectStatement
||
routeResult
.
getSqlStatement
()
instanceof
DALStatement
)
{
MergeEngine
mergeEngine
=
MergeEngineFactory
.
newInstance
(
connection
.
getShardingContext
().
getDatabaseType
(),
...
...
sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/statement/ShardingStatement.java
浏览文件 @
0b252b26
...
...
@@ -114,7 +114,7 @@ public final class ShardingStatement extends AbstractStatementAdapter {
ResultSet
resultSet
=
each
.
getResultSet
();
resultSets
.
add
(
resultSet
);
ShardingRule
shardingRule
=
connection
.
getShardingContext
().
getShardingRule
();
queryResults
.
add
(
new
StreamQueryResult
(
resultSet
,
shardingRule
,
shardingRule
.
get
Sharding
EncryptorEngine
()));
queryResults
.
add
(
new
StreamQueryResult
(
resultSet
,
shardingRule
,
shardingRule
.
get
EncryptRule
().
get
EncryptorEngine
()));
}
if
(
routeResult
.
getSqlStatement
()
instanceof
SelectStatement
||
routeResult
.
getSqlStatement
()
instanceof
DALStatement
)
{
MergeEngine
mergeEngine
=
MergeEngineFactory
.
newInstance
(
connection
.
getShardingContext
().
getDatabaseType
(),
...
...
sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/execute/callback/ProxySQLExecuteCallback.java
浏览文件 @
0b252b26
...
...
@@ -100,8 +100,8 @@ public final class ProxySQLExecuteCallback extends SQLExecuteCallback<ExecuteRes
LogicSchema
logicSchema
=
backendConnection
.
getLogicSchema
();
if
(
logicSchema
instanceof
ShardingSchema
)
{
ShardingRule
shardingRule
=
logicSchema
.
getShardingRule
();
return
connectionMode
==
ConnectionMode
.
MEMORY_STRICTLY
?
new
StreamQueryResult
(
resultSet
,
shardingRule
,
shardingRule
.
get
Sharding
EncryptorEngine
())
:
new
MemoryQueryResult
(
resultSet
,
shardingRule
,
shardingRule
.
get
Sharding
EncryptorEngine
());
return
connectionMode
==
ConnectionMode
.
MEMORY_STRICTLY
?
new
StreamQueryResult
(
resultSet
,
shardingRule
,
shardingRule
.
get
EncryptRule
().
get
EncryptorEngine
())
:
new
MemoryQueryResult
(
resultSet
,
shardingRule
,
shardingRule
.
get
EncryptRule
().
get
EncryptorEngine
());
}
if
(
logicSchema
instanceof
EncryptSchema
)
{
EncryptSchema
encryptSchema
=
(
EncryptSchema
)
logicSchema
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录