This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 324fabe Fixes 9955 (#9972)
324fabe is described below
commit 324fabe92b125b60e985caf67a1c24ca2cdec52b
Author: Haoran Meng <[email protected]>
AuthorDate: Wed Apr 7 20:02:59 2021 +0800
Fixes 9955 (#9972)
---
.../proxy/backend/text/TextProtocolBackendHandlerFactory.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/TextProtocolBackendHandlerFactory.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/TextProtocolBackendHandlerFactory.java
index c22633c..22e06d2 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/TextProtocolBackendHandlerFactory.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/TextProtocolBackendHandlerFactory.java
@@ -88,8 +88,11 @@ public final class TextProtocolBackendHandlerFactory {
}
private static void sqlCheck(final BackendConnection backendConnection,
final SQLStatement sqlStatement) {
- MetaDataContexts contexts =
ProxyContext.getInstance().getMetaDataContexts();
- SQLCheckEngine.check(sqlStatement, Collections.emptyList(),
contexts.getMetaData(backendConnection.getSchemaName()),
backendConnection.getGrantee());
+ if (!Strings.isNullOrEmpty(backendConnection.getSchemaName())) {
+ // TODO need to refactor after GlobalRule is added
+ MetaDataContexts contexts =
ProxyContext.getInstance().getMetaDataContexts();
+ SQLCheckEngine.check(sqlStatement, Collections.emptyList(),
contexts.getMetaData(backendConnection.getSchemaName()),
backendConnection.getGrantee());
+ }
}
private static DatabaseType getBackendDatabaseType(final DatabaseType
defaultDatabaseType, final BackendConnection backendConnection) {