You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/08/24 04:51:42 UTC

[GitHub] [shardingsphere] strongduanmu commented on a change in pull request #11964: Make findColumn case insensitive

strongduanmu commented on a change in pull request #11964:
URL: https://github.com/apache/shardingsphere/pull/11964#discussion_r694488441



##########
File path: shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/resultset/DatabaseMetaDataResultSet.java
##########
@@ -30,15 +30,7 @@
 import java.sql.SQLException;
 import java.sql.Time;
 import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
+import java.util.*;

Review comment:
       @rfscouto Please do not use `*` to import. 

##########
File path: shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/resultset/DatabaseMetaDataResultSet.java
##########
@@ -358,10 +350,27 @@ public Object getObject(final String columnLabel) throws SQLException {
     @Override
     public int findColumn(final String columnLabel) throws SQLException {
         checkClosed();
-        if (!columnLabelIndexMap.containsKey(columnLabel)) {
-            throw new SQLException(String.format("Can not find columnLabel %s", columnLabel));
+
+        Integer columnIndex = columnLabelIndexMap.get(columnLabel);

Review comment:
       @rfscouto The implementation of this logic is a bit complicated. Can we consider using `Map<String, Integer> columnLabelIndexMap  = new TreeMap<>(String.CASE_INSENSITIVE_ORDER)` to solve this exception?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org