Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Shardingsphere
提交
4b144e3e
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
4b144e3e
编写于
8月 05, 2020
作者:
J
Juan Pan(Trista)
提交者:
GitHub
8月 05, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add gitignore and optimize proxy backend interface. (#6618)
* Add gitignore and optimize proxy backend interface. * remove gen
上级
41ab41dd
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
19 addition
and
16 deletion
+19
-16
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngineFactory.java
...end/communication/DatabaseCommunicationEngineFactory.java
+4
-4
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/BroadcastBackendHandler.java
...ere/proxy/backend/text/admin/BroadcastBackendHandler.java
+1
-1
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/UnicastBackendHandler.java
...phere/proxy/backend/text/admin/UnicastBackendHandler.java
+1
-1
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/query/QueryBackendHandler.java
...gsphere/proxy/backend/text/query/QueryBackendHandler.java
+1
-1
shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/DatabaseCommunicationEngineFactoryTest.java
...nication/jdbc/DatabaseCommunicationEngineFactoryTest.java
+6
-3
shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/BroadcastBackendHandlerTest.java
...proxy/backend/text/admin/BroadcastBackendHandlerTest.java
+1
-1
shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/UnicastBackendHandlerTest.java
...e/proxy/backend/text/admin/UnicastBackendHandlerTest.java
+1
-1
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/execute/MySQLComStmtExecuteExecutor.java
...and/query/binary/execute/MySQLComStmtExecuteExecutor.java
+2
-2
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/text/fieldlist/MySQLComFieldListPacketExecutor.java
...query/text/fieldlist/MySQLComFieldListPacketExecutor.java
+1
-1
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/binary/bind/PostgreSQLComBindExecutor.java
.../command/query/binary/bind/PostgreSQLComBindExecutor.java
+1
-1
未找到文件。
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngineFactory.java
浏览文件 @
4b144e3e
...
...
@@ -54,12 +54,12 @@ public final class DatabaseCommunicationEngineFactory {
/**
* Create new instance of text protocol backend handler.
*
* @param schema ShardingSphere schema
* @param sql SQL to be executed
* @param backendConnection backend connection
* @return instance of text protocol backend handler
*/
public
DatabaseCommunicationEngine
newTextProtocolInstance
(
final
SchemaContext
schema
,
final
String
sql
,
final
BackendConnection
backendConnection
)
{
public
DatabaseCommunicationEngine
newTextProtocolInstance
(
final
String
sql
,
final
BackendConnection
backendConnection
)
{
SchemaContext
schema
=
backendConnection
.
getSchema
();
SQLStatement
sqlStatement
=
schema
.
getRuntimeContext
().
getSqlParserEngine
().
parse
(
sql
,
false
);
return
new
JDBCDatabaseCommunicationEngine
(
sql
,
backendConnection
,
createSQLExecuteEngine
(
schema
,
sqlStatement
,
backendConnection
,
new
StatementExecutorWrapper
(
schema
,
sqlStatement
)));
}
...
...
@@ -67,13 +67,13 @@ public final class DatabaseCommunicationEngineFactory {
/**
* Create new instance of text protocol backend handler.
*
* @param schema ShardingSphere schema
* @param sql SQL to be executed
* @param parameters SQL parameters
* @param backendConnection backend connection
* @return instance of text protocol backend handler
*/
public
DatabaseCommunicationEngine
newBinaryProtocolInstance
(
final
SchemaContext
schema
,
final
String
sql
,
final
List
<
Object
>
parameters
,
final
BackendConnection
backendConnection
)
{
public
DatabaseCommunicationEngine
newBinaryProtocolInstance
(
final
String
sql
,
final
List
<
Object
>
parameters
,
final
BackendConnection
backendConnection
)
{
SchemaContext
schema
=
backendConnection
.
getSchema
();
SQLStatement
sqlStatement
=
schema
.
getRuntimeContext
().
getSqlParserEngine
().
parse
(
sql
,
true
);
return
new
JDBCDatabaseCommunicationEngine
(
sql
,
backendConnection
,
createSQLExecuteEngine
(
schema
,
sqlStatement
,
backendConnection
,
new
PreparedStatementExecutorWrapper
(
schema
,
sqlStatement
,
parameters
)));
...
...
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/BroadcastBackendHandler.java
浏览文件 @
4b144e3e
...
...
@@ -48,7 +48,7 @@ public final class BroadcastBackendHandler implements TextProtocolBackendHandler
String
originalSchema
=
backendConnection
.
getSchema
().
getName
();
for
(
String
each
:
ProxySchemaContexts
.
getInstance
().
getSchemaNames
())
{
backendConnection
.
setCurrentSchema
(
each
);
responses
.
add
(
databaseCommunicationEngineFactory
.
newTextProtocolInstance
(
ProxySchemaContexts
.
getInstance
().
getSchema
(
each
),
sql
,
backendConnection
).
execute
());
responses
.
add
(
databaseCommunicationEngineFactory
.
newTextProtocolInstance
(
sql
,
backendConnection
).
execute
());
}
backendConnection
.
setCurrentSchema
(
originalSchema
);
for
(
BackendResponse
each
:
responses
)
{
...
...
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/UnicastBackendHandler.java
浏览文件 @
4b144e3e
...
...
@@ -49,7 +49,7 @@ public final class UnicastBackendHandler implements TextProtocolBackendHandler {
if
(
null
==
backendConnection
.
getSchema
())
{
return
new
ErrorResponse
(
new
NoDatabaseSelectedException
());
}
databaseCommunicationEngine
=
databaseCommunicationEngineFactory
.
newTextProtocolInstance
(
backendConnection
.
getSchema
(),
sql
,
backendConnection
);
databaseCommunicationEngine
=
databaseCommunicationEngineFactory
.
newTextProtocolInstance
(
sql
,
backendConnection
);
return
databaseCommunicationEngine
.
execute
();
}
...
...
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/query/QueryBackendHandler.java
浏览文件 @
4b144e3e
...
...
@@ -48,7 +48,7 @@ public final class QueryBackendHandler implements TextProtocolBackendHandler {
if
(
null
==
backendConnection
.
getSchema
())
{
return
new
ErrorResponse
(
new
NoDatabaseSelectedException
());
}
databaseCommunicationEngine
=
databaseCommunicationEngineFactory
.
newTextProtocolInstance
(
backendConnection
.
getSchema
(),
sql
,
backendConnection
);
databaseCommunicationEngine
=
databaseCommunicationEngineFactory
.
newTextProtocolInstance
(
sql
,
backendConnection
);
return
databaseCommunicationEngine
.
execute
();
}
...
...
shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/DatabaseCommunicationEngineFactoryTest.java
浏览文件 @
4b144e3e
...
...
@@ -57,15 +57,18 @@ public final class DatabaseCommunicationEngineFactoryTest {
@Test
public
void
assertNewTextProtocolInstance
()
{
DatabaseCommunicationEngine
engine
=
DatabaseCommunicationEngineFactory
.
getInstance
().
newTextProtocolInstance
(
schemaContext
,
"schemaName"
,
mock
(
BackendConnection
.
class
));
BackendConnection
backendConnection
=
mock
(
BackendConnection
.
class
);
when
(
backendConnection
.
getSchema
()).
thenReturn
(
schemaContext
);
DatabaseCommunicationEngine
engine
=
DatabaseCommunicationEngineFactory
.
getInstance
().
newTextProtocolInstance
(
"schemaName"
,
backendConnection
);
assertNotNull
(
engine
);
assertThat
(
engine
,
instanceOf
(
JDBCDatabaseCommunicationEngine
.
class
));
}
@Test
public
void
assertNewBinaryProtocolInstance
()
{
DatabaseCommunicationEngine
engine
=
DatabaseCommunicationEngineFactory
.
getInstance
()
.
newBinaryProtocolInstance
(
schemaContext
,
"schemaName"
,
Collections
.
emptyList
(),
mock
(
BackendConnection
.
class
));
BackendConnection
backendConnection
=
mock
(
BackendConnection
.
class
);
when
(
backendConnection
.
getSchema
()).
thenReturn
(
schemaContext
);
DatabaseCommunicationEngine
engine
=
DatabaseCommunicationEngineFactory
.
getInstance
().
newBinaryProtocolInstance
(
"schemaName"
,
Collections
.
emptyList
(),
backendConnection
);
assertNotNull
(
engine
);
assertThat
(
engine
,
instanceOf
(
JDBCDatabaseCommunicationEngine
.
class
));
}
...
...
shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/BroadcastBackendHandlerTest.java
浏览文件 @
4b144e3e
...
...
@@ -104,7 +104,7 @@ public final class BroadcastBackendHandlerTest {
private
void
mockDatabaseCommunicationEngine
(
final
BackendResponse
backendResponse
)
{
when
(
databaseCommunicationEngine
.
execute
()).
thenReturn
(
backendResponse
);
when
(
databaseCommunicationEngineFactory
.
newTextProtocolInstance
(
any
(),
any
String
(),
any
())).
thenReturn
(
databaseCommunicationEngine
);
when
(
databaseCommunicationEngineFactory
.
newTextProtocolInstance
(
anyString
(),
any
())).
thenReturn
(
databaseCommunicationEngine
);
}
@SneakyThrows
(
ReflectiveOperationException
.
class
)
...
...
shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/UnicastBackendHandlerTest.java
浏览文件 @
4b144e3e
...
...
@@ -97,7 +97,7 @@ public final class UnicastBackendHandlerTest {
private
void
setUnderlyingHandler
(
final
BackendResponse
backendResponse
)
{
DatabaseCommunicationEngine
databaseCommunicationEngine
=
mock
(
DatabaseCommunicationEngine
.
class
);
when
(
databaseCommunicationEngine
.
execute
()).
thenReturn
(
backendResponse
);
when
(
databaseCommunicationEngineFactory
.
newTextProtocolInstance
(
any
(),
any
String
(),
any
())).
thenReturn
(
databaseCommunicationEngine
);
when
(
databaseCommunicationEngineFactory
.
newTextProtocolInstance
(
anyString
(),
any
())).
thenReturn
(
databaseCommunicationEngine
);
}
@SneakyThrows
(
ReflectiveOperationException
.
class
)
...
...
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/execute/MySQLComStmtExecuteExecutor.java
浏览文件 @
4b144e3e
...
...
@@ -67,8 +67,8 @@ public final class MySQLComStmtExecuteExecutor implements QueryCommandExecutor {
private
int
currentSequenceId
;
public
MySQLComStmtExecuteExecutor
(
final
MySQLComStmtExecutePacket
comStmtExecutePacket
,
final
BackendConnection
backendConnection
)
{
databaseCommunicationEngine
=
DatabaseCommunicationEngineFactory
.
getInstance
().
newBinaryProtocolInstance
(
backendConnection
.
getSchema
(),
comStmtExecutePacket
.
getSql
(),
comStmtExecutePacket
.
getParameters
(),
backendConnection
);
databaseCommunicationEngine
=
DatabaseCommunicationEngineFactory
.
getInstance
().
newBinaryProtocolInstance
(
comStmtExecutePacket
.
getSql
(),
comStmtExecutePacket
.
getParameters
(),
backendConnection
);
}
@Override
...
...
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/text/fieldlist/MySQLComFieldListPacketExecutor.java
浏览文件 @
4b144e3e
...
...
@@ -51,7 +51,7 @@ public final class MySQLComFieldListPacketExecutor implements CommandExecutor {
public
MySQLComFieldListPacketExecutor
(
final
MySQLComFieldListPacket
packet
,
final
BackendConnection
backendConnection
)
{
this
.
packet
=
packet
;
schemaName
=
backendConnection
.
getSchema
().
getName
();
databaseCommunicationEngine
=
DatabaseCommunicationEngineFactory
.
getInstance
().
newTextProtocolInstance
(
backendConnection
.
getSchema
(),
getShowColumnsSQL
(),
backendConnection
);
databaseCommunicationEngine
=
DatabaseCommunicationEngineFactory
.
getInstance
().
newTextProtocolInstance
(
getShowColumnsSQL
(),
backendConnection
);
}
@Override
...
...
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/binary/bind/PostgreSQLComBindExecutor.java
浏览文件 @
4b144e3e
...
...
@@ -72,7 +72,7 @@ public final class PostgreSQLComBindExecutor implements QueryCommandExecutor {
public
PostgreSQLComBindExecutor
(
final
PostgreSQLComBindPacket
packet
,
final
BackendConnection
backendConnection
)
{
this
.
packet
=
packet
;
databaseCommunicationEngine
=
null
==
packet
.
getSql
()
?
null
:
DatabaseCommunicationEngineFactory
.
getInstance
().
newBinaryProtocolInstance
(
backendConnection
.
getSchema
(),
packet
.
getSql
(),
packet
.
getParameters
(),
backendConnection
);
?
null
:
DatabaseCommunicationEngineFactory
.
getInstance
().
newBinaryProtocolInstance
(
packet
.
getSql
(),
packet
.
getParameters
(),
backendConnection
);
}
@Override
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录