You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by ji...@apache.org on 2021/10/28 04:38:34 UTC
[shardingsphere] branch master updated: [DistSQL] Support table
level `queryWithCipherColumn` configuration (#13297)
This is an automated email from the ASF dual-hosted git repository.
jianglongtao 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 2b99ee8 [DistSQL] Support table level `queryWithCipherColumn` configuration (#13297)
2b99ee8 is described below
commit 2b99ee82ceee53f01df1497fcea2236d0de920a2
Author: Guocheng Tang <to...@qq.com>
AuthorDate: Thu Oct 28 12:37:40 2021 +0800
[DistSQL] Support table level `queryWithCipherColumn` configuration (#13297)
* [DistSQL] Support table level `queryWithCipherColumn` configuration
* Support uppercase & update documents
* fix code style
* remove bank line
---
.../usage/distsql/syntax/rdl/rdl-encrypt-rule.cn.md | 9 +++++----
.../usage/distsql/syntax/rdl/rdl-encrypt-rule.en.md | 9 +++++----
.../src/main/antlr4/imports/encrypt/Keyword.g4 | 12 ++++++++++++
.../src/main/antlr4/imports/encrypt/RDLStatement.g4 | 6 +++++-
.../parser/core/EncryptDistSQLStatementVisitor.java | 5 +++--
.../segment/distsql/rdl/EncryptRuleAssert.java | 1 +
.../segment/impl/distsql/rdl/ExpectedEncryptRule.java | 4 ++++
.../src/main/resources/case/rdl/alter.xml | 19 +++++++++++++++++--
.../src/main/resources/case/rdl/create.xml | 15 ++++++++++++++-
.../src/main/resources/sql/supported/rdl/alter.xml | 3 ++-
.../src/main/resources/sql/supported/rdl/create.xml | 3 ++-
11 files changed, 70 insertions(+), 16 deletions(-)
diff --git a/docs/document/content/user-manual/shardingsphere-proxy/usage/distsql/syntax/rdl/rdl-encrypt-rule.cn.md b/docs/document/content/user-manual/shardingsphere-proxy/usage/distsql/syntax/rdl/rdl-encrypt-rule.cn.md
index 69dd440..2229a14 100644
--- a/docs/document/content/user-manual/shardingsphere-proxy/usage/distsql/syntax/rdl/rdl-encrypt-rule.cn.md
+++ b/docs/document/content/user-manual/shardingsphere-proxy/usage/distsql/syntax/rdl/rdl-encrypt-rule.cn.md
@@ -13,7 +13,7 @@ ALTER ENCRYPT RULE encryptRuleDefinition [, encryptRuleDefinition] ...
DROP ENCRYPT RULE tableName [, tableName] ...
encryptRuleDefinition:
- tableName(COLUMNS(columnDefinition [, columnDefinition] ...))
+ tableName(COLUMNS(columnDefinition [, columnDefinition] ...), QUERY_WITH_CIPHER_COLUMN=queryWithCipherColumn)
columnDefinition:
(NAME=columnName [, PLAIN=plainColumnName] , CIPHER=cipherColumnName, encryptAlgorithm)
@@ -30,6 +30,7 @@ algorithmProperty:
- `PLAIN` 指定明文数据列,`CIPHER` 指定密文数据列
- `encryptAlgorithmType` 指定加密算法类型,请参考 [加密算法](/cn/user-manual/shardingsphere-jdbc/configuration/built-in-algorithm/encrypt/)
- 重复的 `tableName` 将无法被创建
+- `queryWithCipherColumn` 支持大写或小写的 true 或 false
## 示例
@@ -38,18 +39,18 @@ CREATE ENCRYPT RULE t_encrypt (
COLUMNS(
(NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,TYPE(NAME=AES,PROPERTIES('aes-key-value'='123456abc'))),
(NAME=order_id, CIPHER =order_cipher,TYPE(NAME=MD5))
-)),
+),QUERY_WITH_CIPHER_COLUMN=true),
t_encrypt_2 (
COLUMNS(
(NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,TYPE(NAME=AES,PROPERTIES('aes-key-value'='123456abc'))),
(NAME=order_id, CIPHER=order_cipher,TYPE(NAME=MD5))
-));
+), QUERY_WITH_CIPHER_COLUMN=FALSE);
ALTER ENCRYPT RULE t_encrypt (
COLUMNS(
(NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,TYPE(NAME=AES,PROPERTIES('aes-key-value'='123456abc'))),
(NAME=order_id,CIPHER=order_cipher,TYPE(NAME=MD5))
-));
+), QUERY_WITH_CIPHER_COLUMN=TRUE);
DROP ENCRYPT RULE t_encrypt,t_encrypt_2;
```
diff --git a/docs/document/content/user-manual/shardingsphere-proxy/usage/distsql/syntax/rdl/rdl-encrypt-rule.en.md b/docs/document/content/user-manual/shardingsphere-proxy/usage/distsql/syntax/rdl/rdl-encrypt-rule.en.md
index 7c2efe4..8e9403d 100644
--- a/docs/document/content/user-manual/shardingsphere-proxy/usage/distsql/syntax/rdl/rdl-encrypt-rule.en.md
+++ b/docs/document/content/user-manual/shardingsphere-proxy/usage/distsql/syntax/rdl/rdl-encrypt-rule.en.md
@@ -13,7 +13,7 @@ ALTER ENCRYPT RULE encryptRuleDefinition [, encryptRuleDefinition] ...
DROP ENCRYPT RULE tableName [, tableName] ...
encryptRuleDefinition:
- tableName(COLUMNS(columnDefinition [, columnDefinition] ...))
+ tableName(COLUMNS(columnDefinition [, columnDefinition] ...), QUERY_WITH_CIPHER_COLUMN=queryWithCipherColumn)
columnDefinition:
(NAME=columnName [, PLAIN=plainColumnName] , CIPHER=cipherColumnName, encryptAlgorithm)
@@ -30,6 +30,7 @@ algorithmProperty:
- `PLAIN` specifies the plain column, `CIPHER` specifies the cipher column
- `encryptAlgorithmType` specifies the encryption algorithm type, please refer to [Encryption Algorithm](/en/user-manual/shardingsphere-jdbc/configuration/built-in-algorithm/encrypt/)
- Duplicate `tableName` will not be created
+- `queryWithCipherColumn` support uppercase or lowercase true or false
## Example
@@ -38,18 +39,18 @@ CREATE ENCRYPT RULE t_encrypt (
COLUMNS(
(NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,TYPE(NAME=AES,PROPERTIES('aes-key-value'='123456abc'))),
(NAME=order_id, CIPHER =order_cipher,TYPE(NAME=MD5))
-)),
+), QUERY_WITH_CIPHER_COLUMN=true),
t_encrypt_2 (
COLUMNS(
(NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,TYPE(NAME=AES,PROPERTIES('aes-key-value'='123456abc'))),
(NAME=order_id, CIPHER=order_cipher,TYPE(NAME=MD5))
-));
+), QUERY_WITH_CIPHER_COLUMN=FALSE);
ALTER ENCRYPT RULE t_encrypt (
COLUMNS(
(NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,TYPE(NAME=AES,PROPERTIES('aes-key-value'='123456abc'))),
(NAME=order_id,CIPHER=order_cipher,TYPE(NAME=MD5))
-));
+), QUERY_WITH_CIPHER_COLUMN=TRUE);
DROP ENCRYPT RULE t_encrypt,t_encrypt_2;
```
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-parser/src/main/antlr4/imports/encrypt/Keyword.g4 b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-parser/src/main/antlr4/imports/encrypt/Keyword.g4
index 5fa98f0..093c65b 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-parser/src/main/antlr4/imports/encrypt/Keyword.g4
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-parser/src/main/antlr4/imports/encrypt/Keyword.g4
@@ -95,3 +95,15 @@ ASSISTED_QUERY_COLUMN
: A S S I S T E D UL_ Q U E R Y UL_ C O L U M N
;
+QUERY_WITH_CIPHER_COLUMN
+ : Q U E R Y UL_ W I T H UL_ C I P H E R UL_ C O L U M N
+ ;
+
+TRUE
+ : T R U E
+ ;
+
+FALSE
+ : F A L S E
+ ;
+
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-parser/src/main/antlr4/imports/encrypt/RDLStatement.g4 b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-parser/src/main/antlr4/imports/encrypt/RDLStatement.g4
index 21197a1..483e14d 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-parser/src/main/antlr4/imports/encrypt/RDLStatement.g4
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-parser/src/main/antlr4/imports/encrypt/RDLStatement.g4
@@ -32,7 +32,7 @@ dropEncryptRule
;
encryptRuleDefinition
- : tableName LP (RESOURCE EQ resourceName COMMA)? COLUMNS LP columnDefinition (COMMA columnDefinition)* RP RP
+ : tableName LP (RESOURCE EQ resourceName COMMA)? COLUMNS LP columnDefinition (COMMA columnDefinition)* RP (COMMA QUERY_WITH_CIPHER_COLUMN EQ queryWithCipherColumn)? RP
;
tableName
@@ -78,3 +78,7 @@ algorithmProperties
algorithmProperty
: key=(IDENTIFIER | STRING) EQ value=(NUMBER | INT | STRING)
;
+
+queryWithCipherColumn
+ : TRUE | FALSE
+ ;
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-parser/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/core/EncryptDistSQLStatementVisitor.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-parser/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/core/EncryptDistSQLStatementVisitor.java
index d55f211..5d51094 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-parser/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/core/EncryptDistSQLStatementVisitor.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-parser/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/core/EncryptDistSQLStatementVisitor.java
@@ -73,8 +73,9 @@ public final class EncryptDistSQLStatementVisitor extends EncryptDistSQLStatemen
@Override
public ASTNode visitEncryptRuleDefinition(final EncryptRuleDefinitionContext ctx) {
- // todo Support table level queryWithCipherColumn configuration
- return new EncryptRuleSegment(getIdentifierValue(ctx.tableName()), ctx.columnDefinition().stream().map(each -> (EncryptColumnSegment) visit(each)).collect(Collectors.toList()), null);
+ return new EncryptRuleSegment(getIdentifierValue(ctx.tableName()),
+ ctx.columnDefinition().stream().map(each -> (EncryptColumnSegment) visit(each)).collect(Collectors.toList()),
+ null == ctx.queryWithCipherColumn() ? null : Boolean.parseBoolean(getIdentifierValue(ctx.queryWithCipherColumn())));
}
@Override
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/segment/distsql/rdl/EncryptRuleAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/segment/distsql/rdl/EncryptRuleAssert.java
index f0fe67f..b713097 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/segment/distsql/rdl/EncryptRuleAssert.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/segment/distsql/rdl/EncryptRuleAssert.java
@@ -52,6 +52,7 @@ public final class EncryptRuleAssert {
} else {
assertNotNull(assertContext.getText("Actual encrypt rule should exist."), actual);
assertThat(assertContext.getText("encrypt rule assertion error: "), actual.getTableName(), is(expected.getName()));
+ assertThat(assertContext.getText("encrypt rule assertion error: "), actual.getQueryWithCipherColumn(), is(expected.getQueryWithCipherColumn()));
assertEncryptColumns(assertContext, actual.getColumns(), expected.getColumns());
}
}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/segment/impl/distsql/rdl/ExpectedEncryptRule.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/segment/impl/distsql/rdl/ExpectedEncryptRule.java
index e046c92..af9079e 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/segment/impl/distsql/rdl/ExpectedEncryptRule.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/segment/impl/distsql/rdl/ExpectedEncryptRule.java
@@ -21,6 +21,7 @@ import lombok.Getter;
import lombok.Setter;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.AbstractExpectedIdentifierSQLSegment;
+import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import java.util.List;
@@ -33,4 +34,7 @@ public final class ExpectedEncryptRule extends AbstractExpectedIdentifierSQLSegm
@XmlElement(name = "column")
private List<ExpectedEncryptColumn> columns;
+
+ @XmlAttribute
+ private Boolean queryWithCipherColumn;
}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/rdl/alter.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/rdl/alter.xml
index ae8ea07..7f53997 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/rdl/alter.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/rdl/alter.xml
@@ -152,7 +152,7 @@
</rule>
</alter-encrypt-rule>
- <alter-encrypt-rule sql-case-id="alter-encrypt-rule-with-assistedQueryColumn">
+ <alter-encrypt-rule sql-case-id="alter-encrypt-rule-with-assisted-query-column">
<rule name="t_encrypt">
<column name="user_id" plain-column="user_plain" cipher-column="user_cipher" assisted-query-column = "assisted_column">
<encryptor algorithm-name="AES">
@@ -166,7 +166,22 @@
</column>
</rule>
</alter-encrypt-rule>
-
+
+ <alter-encrypt-rule sql-case-id="alter-encrypt-rule-with-query-with-cipher-column">
+ <rule name="t_encrypt" queryWithCipherColumn="false">
+ <column name="user_id" plain-column="user_plain" cipher-column="user_cipher">
+ <encryptor algorithm-name="AES">
+ <properties>
+ <property key="aes-key-value" value="123456abc"/>
+ </properties>
+ </encryptor>
+ </column>
+ <column name="order_id" cipher-column="order_cipher">
+ <encryptor algorithm-name="MD5"/>
+ </column>
+ </rule>
+ </alter-encrypt-rule>
+
<alter-shadow-rule sql-case-id="alter-shadow-rule">
<rule name="rule" rule-name="shadow_rule" source="demo_ds" shadow="demo_ds_shadow">
<table-rule table-name="t_order">
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/rdl/create.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/rdl/create.xml
index 9ede90c..9391fdd 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/rdl/create.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/rdl/create.xml
@@ -227,7 +227,7 @@
</rule>
</create-encrypt-rule>
- <create-encrypt-rule sql-case-id="create-encrypt-rule-with-assisted_query_column">
+ <create-encrypt-rule sql-case-id="create-encrypt-rule-with-assisted-query-column">
<rule name="t_encrypt">
<column name="user_id" plain-column="user_plain" cipher-column="user_cipher" assisted-query-column = "assisted_column">
<encryptor algorithm-name="AES">
@@ -241,6 +241,19 @@
</column>
</rule>
</create-encrypt-rule>
+
+ <create-encrypt-rule sql-case-id="create-encrypt-rule-with-query-with-cipher-column">
+ <rule name="encrypt" queryWithCipherColumn="false">
+ <column name="user_id" plain-column="user_plain" cipher-column="user_cipher">
+ <encryptor algorithm-name="AES">
+ <properties>
+ <property key="aes-key-value" value="123456abc"/>
+ </properties>
+ </encryptor>
+ </column>
+ </rule>
+ </create-encrypt-rule>
+
<create-shadow-rule sql-case-id="create-shadow-rule">
<rule name="rule" rule-name="shadow_rule" source="demo_ds" shadow="demo_ds_shadow">
<table-rule table-name="t_order">
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/rdl/alter.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/rdl/alter.xml
index f305bfe..651f1f8 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/rdl/alter.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/rdl/alter.xml
@@ -33,7 +33,8 @@
<distsql-case id="alter-readwrite-splitting-rule" value="ALTER READWRITE_SPLITTING RULE ms_group_0 (AUTO_AWARE_RESOURCE=group_0, TYPE(NAME=random,PROPERTIES(read_weight='2:1'))), ms_group_1 (WRITE_RESOURCE=primary_ds, READ_RESOURCES(replica_ds_0,replica_ds_1),TYPE(NAME=random))" />
<distsql-case id="alter-database-discovery-rule" value="ALTER DB_DISCOVERY RULE ha_group_0 (RESOURCES(resource0,resource1), TYPE(NAME=mgr,PROPERTIES(groupName='92504d5b-6dec',keepAliveCron=''))),ha_group_1 (RESOURCES(resource2,resource3),TYPE(NAME=mgr2,PROPERTIES(groupName='92504d5b-6dec-2',keepAliveCron='')))" />
<distsql-case id="alter-encrypt-rule" value="ALTER ENCRYPT RULE t_encrypt (RESOURCE=ds_1, COLUMNS((NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,TYPE(NAME=AES,PROPERTIES('aes-key-value'='123456abc'))), (NAME=order_id, CIPHER =order_cipher,TYPE(NAME=MD5))))" />
- <distsql-case id="alter-encrypt-rule-with-assistedQueryColumn" value="ALTER ENCRYPT RULE t_encrypt (RESOURCE=ds_1, COLUMNS((NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,ASSISTED_QUERY_COLUMN=assisted_column, TYPE(NAME=AES,PROPERTIES('aes-key-value'='123456abc'))), (NAME=order_id, CIPHER =order_cipher,TYPE(NAME=MD5))))" />
+ <distsql-case id="alter-encrypt-rule-with-assisted-query-column" value="ALTER ENCRYPT RULE t_encrypt (RESOURCE=ds_1, COLUMNS((NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,ASSISTED_QUERY_COLUMN=assisted_column, TYPE(NAME=AES,PROPERTIES('aes-key-value'='123456abc'))), (NAME=order_id, CIPHER =order_cipher,TYPE(NAME=MD5))))" />
+ <distsql-case id="alter-encrypt-rule-with-query-with-cipher-column" value="ALTER ENCRYPT RULE t_encrypt (RESOURCE=ds_1, COLUMNS((NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher, TYPE(NAME=AES,PROPERTIES('aes-key-value'='123456abc'))), (NAME=order_id, CIPHER =order_cipher,TYPE(NAME=MD5))), QUERY_WITH_CIPHER_COLUMN=false)" />
<distsql-case id="alter-shadow-algorithm" value="ALTER SHADOW ALGORITHM (simple_note_algorithm, TYPE(NAME=SIMPLE_NOTE, PROPERTIES('shadow'='true', 'foo'='bar')))" />
<distsql-case id="alter-shadow-rule" value="ALTER SHADOW RULE shadow_rule(SOURCE=demo_ds,SHADOW=demo_ds_shadow,t_order((TYPE(NAME=COLUMN_REGEX_MATCH,PROPERTIES('operation'='insert','column'='user_id','regex'='[1]'))),(simple_note_algorithm,TYPE(NAME=SIMPLE_NOTE,PROPERTIES('shadow'='true',foo='bar')))))" />
</sql-cases>
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/rdl/create.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/rdl/create.xml
index 426179b..4af9db0 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/rdl/create.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/rdl/create.xml
@@ -34,7 +34,7 @@
<distsql-case id="create-dynamic-readwrite-splitting-rule" value="CREATE READWRITE_SPLITTING RULE ms_group_1(AUTO_AWARE_RESOURCE=group_0, TYPE(NAME=random,PROPERTIES(read_weight='2:1')))" />
<distsql-case id="create-database-discovery-rule" value="CREATE DB_DISCOVERY RULE ha_group_0 (RESOURCES(resource0,resource1), TYPE(NAME=mgr,PROPERTIES(groupName='92504d5b-6dec',keepAliveCron=''))), ha_group_1 (RESOURCES(resource2,resource3), TYPE(NAME=mgr2,PROPERTIES(groupName='92504d5b-6dec-2',keepAliveCron='')))" />
<distsql-case id="create-encrypt-rule" value="CREATE ENCRYPT RULE t_encrypt (RESOURCE=ds_1, COLUMNS((NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,TYPE(NAME=AES,PROPERTIES('aes-key-value'='123456abc'))), (NAME=order_id, CIPHER =order_cipher,TYPE(NAME=MD5))))" />
- <distsql-case id="create-encrypt-rule-with-assisted_query_column" value="CREATE ENCRYPT RULE t_encrypt (RESOURCE=ds_1, COLUMNS((NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,ASSISTED_QUERY_COLUMN=assisted_column, TYPE(NAME=AES,PROPERTIES('aes-key-value'='123456abc'))), (NAME=order_id, CIPHER =order_cipher,TYPE(NAME=MD5))))" />
+ <distsql-case id="create-encrypt-rule-with-assisted-query-column" value="CREATE ENCRYPT RULE t_encrypt (RESOURCE=ds_1, COLUMNS((NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,ASSISTED_QUERY_COLUMN=assisted_column, TYPE(NAME=AES,PROPERTIES('aes-key-value'='123456abc'))), (NAME=order_id, CIPHER =order_cipher,TYPE(NAME=MD5))))" />
<distsql-case id="create-shadow-rule" value="CREATE SHADOW RULE shadow_rule(SOURCE=demo_ds,SHADOW=demo_ds_shadow,t_order((TYPE(NAME=COLUMN_REGEX_MATCH,PROPERTIES('operation'='insert','column'='user_id','regex'='[1]'))),(simple_note_algorithm,TYPE(NAME=SIMPLE_NOTE,PROPERTIES('shadow'='true',foo='bar')))))" />
<distsql-case id="create-sharding-algorithm" value="CREATE SHARDING ALGORITHM algorithm_name(TYPE(NAME=hash_mod,PROPERTIES('algorithm-expression' = 't_order_${order_id % 2}')))" />
<distsql-case id="create-default-sharding-strategy" value="CREATE DEFAULT SHARDING TABLE STRATEGY(TYPE=standard, SHARDING_COLUMN=order_id, SHARDING_ALGORITHM=algorithms_name)" />
@@ -46,5 +46,6 @@
<distsql-case id="create-readwrite-splitting-rule-with-quota" value="CREATE READWRITE_SPLITTING RULE `ms_group_0` (WRITE_RESOURCE=primary_ds, READ_RESOURCES(replica_ds_0,replica_ds_1), TYPE(NAME=random)))" />
<distsql-case id="create-database-discovery-rule-with-quota" value="CREATE DB_DISCOVERY RULE `ha_group_0` (RESOURCES(resource0,resource1), TYPE(NAME=mgr,PROPERTIES(groupName='92504d5b-6dec',keepAliveCron=''))), ha_group_1 (RESOURCES(resource2,resource3), TYPE(NAME=mgr2,PROPERTIES(groupName='92504d5b-6dec-2',keepAliveCron='')))" />
<distsql-case id="create-encrypt-rule-with-quota" value="CREATE ENCRYPT RULE `encrypt` (RESOURCE=ds_1, COLUMNS((NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,TYPE(NAME=AES,PROPERTIES('aes-key-value'='123456abc'))), (NAME=order_id, CIPHER =order_cipher,TYPE(NAME=MD5))))" />
+ <distsql-case id="create-encrypt-rule-with-query-with-cipher-column" value="CREATE ENCRYPT RULE `encrypt` (RESOURCE=ds_1, COLUMNS((NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,TYPE(NAME=AES,PROPERTIES('aes-key-value'='123456abc')))),QUERY_WITH_CIPHER_COLUMN=false)" />
<distsql-case id="create-shadow-rule-with-quota" value="CREATE SHADOW RULE `shadow_rule`(SOURCE=demo_ds,SHADOW=demo_ds_shadow,t_order((TYPE(NAME=COLUMN_REGEX_MATCH,PROPERTIES('operation'='insert','column'='user_id','regex'='[1]'))),(simple_note_algorithm,TYPE(NAME=SIMPLE_NOTE,PROPERTIES('shadow'='true',foo='bar')))))" />
</sql-cases>