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 2022/04/16 12:20:40 UTC

[GitHub] [shardingsphere] strongduanmu commented on a diff in pull request #15965: support noEncryptRewrite hint to force no encrypt rewrite

strongduanmu commented on code in PR #15965:
URL: https://github.com/apache/shardingsphere/pull/15965#discussion_r851622177


##########
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/hint/SQLHintExtractor.java:
##########
@@ -66,4 +66,13 @@ public Optional<String> findHintDataSourceName() {
     public boolean isHintWriteRouteOnly() {
         return sqlHintProperties.getValue(SQLHintPropertiesKey.WRITE_ROUTE_ONLY_KEY);
     }
+    
+    /**
+     * Judge whether is hint indicated encrypt rewrite needed or not.
+     *
+     * @return whether is hint indicated encrypt rewrite needed or not
+     */
+    public boolean isHintEncryptRewriteNeeded() {
+        return sqlHintProperties.getValue(SQLHintPropertiesKey.NO_ENCRYPT_REWRITE_KEY);

Review Comment:
   @cheese8 Can you rename NO_ENCRYPT_REWRITE_KEY to SKIP_ENCRYPT_REWRITE_KEY?



##########
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/hint/SQLHintPropertiesKey.java:
##########
@@ -41,7 +41,12 @@ public enum SQLHintPropertiesKey implements TypedPropertyKey {
     /**
      * Whether to use traffic or not.
      */
-    USE_TRAFFIC("useTraffic", String.valueOf(Boolean.FALSE), boolean.class);
+    USE_TRAFFIC("useTraffic", String.valueOf(Boolean.FALSE), boolean.class),
+    
+    /**
+     * Whether hint indicate encrypt rewrite needed or not.
+     */
+    NO_ENCRYPT_REWRITE_KEY("noEncryptRewrite", String.valueOf(Boolean.FALSE), boolean.class);

Review Comment:
   @cheese8 Can you rename noEncryptRewrite to skipEncryptRewrite?



##########
shardingsphere-test/shardingsphere-rewrite-test/src/test/resources/scenario/encrypt/case/query-with-cipher/dml/update/update.xml:
##########
@@ -21,31 +21,51 @@
         <input sql="UPDATE t_account SET account_id = ?, certificate_number = ?, password = ?, amount = ?, status = ? WHERE account_id = ? AND certificate_number = ? AND password = ? AND amount = ? AND status = ?" parameters="1, 111X, aaa, 1000, OK, 1, 111X, aaa, 1000, OK" />
         <output sql="UPDATE t_account SET account_id = ?, cipher_certificate_number = ?, assisted_query_certificate_number = ?, cipher_password = ?, assisted_query_password = ?, cipher_amount = ?, status = ? WHERE account_id = ? AND assisted_query_certificate_number = ? AND assisted_query_password = ? AND cipher_amount = ? AND status = ?" parameters="1, encrypt_111X, assisted_query_111X, encrypt_aaa, assisted_query_aaa, encrypt_1000, OK, 1, assisted_query_111X, assisted_query_aaa, encrypt_1000, OK" />
     </rewrite-assertion>
-    

Review Comment:
   Please keep same indent with previous line.



##########
shardingsphere-test/shardingsphere-rewrite-test/src/test/resources/scenario/encrypt/case/query-with-cipher/dml/update/update.xml:
##########
@@ -21,31 +21,51 @@
         <input sql="UPDATE t_account SET account_id = ?, certificate_number = ?, password = ?, amount = ?, status = ? WHERE account_id = ? AND certificate_number = ? AND password = ? AND amount = ? AND status = ?" parameters="1, 111X, aaa, 1000, OK, 1, 111X, aaa, 1000, OK" />
         <output sql="UPDATE t_account SET account_id = ?, cipher_certificate_number = ?, assisted_query_certificate_number = ?, cipher_password = ?, assisted_query_password = ?, cipher_amount = ?, status = ? WHERE account_id = ? AND assisted_query_certificate_number = ? AND assisted_query_password = ? AND cipher_amount = ? AND status = ?" parameters="1, encrypt_111X, assisted_query_111X, encrypt_aaa, assisted_query_aaa, encrypt_1000, OK, 1, assisted_query_111X, assisted_query_aaa, encrypt_1000, OK" />
     </rewrite-assertion>
-    
+
     <rewrite-assertion id="update_for_literals" db-types="MySQL">
         <input sql="UPDATE t_account SET account_id = 1, certificate_number = '111X', password = 'aaa', amount = 1000, status = 'OK' WHERE account_id = 1 AND certificate_number = '111X' AND password = 'aaa' AND amount = 1000 AND status = 'OK'" />
         <output sql="UPDATE t_account SET account_id = 1, cipher_certificate_number = 'encrypt_111X', assisted_query_certificate_number = 'assisted_query_111X', cipher_password = 'encrypt_aaa', assisted_query_password = 'assisted_query_aaa', cipher_amount = 'encrypt_1000', status = 'OK' WHERE account_id = 1 AND assisted_query_certificate_number = 'assisted_query_111X' AND assisted_query_password = 'assisted_query_aaa' AND cipher_amount = 'encrypt_1000' AND status = 'OK'" />
     </rewrite-assertion>
-    

Review Comment:
   Please keep same indent with previous line.



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