You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2020/10/14 07:55:45 UTC

[shardingsphere] branch master updated: Fixes exception when execute SELECT in encrypt db without creating tables (#7788)

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

zhangliang 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 94cdb28  Fixes exception when execute SELECT in encrypt db without creating tables (#7788)
94cdb28 is described below

commit 94cdb28d6c6bcc3e5c8091ad5a3c2b64171bccd5
Author: Haoran Meng <me...@gmail.com>
AuthorDate: Wed Oct 14 15:55:25 2020 +0800

    Fixes exception when execute SELECT in encrypt db without creating tables (#7788)
---
 .../token/generator/impl/EncryptProjectionTokenGenerator.java     | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-rewrite/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/impl/EncryptProjectionTokenGenerator.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-rewrite/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/impl/EncryptProjectionTokenGenerator.java
index 2e2e9c2..6a1b60c 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-rewrite/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/impl/EncryptProjectionTokenGenerator.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-rewrite/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/impl/EncryptProjectionTokenGenerator.java
@@ -74,7 +74,10 @@ public final class EncryptProjectionTokenGenerator extends BaseEncryptSQLTokenGe
                 }
             }
             if (isToGeneratedSQLToken(each, selectStatementContext, tableName)) {
-                result.add(generateSQLToken((ShorthandProjectionSegment) each, selectStatementContext.getProjectionsContext(), tableName, encryptTable));
+                ShorthandProjection shorthandProjection = getShorthandProjection((ShorthandProjectionSegment) each, selectStatementContext.getProjectionsContext());
+                if (!shorthandProjection.getActualColumns().isEmpty()) {
+                    result.add(generateSQLToken((ShorthandProjectionSegment) each, shorthandProjection, tableName, encryptTable));
+                }
             }
         }
         return result;
@@ -98,8 +101,7 @@ public final class EncryptProjectionTokenGenerator extends BaseEncryptSQLTokenGe
     }
     
     private SubstitutableColumnNameToken generateSQLToken(final ShorthandProjectionSegment segment, 
-                                                          final ProjectionsContext projectionsContext, final String tableName, final EncryptTable encryptTable) {
-        ShorthandProjection shorthandProjection = getShorthandProjection(segment, projectionsContext);
+                                                          final ShorthandProjection shorthandProjection, final String tableName, final EncryptTable encryptTable) {
         List<String> shorthandExtensionProjections = new LinkedList<>();
         for (ColumnProjection each : shorthandProjection.getActualColumns()) {
             if (encryptTable.getLogicColumns().contains(each.getName())) {