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/10/16 15:51:44 UTC

[GitHub] [incubator-shardingsphere] terrymanu commented on a change in pull request #3295: fixed for #3234 and add the encrypted test case for more than four cipher coloumns

terrymanu commented on a change in pull request #3295: fixed for #3234 and add the encrypted test case for more than four cipher coloumns
URL: https://github.com/apache/incubator-shardingsphere/pull/3295#discussion_r335561157
 
 

 ##########
 File path: sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/feature/encrypt/parameter/impl/EncryptInsertValueParameterRewriter.java
 ##########
 @@ -57,10 +60,14 @@ public void rewrite(final ParameterBuilder parameterBuilder, final SQLStatementC
         if (!encryptTable.isPresent()) {
             return;
         }
-        for (String each : encryptTable.get().getLogicColumns()) {
-            Optional<ShardingEncryptor> shardingEncryptor = encryptRule.findShardingEncryptor(tableName, each);
+        Optional<InsertColumnsSegment> insertColumnsSegment = sqlStatementContext.getSqlStatement().findSQLSegment(InsertColumnsSegment.class);
+        if (!insertColumnsSegment.isPresent()) {
+            return;
+        }
+        for (ColumnSegment each : insertColumnsSegment.get().getColumns()) {
 
 Review comment:
   How to deal insert SQL without columns, such as: `INSERT INTO tbl VALUES(?, ?, ?)`
   
   If no columns, the `insertColumnsSegment.get().getColumns()` will return a empty list, and may cause failure.
   
   I forget add the test cases for insert without columns, I will add it soon in other pull request.

----------------------------------------------------------------
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