You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2021/08/29 04:26:59 UTC
[shardingsphere] branch master updated: Revise #12014 (#12086)
This is an automated email from the ASF dual-hosted git repository.
panjuan 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 62490ba Revise #12014 (#12086)
62490ba is described below
commit 62490baf23669574d88de119781214a04c1f7393
Author: Liang Zhang <te...@163.com>
AuthorDate: Sun Aug 29 12:26:25 2021 +0800
Revise #12014 (#12086)
---
.../text/admin/mysql/executor/ShowDatabasesExecutor.java | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/ShowDatabasesExecutor.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/ShowDatabasesExecutor.java
index 03bae2d..550b148 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/ShowDatabasesExecutor.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/ShowDatabasesExecutor.java
@@ -57,10 +57,7 @@ public final class ShowDatabasesExecutor implements DatabaseAdminQueryExecutor {
private Collection<Object> getSchemaNames(final BackendConnection backendConnection) {
Collection<Object> result = new LinkedList<>();
for (String each : ProxyContext.getInstance().getAllSchemaNames()) {
- if (!checkLikePattern(each)) {
- continue;
- }
- if (SQLCheckEngine.check(each, getRules(each), backendConnection.getGrantee())) {
+ if (checkLikePattern(each) && SQLCheckEngine.check(each, getRules(each), backendConnection.getGrantee())) {
result.add(each);
}
}
@@ -68,12 +65,8 @@ public final class ShowDatabasesExecutor implements DatabaseAdminQueryExecutor {
}
private boolean checkLikePattern(final String schemaName) {
- boolean result = true;
Optional<String> pattern = showDatabasesStatement.getLike().map(SQLUtil::getShowLikePattern);
- if (pattern.isPresent()) {
- result = schemaName.matches(pattern.get());
- }
- return result;
+ return pattern.isPresent() && schemaName.matches(pattern.get());
}
private Collection<ShardingSphereRule> getRules(final String schemaName) {