You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by ji...@apache.org on 2022/05/19 08:49:46 UTC
[shardingsphere] branch master updated: Fix the exception when specifying schema when JDBC connects to Proxy (#17611)
This is an automated email from the ASF dual-hosted git repository.
jianglongtao 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 1d13c34de95 Fix the exception when specifying schema when JDBC connects to Proxy (#17611)
1d13c34de95 is described below
commit 1d13c34de95961de7d703253fc5e122c995c259d
Author: lanchengx <52...@users.noreply.github.com>
AuthorDate: Thu May 19 16:49:30 2022 +0800
Fix the exception when specifying schema when JDBC connects to Proxy (#17611)
* Adapt to JDBC specified schema connection.
* Adapt to JDBC specified schema connection.
---
.../backend/text/admin/mysql/MySQLAdminExecutorCreator.java | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/MySQLAdminExecutorCreator.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/MySQLAdminExecutorCreator.java
index 1ef5bd478af..f4ac85c9c60 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/MySQLAdminExecutorCreator.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/MySQLAdminExecutorCreator.java
@@ -159,14 +159,12 @@ public final class MySQLAdminExecutorCreator implements DatabaseAdminExecutorCre
private DatabaseAdminExecutor mockExecutor(final String schemaName, final SelectStatement sqlStatement, final String sql) {
boolean isNotUseSchema = !Optional.ofNullable(schemaName).isPresent() && sqlStatement.getFrom() == null;
+ if (!hasDatabases() || !hasResources()) {
+ return new NoResourceShowExecutor(sqlStatement);
+ }
+ String driverType = ProxyContext.getInstance().getContextManager().getMetaDataContexts().getProps().getValue(ConfigurationPropertyKey.PROXY_BACKEND_DRIVER_TYPE);
if (isNotUseSchema) {
- if (!hasDatabases() || !hasResources()) {
- return new NoResourceShowExecutor(sqlStatement);
- } else {
- // TODO Avoid accessing database here, consider using `org.apache.shardingsphere.proxy.backend.text.data.DatabaseBackendHandler`
- String driverType = ProxyContext.getInstance().getContextManager().getMetaDataContexts().getProps().getValue(ConfigurationPropertyKey.PROXY_BACKEND_DRIVER_TYPE);
- return "ExperimentalVertx".equals(driverType) ? null : new UnicastResourceShowExecutor(sqlStatement, sql);
- }
+ return "ExperimentalVertx".equals(driverType) ? null : new UnicastResourceShowExecutor(sqlStatement, sql);
}
return null;
}