Skip to content

Commit

Permalink
Fix the exception when specifying schema when JDBC connects to Proxy (a…
Browse files Browse the repository at this point in the history
…pache#17611)

* Adapt to JDBC specified schema connection.

* Adapt to JDBC specified schema connection.
  • Loading branch information
lanchengx authored May 19, 2022
1 parent ec592fa commit 1d13c34
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,12 @@ private boolean isQuerySpecialSchema(final SelectStatement sqlStatement, final S

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;
}
Expand Down

0 comments on commit 1d13c34

Please sign in to comment.