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 2019/12/23 03:21:15 UTC

[GitHub] [incubator-shardingsphere] terrymanu commented on a change in pull request #3781: Fix encryption rules do not support uppercase fileds

terrymanu commented on a change in pull request #3781: Fix encryption rules do not support uppercase fileds
URL: https://github.com/apache/incubator-shardingsphere/pull/3781#discussion_r360755477
 
 

 ##########
 File path: sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/rule/EncryptRule.java
 ##########
 @@ -132,7 +132,18 @@ public String getLogicColumnOfCipher(final String logicTable, final String ciphe
      * @return plain column
      */
     public Optional<String> findPlainColumn(final String logicTable, final String logicColumn) {
-        return tables.containsKey(logicTable) ? tables.get(logicTable).findPlainColumn(logicColumn) : Optional.<String>absent();
+        return tables.containsKey(logicTable) ? tables.get(logicTable).findPlainColumn(getOriginColumnName(logicTable, logicColumn)) : Optional.<String>absent();
+    }
+
+    private String getOriginColumnName(final String logicTable, final String logicColumn) {
+        String result = logicColumn;
+        for (String each : tables.get(logicTable).getLogicColumns()) {
+            if (logicColumn.equals(each.toLowerCase())) {
+                result = each;
+                break;
+            }
+        }
+        return result;
 
 Review comment:
   What is situation if `logicColumn` cannot find? Maybe throw 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services