This is an automated email from the ASF dual-hosted git repository.

sunnianjun 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 b7c169decc2 Use CaseInsensitiveMap on ShardingSphereDatabase (#32430)
b7c169decc2 is described below

commit b7c169decc2a4a1b838ad38597c6b41d9924ca1b
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Aug 8 18:44:19 2024 +0800

    Use CaseInsensitiveMap on ShardingSphereDatabase (#32430)
    
    * Use CaseInsensitiveMap on ShardingSphereDatabase
    
    * Use CaseInsensitiveMap on ShardingSphereDatabase
---
 .../infra/metadata/database/ShardingSphereDatabase.java      | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/ShardingSphereDatabase.java
 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/ShardingSphereDatabase.java
index 8a5c496d07a..a2fb2d6c066 100644
--- 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/ShardingSphereDatabase.java
+++ 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/ShardingSphereDatabase.java
@@ -17,6 +17,7 @@
 
 package org.apache.shardingsphere.infra.metadata.database;
 
+import com.cedarsoftware.util.CaseInsensitiveMap;
 import lombok.Getter;
 import org.apache.shardingsphere.infra.config.database.DatabaseConfiguration;
 import 
org.apache.shardingsphere.infra.config.database.impl.DataSourceProvidedDatabaseConfiguration;
@@ -69,8 +70,7 @@ public final class ShardingSphereDatabase {
         this.protocolType = protocolType;
         this.resourceMetaData = resourceMetaData;
         this.ruleMetaData = ruleMetaData;
-        this.schemas = new ConcurrentHashMap<>(schemas.size(), 1F);
-        schemas.forEach((key, value) -> this.schemas.put(key.toLowerCase(), 
value));
+        this.schemas = new CaseInsensitiveMap<>(schemas, new 
ConcurrentHashMap<>(schemas.size(), 1F));
     }
     
     /**
@@ -145,7 +145,7 @@ public final class ShardingSphereDatabase {
      * @return contains schema from database or not
      */
     public boolean containsSchema(final String schemaName) {
-        return schemas.containsKey(schemaName.toLowerCase());
+        return schemas.containsKey(schemaName);
     }
     
     /**
@@ -155,7 +155,7 @@ public final class ShardingSphereDatabase {
      * @return schema
      */
     public ShardingSphereSchema getSchema(final String schemaName) {
-        return schemas.get(schemaName.toLowerCase());
+        return schemas.get(schemaName);
     }
     
     /**
@@ -165,7 +165,7 @@ public final class ShardingSphereDatabase {
      * @param schema schema
      */
     public void addSchema(final String schemaName, final ShardingSphereSchema 
schema) {
-        schemas.put(schemaName.toLowerCase(), schema);
+        schemas.put(schemaName, schema);
     }
     
     /**
@@ -174,7 +174,7 @@ public final class ShardingSphereDatabase {
      * @param schemaName schema name
      */
     public void dropSchema(final String schemaName) {
-        schemas.remove(schemaName.toLowerCase());
+        schemas.remove(schemaName);
     }
     
     /**

Reply via email to