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 2023/05/05 03:21:56 UTC
[shardingsphere] branch master updated: Remove different level queryWithCipherColumn config in encrypt feature (#25448)
This is an automated email from the ASF dual-hosted git repository.
zhaojinchao 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 d6081fbf675 Remove different level queryWithCipherColumn config in encrypt feature (#25448)
d6081fbf675 is described below
commit d6081fbf6752c2ab649fbd6640b24c0fe4170c24
Author: Zhengqiang Duan <du...@apache.org>
AuthorDate: Fri May 5 11:21:46 2023 +0800
Remove different level queryWithCipherColumn config in encrypt feature (#25448)
* Remove different level queryWithCipherColumn config in encrypt feature
* fix unit test
* fix unit test
* fix encrypt sql rewrite it
* fix unit test
* fix unit test
* Remove queryWithCipherColumn in DistSQL and document
---
.../content/reference/encrypt/_index.cn.md | 3 -
.../content/reference/encrypt/_index.en.md | 3 -
.../java-api/rules/encrypt.cn.md | 3 -
.../java-api/rules/encrypt.en.md | 3 -
.../yaml-config/rules/encrypt.cn.md | 4 -
.../yaml-config/rules/encrypt.en.md | 6 +-
.../yaml-config/rules/mix.cn.md | 2 -
.../yaml-config/rules/mix.en.md | 4 +-
.../encrypt/alter-encrypt-rule.cn.md | 6 +-
.../encrypt/alter-encrypt-rule.en.md | 6 +-
.../encrypt/create-encrypt-rule.cn.md | 12 +-
.../encrypt/create-encrypt-rule.en.md | 12 +-
.../distsql/syntax/reserved-word.cn.md | 2 +-
.../distsql/syntax/reserved-word.en.md | 2 +-
.../rql/rule-query/encrypt/show-encrypt-rule.cn.md | 45 ++++----
.../rql/rule-query/encrypt/show-encrypt-rule.en.md | 45 ++++----
.../api/config/EncryptRuleConfiguration.java | 13 +--
.../rule/EncryptColumnRuleConfiguration.java | 6 +-
.../config/rule/EncryptTableRuleConfiguration.java | 2 -
.../merge/dql/EncryptAlgorithmMetaData.java | 15 +--
.../encrypt/merge/dql/EncryptMergedResult.java | 4 +-
.../EncryptPredicateParameterRewriter.java | 7 +-
.../EncryptIndexColumnTokenGenerator.java | 15 +--
.../EncryptOrderByItemTokenGenerator.java | 10 +-
.../EncryptPredicateColumnTokenGenerator.java | 6 -
.../EncryptPredicateRightValueTokenGenerator.java | 26 +----
.../generator/EncryptProjectionTokenGenerator.java | 13 +--
.../shardingsphere/encrypt/rule/EncryptColumn.java | 7 +-
.../shardingsphere/encrypt/rule/EncryptRule.java | 16 +--
.../shardingsphere/encrypt/rule/EncryptTable.java | 15 +--
.../yaml/config/YamlEncryptRuleConfiguration.java | 2 -
.../rule/YamlEncryptColumnRuleConfiguration.java | 2 -
.../rule/YamlEncryptTableRuleConfiguration.java | 2 -
.../YamlEncryptRuleConfigurationSwapper.java | 5 +-
.../YamlEncryptColumnRuleConfigurationSwapper.java | 3 +-
.../YamlEncryptTableRuleConfigurationSwapper.java | 3 +-
.../EncryptRuleConfigurationCheckerTest.java | 16 +--
...atedEncryptShowCreateTableMergedResultTest.java | 16 +--
...rgedEncryptShowCreateTableMergedResultTest.java | 10 +-
.../merge/dql/EncryptAlgorithmMetaDataTest.java | 11 +-
.../encrypt/merge/dql/EncryptMergedResultTest.java | 38 +------
.../impl/EncryptAlterTableTokenGeneratorTest.java | 6 +-
.../impl/EncryptCreateTableTokenGeneratorTest.java | 4 +-
.../impl/EncryptProjectionTokenGeneratorTest.java | 2 +-
.../EncryptPredicateColumnTokenGeneratorTest.java | 2 +-
...cryptPredicateRightValueTokenGeneratorTest.java | 2 +-
.../fixture/EncryptGeneratorFixtureBuilder.java | 4 +-
.../encrypt/rule/EncryptColumnTest.java | 6 +-
.../encrypt/rule/EncryptRuleTest.java | 16 +--
.../encrypt/rule/EncryptTableTest.java | 20 +---
.../yaml/EncryptRuleConfigurationYamlIT.java | 6 -
.../YamlEncryptRuleConfigurationSwapperTest.java | 2 +-
...lEncryptColumnRuleConfigurationSwapperTest.java | 5 +-
...mlEncryptTableRuleConfigurationSwapperTest.java | 19 +---
.../core/src/test/resources/yaml/encrypt-rule.yaml | 1 -
.../converter/EncryptRuleStatementConverter.java | 4 +-
.../handler/query/ShowEncryptRuleExecutor.java | 20 +---
.../EncryptRuleStatementConverterTest.java | 4 +-
.../handler/query/ShowEncryptRuleExecutorTest.java | 8 +-
.../AlterEncryptRuleStatementUpdaterTest.java | 18 +--
.../CreateEncryptRuleStatementUpdaterTest.java | 28 ++---
.../DropEncryptRuleStatementUpdaterTest.java | 12 +-
.../src/main/antlr4/imports/encrypt/Keyword.g4 | 4 -
.../main/antlr4/imports/encrypt/RDLStatement.g4 | 8 +-
.../core/EncryptDistSQLStatementVisitor.java | 6 +-
.../parser/segment/EncryptColumnSegment.java | 2 -
.../distsql/parser/segment/EncryptRuleSegment.java | 2 -
.../common/constant/DistSQLScriptConstants.java | 3 +-
.../ConvertYamlConfigurationExecutor.java | 3 +-
.../rule/ShowRulesUsedStorageUnitExecutorTest.java | 2 +-
.../test/resources/expected/convert-encrypt.yaml | 2 +-
.../src/test/resources/expected/convert-mix.yaml | 2 +-
.../test/e2e/driver/AbstractEncryptDriverTest.java | 18 +--
.../e2e/driver/statement/EncryptStatementTest.java | 15 ---
.../config/config-encrypt-query-with-plain.yaml | 54 ---------
.../resources/env/common/migration-command.xml | 3 +-
.../dataset/rdl_empty_rules/alter_encrypt_rule.xml | 3 +-
.../rdl_empty_rules/create_encrypt_rule.xml | 3 +-
.../dataset/rdl_empty_rules/drop_encrypt_rule.xml | 1 -
.../resources/cases/rdl/rdl-integration-alter.xml | 4 +-
.../resources/cases/rdl/rdl-integration-create.xml | 2 +-
.../resources/cases/rdl/rdl-integration-drop.xml | 2 +-
.../show_encrypt_rule.xml | 3 +-
.../show_encrypt_rules.xml | 11 +-
.../rql/dataset/encrypt/show_encrypt_rule.xml | 9 +-
.../rql/dataset/encrypt/show_encrypt_rules.xml | 17 ++-
.../show_encrypt_rule.xml | 3 +-
.../show_encrypt_rules.xml | 15 ++-
.../sharding_and_encrypt/show_encrypt_rule.xml | 3 +-
.../sharding_and_encrypt/show_encrypt_rules.xml | 15 ++-
.../segment/distsql/rdl/EncryptRuleAssert.java | 3 +-
.../impl/distsql/rdl/ExpectedEncryptRule.java | 4 -
.../src/main/resources/sql/supported/rdl/alter.xml | 2 +-
.../main/resources/sql/supported/rdl/create.xml | 2 +-
.../query-with-cipher/dml/select/select-where.xml | 15 ---
.../query-with-plain/ddl/alter/alter-table.xml | 79 -------------
.../query-with-plain/ddl/create/create-index.xml | 29 -----
.../query-with-plain/ddl/create/create-table.xml | 29 -----
.../case/query-with-plain/dml/delete/delete.xml | 50 ---------
.../query-with-plain/dml/insert/insert-column.xml | 124 --------------------
.../dml/insert/insert-on-duplicate.xml | 64 -----------
.../query-with-plain/dml/insert/insert-set.xml | 59 ----------
.../dml/select/select-group-by.xml | 51 ---------
.../query-with-plain/dml/select/select-join.xml | 41 -------
.../dml/select/select-order-by.xml | 40 -------
.../dml/select/select-projection.xml | 64 -----------
.../dml/select/select-subquery.xml | 125 ---------------------
.../query-with-plain/dml/select/select-where.xml | 92 ---------------
.../case/query-with-plain/dml/update/update.xml | 81 -------------
.../scenario/encrypt/config/query-with-cipher.yaml | 1 -
.../scenario/encrypt/config/query-with-plain.yaml | 108 ------------------
.../case/query-with-plain/dml/delete/delete.xml | 29 -----
.../dml/select/select-projection.xml | 49 --------
.../query-with-plain/dml/select/select-where.xml | 29 -----
.../case/query-with-plain/dml/update/update.xml | 29 -----
.../scenario/mix/config/query-with-plain.yaml | 99 ----------------
116 files changed, 239 insertions(+), 1884 deletions(-)
diff --git a/docs/document/content/reference/encrypt/_index.cn.md b/docs/document/content/reference/encrypt/_index.cn.md
index 566d58f0e4c..8209e488c21 100644
--- a/docs/document/content/reference/encrypt/_index.cn.md
+++ b/docs/document/content/reference/encrypt/_index.cn.md
@@ -86,7 +86,6 @@ Apache ShardingSphere 接收到该 SQL,通过用户提供的加密配置,发
encryptorName: aes_encryptor
assistedQueryColumn: pwd_assisted_query
assistedQueryEncryptorName: pwd_assisted_query_cipher
- queryWithCipherColumn: true
```
使用这套配置, Apache ShardingSphere 只需将 logicColumn 和 cipherColumn,assistedQueryColumn 进行转换,底层数据表不存储明文,只存储了密文,这也是安全审计部分的要求所在。
@@ -130,7 +129,6 @@ Apache ShardingSphere 接收到该 SQL,通过用户提供的加密配置,发
encryptorName: aes_encryptor
assistedQueryColumn: pwd_assisted_query
assistedQueryEncryptorName: pwd_assisted_query_cipher
- queryWithCipherColumn: false
```
依据上述加密规则可知,首先需要在数据库表 `t_user` 里新增一个字段叫做 `pwd_cipher`,即 cipherColumn,用于存放密文数据,同时我们把 plainColumn 设置为 `pwd`,用于存放明文数据,而把 logicColumn 也设置为 `pwd`。
@@ -185,7 +183,6 @@ Apache ShardingSphere 接收到该 SQL,通过用户提供的加密配置,发
encryptorName: aes_encryptor
assistedQueryColumn: pwd_assisted_query
assistedQueryEncryptorName: pwd_assisted_query_cipher
- queryWithCipherColumn: true
```
其处理流程如下:
diff --git a/docs/document/content/reference/encrypt/_index.en.md b/docs/document/content/reference/encrypt/_index.en.md
index afd6cb39935..d763f1f6bcb 100644
--- a/docs/document/content/reference/encrypt/_index.en.md
+++ b/docs/document/content/reference/encrypt/_index.en.md
@@ -75,7 +75,6 @@ Solution description: after selecting the appropriate encryption algorithm, such
encryptorName: aes_encryptor
assistedQueryColumn: pwd_assisted_query
assistedQueryEncryptorName: pwd_assisted_query_cipher
- queryWithCipherColumn: true
```
With the above configuration, Apache ShardingSphere only needs to convert `logicColumn`, `cipherColumn`, and `assistedQueryColumn`.
@@ -120,7 +119,6 @@ Assuming that the system needs to encrypt the `pwd` field of `t_user`, the busin
encryptorName: aes_encryptor
assistedQueryColumn: pwd_assisted_query
assistedQueryEncryptorName: pwd_assisted_query_cipher
- queryWithCipherColumn: false
```
According to the above encryption rules, we need to add a field called `pwd_cipher`, namely `cipherColumn`, in the `t_user` table, which is used to store ciphertext data.
@@ -178,7 +176,6 @@ The existence of the `logicColumn` means that users write SQL for this virtual c
encryptorName: aes_encryptor
assistedQueryColumn: pwd_assisted_query
assistedQueryEncryptorName: pwd_assisted_query_cipher
- queryWithCipherColumn: true
```
The processing flow is as follows:
diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/java-api/rules/encrypt.cn.md b/docs/document/content/user-manual/shardingsphere-jdbc/java-api/rules/encrypt.cn.md
index f822520d228..3e5fb9944da 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/java-api/rules/encrypt.cn.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/java-api/rules/encrypt.cn.md
@@ -19,7 +19,6 @@ weight = 4
|---------------------------|---------------------------------------------|-----------------------------------|-------|
| tables (+) | Collection\<EncryptTableRuleConfiguration\> | 加密表规则配置 | |
| encryptors (+) | Map\<String, AlgorithmConfiguration\> | 加解密算法名称和配置 | |
-| queryWithCipherColumn (?) | boolean | 是否使用加密列进行查询。在有原文列的情况下,可以使用原文列进行查询 | true |
### 加密表规则配置
@@ -31,7 +30,6 @@ weight = 4
|---------------------------|----------------------------------------------|---------------|
| name | String | 表名称 |
| columns (+) | Collection\<EncryptColumnRuleConfiguration\> | 加密列规则配置列表 |
-| queryWithCipherColumn (?) | boolean | 该表是否使用加密列进行查询 |
### 加密列规则配置
@@ -49,7 +47,6 @@ weight = 4
| encryptorName | String | 密文列加密算法名称 |
| assistedQueryEncryptorName | String | 查询辅助列加密算法名称 |
| likeQueryEncryptorName | String | 模糊查询列加密算法名称 |
-| queryWithCipherColumn (?) | boolean | 该列是否使用加密列进行查询 |
### 加解密算法配置
diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/java-api/rules/encrypt.en.md b/docs/document/content/user-manual/shardingsphere-jdbc/java-api/rules/encrypt.en.md
index 69719a13d02..6e2e940266f 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/java-api/rules/encrypt.en.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/java-api/rules/encrypt.en.md
@@ -19,7 +19,6 @@ Attributes:
|---------------------------|---------------------------------------------|------------------------------------------------------------------------------------------------|-----------------|
| tables (+) | Collection\<EncryptTableRuleConfiguration\> | Encrypt table rule configurations | |
| encryptors (+) | Map\<String, AlgorithmConfiguration\> | Encrypt algorithm name and configurations | |
-| queryWithCipherColumn (?) | boolean | Whether query with cipher column for data encrypt. User you can use plaintext to query if have | true |
### Encrypt Table Rule Configuration
@@ -31,7 +30,6 @@ Attributes:
|---------------------------|----------------------------------------------|---------------------------------------------------------------------|
| name | String | Table name |
| columns (+) | Collection\<EncryptColumnRuleConfiguration\> | Encrypt column rule configurations |
-| queryWithCipherColumn (?) | boolean | The current table whether query with cipher column for data encrypt |
### Encrypt Column Rule Configuration
@@ -49,7 +47,6 @@ Attributes:
| encryptorName | String | Encrypt algorithm name |
| assistedQueryEncryptorName | String | Assisted query encrypt algorithm name |
| likeQueryEncryptorName | String | Like query encrypt algorithm name |
-| queryWithCipherColumn (?) | boolean | The current column whether query with cipher column for data encrypt |
### Encrypt Algorithm Configuration
diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/encrypt.cn.md b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/encrypt.cn.md
index f6c0153c89d..91131dec670 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/encrypt.cn.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/encrypt.cn.md
@@ -23,7 +23,6 @@ rules:
assistedQueryEncryptorName: # 查询辅助列加密算法名称
likeQueryColumn (?): # 模糊查询列名称
likeQueryEncryptorName: # 模糊查询列加密算法名称
- queryWithCipherColumn(?): # 该表是否使用加密列进行查询
# 加密算法配置
encryptors:
@@ -31,8 +30,6 @@ rules:
type: # 加解密算法类型
props: # 加解密算法属性配置
# ...
-
- queryWithCipherColumn: # 是否使用加密列进行查询。在有原文列的情况下,可以使用原文列进行查询
```
算法类型的详情,请参见[内置加密算法列表](/cn/user-manual/common-config/builtin-algorithm/encrypt)。
@@ -73,7 +70,6 @@ rules:
encryptorName: pwd_encryptor
assistedQueryColumn: assisted_query_pwd
assistedQueryEncryptorName: assisted_encryptor
- queryWithCipherColumn: true
encryptors:
name_encryptor:
type: AES
diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/encrypt.en.md b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/encrypt.en.md
index 53a522a4b7c..b1acb7ff0d2 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/encrypt.en.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/encrypt.en.md
@@ -23,8 +23,7 @@ rules:
assistedQueryColumn (?): # Assisted query column name
assistedQueryEncryptorName: # Assisted query encrypt algorithm name
likeQueryColumn (?): # Like query column name
- likeQueryEncryptorName: # Like query encrypt algorithm name
- queryWithCipherColumn(?): # The current table whether query with cipher column for data encrypt.
+ likeQueryEncryptorName: # Like query encrypt algorithm name
# Encrypt algorithm configuration
encryptors:
@@ -32,8 +31,6 @@ rules:
type: # Encrypt algorithm type
props: # Encrypt algorithm properties
# ...
-
- queryWithCipherColumn: # Whether query with cipher column for data encrypt. User you can use plaintext to query if have
```
Please refer to [Built-in Encrypt Algorithm List](/en/user-manual/common-config/builtin-algorithm/encrypt) for more details about type of algorithm.
@@ -74,7 +71,6 @@ rules:
encryptorName: pwd_encryptor
assistedQueryColumn: assisted_query_pwd
assistedQueryEncryptorName: assisted_encryptor
- queryWithCipherColumn: true
encryptors:
name_encryptor:
type: AES
diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/mix.cn.md b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/mix.cn.md
index fa5ee66567d..65e890a054d 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/mix.cn.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/mix.cn.md
@@ -57,7 +57,6 @@ rules:
assistedQueryEncryptorName: # 查询辅助列加密算法名称
likeQueryColumn (?): # 模糊查询列名称
likeQueryEncryptorName: # 模糊查询列加密算法名称
- queryWithCipherColumn(?): # 该表是否使用加密列进行查询
```
## 配置示例
@@ -120,5 +119,4 @@ rules:
order_id:
cipherColumn: order_cipher
encryptorName: md5_encryptor
- queryWithCipherColumn: true
```
diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/mix.en.md b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/mix.en.md
index 2b74f776cd9..ffe02ab278a 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/mix.en.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/mix.en.md
@@ -57,8 +57,7 @@ rules:
assistedQueryColumn (?): # Assisted query column name
assistedQueryEncryptorName: # Assisted query encrypt algorithm name
likeQueryColumn (?): # Like query column name
- likeQueryEncryptorName: # Like query encrypt algorithm name
- queryWithCipherColumn(?): # The current table whether query with cipher column for data encrypt.
+ likeQueryEncryptorName: # Like query encrypt algorithm name
```
## Samples
@@ -121,5 +120,4 @@ rules:
order_id:
cipherColumn: order_cipher
encryptorName: md5_encryptor
- queryWithCipherColumn: true
```
diff --git a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/encrypt/alter-encrypt-rule.cn.md b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/encrypt/alter-encrypt-rule.cn.md
index d3018fb1fdc..597f88945d2 100644
--- a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/encrypt/alter-encrypt-rule.cn.md
+++ b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/encrypt/alter-encrypt-rule.cn.md
@@ -16,7 +16,7 @@ AlterEncryptRule ::=
'ALTER' 'ENCRYPT' 'RULE' encryptDefinition (',' encryptDefinition)*
encryptDefinition ::=
- ruleName '(' 'COLUMNS' '(' columnDefinition (',' columnDefinition)* ')' (',' 'QUERY_WITH_CIPHER_COLUMN' '=' ('TRUE' | 'FALSE'))? ')'
+ ruleName '(' 'COLUMNS' '(' columnDefinition (',' columnDefinition)* ')' ')'
columnDefinition ::=
'(' 'NAME' '=' columnName (',' 'PLAIN' '=' plainColumnName)? ',' 'CIPHER' '=' cipherColumnName (',' 'ASSISTED_QUERY_COLUMN' '=' assistedQueryColumnName)? (',' 'LIKE_QUERY_COLUMN' '=' likeQueryColumnName)? ',' encryptAlgorithmDefinition (',' assistedQueryAlgorithmDefinition)? (',' likeQueryAlgorithmDefinition)? ')'
@@ -81,12 +81,12 @@ ALTER ENCRYPT RULE t_encrypt (
COLUMNS(
(NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc')))),
(NAME=order_id,CIPHER=order_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='MD5')))
-), QUERY_WITH_CIPHER_COLUMN=TRUE);
+));
```
### 保留字
-`ALTER`、`ENCRYPT`、`RULE`、`COLUMNS`、`NAME`、`CIPHER`、`PLAIN`、`ENCRYPT_ALGORITHM`、`QUERY_WITH_CIPHER_COLUMN`、`TYPE`、`TRUE`、`FALSE`
+`ALTER`、`ENCRYPT`、`RULE`、`COLUMNS`、`NAME`、`CIPHER`、`PLAIN`、`ENCRYPT_ALGORITHM`、`TYPE`、`TRUE`、`FALSE`
### 相关链接
diff --git a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/encrypt/alter-encrypt-rule.en.md b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/encrypt/alter-encrypt-rule.en.md
index fb8ef0b276c..c5d9c79e128 100644
--- a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/encrypt/alter-encrypt-rule.en.md
+++ b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/encrypt/alter-encrypt-rule.en.md
@@ -16,7 +16,7 @@ AlterEncryptRule ::=
'ALTER' 'ENCRYPT' 'RULE' encryptDefinition (',' encryptDefinition)*
encryptDefinition ::=
- ruleName '(' 'COLUMNS' '(' columnDefinition (',' columnDefinition)* ')' (',' 'QUERY_WITH_CIPHER_COLUMN' '=' ('TRUE' | 'FALSE'))? ')'
+ ruleName '(' 'COLUMNS' '(' columnDefinition (',' columnDefinition)* ')' ')'
columnDefinition ::=
'(' 'NAME' '=' columnName (',' 'PLAIN' '=' plainColumnName)? ',' 'CIPHER' '=' cipherColumnName (',' 'ASSISTED_QUERY_COLUMN' '=' assistedQueryColumnName)? (',' 'LIKE_QUERY_COLUMN' '=' likeQueryColumnName)? ',' encryptAlgorithmDefinition (',' assistedQueryAlgorithmDefinition)? (',' likeQueryAlgorithmDefinition)? ')'
@@ -80,12 +80,12 @@ ALTER ENCRYPT RULE t_encrypt (
COLUMNS(
(NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc')))),
(NAME=order_id,CIPHER=order_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='MD5')))
-), QUERY_WITH_CIPHER_COLUMN=TRUE);
+));
```
### Reserved words
-`ALTER`, `ENCRYPT`, `RULE`, `COLUMNS`, `NAME`, `CIPHER`, `PLAIN`, `ENCRYPT_ALGORITHM`, `QUERY_WITH_CIPHER_COLUMN`, `TYPE`, `TRUE`, `FALSE`
+`ALTER`, `ENCRYPT`, `RULE`, `COLUMNS`, `NAME`, `CIPHER`, `PLAIN`, `ENCRYPT_ALGORITHM`, `TYPE`, `TRUE`, `FALSE`
### Related links
diff --git a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/encrypt/create-encrypt-rule.cn.md b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/encrypt/create-encrypt-rule.cn.md
index cded9fbcc79..0334d692d0a 100644
--- a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/encrypt/create-encrypt-rule.cn.md
+++ b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/encrypt/create-encrypt-rule.cn.md
@@ -19,7 +19,7 @@ ifNotExists ::=
'IF' 'NOT' 'EXISTS'
encryptDefinition ::=
- ruleName '(' 'COLUMNS' '(' columnDefinition (',' columnDefinition)* ')' (',' 'QUERY_WITH_CIPHER_COLUMN' '=' ('TRUE' | 'FALSE'))? ')'
+ ruleName '(' 'COLUMNS' '(' columnDefinition (',' columnDefinition)* ')' ')'
columnDefinition ::=
'(' 'NAME' '=' columnName (',' 'PLAIN' '=' plainColumnName)? ',' 'CIPHER' '=' cipherColumnName (',' 'ASSISTED_QUERY_COLUMN' '=' assistedQueryColumnName)? (',' 'LIKE_QUERY_COLUMN' '=' likeQueryColumnName)? ',' encryptAlgorithmDefinition (',' assistedQueryAlgorithmDefinition)? (',' likeQueryAlgorithmDefinition)? ')'
@@ -85,12 +85,12 @@ CREATE ENCRYPT RULE t_encrypt (
COLUMNS(
(NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc')))),
(NAME=order_id, CIPHER =order_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='MD5')))
-),QUERY_WITH_CIPHER_COLUMN=true),
+)),
t_encrypt_2 (
COLUMNS(
(NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc')))),
(NAME=order_id, CIPHER=order_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='MD5')))
-), QUERY_WITH_CIPHER_COLUMN=FALSE);
+));
```
#### 使用 `ifNotExists` 子句创建数据加密规则
@@ -100,17 +100,17 @@ CREATE ENCRYPT RULE IF NOT EXISTS t_encrypt (
COLUMNS(
(NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc')))),
(NAME=order_id, CIPHER =order_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='MD5')))
-),QUERY_WITH_CIPHER_COLUMN=true),
+)),
t_encrypt_2 (
COLUMNS(
(NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc')))),
(NAME=order_id, CIPHER=order_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='MD5')))
-), QUERY_WITH_CIPHER_COLUMN=FALSE);
+));
```
### 保留字
-`CREATE`、`ENCRYPT`、`RULE`、`COLUMNS`、`NAME`、`CIPHER`、`PLAIN`、`ENCRYPT_ALGORITHM`、`QUERY_WITH_CIPHER_COLUMN`、`TYPE`、`TRUE`、`FALSE`
+`CREATE`、`ENCRYPT`、`RULE`、`COLUMNS`、`NAME`、`CIPHER`、`PLAIN`、`ENCRYPT_ALGORITHM`、`TYPE`、`TRUE`、`FALSE`
### 相关链接
diff --git a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/encrypt/create-encrypt-rule.en.md b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/encrypt/create-encrypt-rule.en.md
index b7895a190dc..7991757e0c1 100644
--- a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/encrypt/create-encrypt-rule.en.md
+++ b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/encrypt/create-encrypt-rule.en.md
@@ -19,7 +19,7 @@ ifNotExists ::=
'IF' 'NOT' 'EXISTS'
encryptDefinition ::=
- ruleName '(' 'COLUMNS' '(' columnDefinition (',' columnDefinition)* ')' (',' 'QUERY_WITH_CIPHER_COLUMN' '=' ('TRUE' | 'FALSE'))? ')'
+ ruleName '(' 'COLUMNS' '(' columnDefinition (',' columnDefinition)* ')' ')'
columnDefinition ::=
'(' 'NAME' '=' columnName (',' 'PLAIN' '=' plainColumnName)? ',' 'CIPHER' '=' cipherColumnName (',' 'ASSISTED_QUERY_COLUMN' '=' assistedQueryColumnName)? (',' 'LIKE_QUERY_COLUMN' '=' likeQueryColumnName)? ',' encryptAlgorithmDefinition (',' assistedQueryAlgorithmDefinition)? (',' likeQueryAlgorithmDefinition)? ')'
@@ -85,12 +85,12 @@ CREATE ENCRYPT RULE t_encrypt (
COLUMNS(
(NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc')))),
(NAME=order_id, CIPHER =order_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='MD5')))
-),QUERY_WITH_CIPHER_COLUMN=true),
+)),
t_encrypt_2 (
COLUMNS(
(NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc')))),
(NAME=order_id, CIPHER=order_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='MD5')))
-), QUERY_WITH_CIPHER_COLUMN=FALSE);
+));
```
#### Create a encrypt rule with `ifNotExists` clause
@@ -100,17 +100,17 @@ CREATE ENCRYPT RULE t_encrypt IF NOT EXISTS (
COLUMNS(
(NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc')))),
(NAME=order_id, CIPHER =order_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='MD5')))
-),QUERY_WITH_CIPHER_COLUMN=true),
+)),
t_encrypt_2 (
COLUMNS(
(NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc')))),
(NAME=order_id, CIPHER=order_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='MD5')))
-), QUERY_WITH_CIPHER_COLUMN=FALSE);
+));
```
### Reserved words
-`CREATE`, `ENCRYPT`, `RULE`, `COLUMNS`, `NAME`, `CIPHER`, `PLAIN`, `ENCRYPT_ALGORITHM`, `QUERY_WITH_CIPHER_COLUMN`, `TYPE`, `TRUE`, `FALSE`
+`CREATE`, `ENCRYPT`, `RULE`, `COLUMNS`, `NAME`, `CIPHER`, `PLAIN`, `ENCRYPT_ALGORITHM`, `TYPE`, `TRUE`, `FALSE`
### Related links
diff --git a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/reserved-word.cn.md b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/reserved-word.cn.md
index d5f94228169..e85a91420c7 100644
--- a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/reserved-word.cn.md
+++ b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/reserved-word.cn.md
@@ -33,7 +33,7 @@ weight = 5
#### 数据加密
-`ENCRYPT`、`COLUMNS`、`CIPHER`、`PLAIN`、`ENCRYPT_ALGORITHM`、`QUERY_WITH_CIPHER_COLUMN`
+`ENCRYPT`、`COLUMNS`、`CIPHER`、`PLAIN`、`ENCRYPT_ALGORITHM`
#### 数据库发现
diff --git a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/reserved-word.en.md b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/reserved-word.en.md
index f287b6e8ef8..8f061bcb908 100644
--- a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/reserved-word.en.md
+++ b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/reserved-word.en.md
@@ -34,7 +34,7 @@ weight = 5
#### Encrypt
-`ENCRYPT`, `COLUMNS`, `CIPHER`, `PLAIN`, `ENCRYPT_ALGORITHM`, `QUERY_WITH_CIPHER_COLUMN`
+`ENCRYPT`, `COLUMNS`, `CIPHER`, `PLAIN`, `ENCRYPT_ALGORITHM`
#### Database Discovery
diff --git a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/encrypt/show-encrypt-rule.cn.md b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/encrypt/show-encrypt-rule.cn.md
index 5abc2bb4b2b..1776a66676b 100644
--- a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/encrypt/show-encrypt-rule.cn.md
+++ b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/encrypt/show-encrypt-rule.cn.md
@@ -47,7 +47,6 @@ databaseName ::=
| assisted_query_props | 辅助查询算法参数 |
| like_query_type | 模糊查询算法类型 |
| like_query_props | 模糊查询算法参数 |
-| query_with_cipher_column | 是否使用加密列进行查询 |
### 示例
@@ -59,12 +58,12 @@ SHOW ENCRYPT RULES FROM encrypt_db;
```sql
mysql> SHOW ENCRYPT RULES FROM encrypt_db;
-+-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+--------------------------+
-| table | logic_column | cipher_column | plain_column | assisted_query_column | like_query_column | encryptor_type | encryptor_props | assisted_query_type | assisted_query_props | like_query_type | like_query_props | query_with_cipher_column |
-+-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+--------------------------+
-| t_user | pwd | pwd_cipher | pwd_plain | | | AES | aes-key-value=123456abc | | | | | true |
-| t_encrypt | pwd | pwd_cipher | pwd_plain | | | AES | aes-key-value=123456abc | | | | | true |
-+-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+--------------------------+
++-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+
+| table | logic_column | cipher_column | plain_column | assisted_query_column | like_query_column | encryptor_type | encryptor_props | assisted_query_type | assisted_query_props | like_query_type | like_query_props |
++-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+
+| t_user | pwd | pwd_cipher | pwd_plain | | | AES | aes-key-value=123456abc | | | | |
+| t_encrypt | pwd | pwd_cipher | pwd_plain | | | AES | aes-key-value=123456abc | | | | |
++-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+
2 rows in set (0.00 sec)
```
@@ -76,12 +75,12 @@ SHOW ENCRYPT RULES;
```sql
mysql> SHOW ENCRYPT RULES;
-+-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+--------------------------+
-| table | logic_column | cipher_column | plain_column | assisted_query_column | like_query_column | encryptor_type | encryptor_props | assisted_query_type | assisted_query_props | like_query_type | like_query_props | query_with_cipher_column |
-+-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+--------------------------+
-| t_user | pwd | pwd_cipher | pwd_plain | | | AES | aes-key-value=123456abc | | | | | true |
-| t_encrypt | pwd | pwd_cipher | pwd_plain | | | AES | aes-key-value=123456abc | | | | | true |
-+-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+--------------------------+
++-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+
+| table | logic_column | cipher_column | plain_column | assisted_query_column | like_query_column | encryptor_type | encryptor_props | assisted_query_type | assisted_query_props | like_query_type | like_query_props |
++-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+
+| t_user | pwd | pwd_cipher | pwd_plain | | | AES | aes-key-value=123456abc | | | | |
+| t_encrypt | pwd | pwd_cipher | pwd_plain | | | AES | aes-key-value=123456abc | | | | |
++-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+
2 rows in set (0.00 sec)
```
@@ -93,11 +92,11 @@ SHOW ENCRYPT TABLE RULE t_encrypt FROM encrypt_db;
```sql
mysql> SHOW ENCRYPT TABLE RULE t_encrypt FROM encrypt_db;
-+-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+--------------------------+
-| table | logic_column | cipher_column | plain_column | assisted_query_column | like_query_column | encryptor_type | encryptor_props | assisted_query_type | assisted_query_props | like_query_type | like_query_props | query_with_cipher_column |
-+-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+--------------------------+
-| t_encrypt | pwd | pwd_cipher | pwd_plain | | | AES | aes-key-value=123456abc | | | | | true |
-+-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+--------------------------+
++-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+
+| table | logic_column | cipher_column | plain_column | assisted_query_column | like_query_column | encryptor_type | encryptor_props | assisted_query_type | assisted_query_props | like_query_type | like_query_props |
++-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+
+| t_encrypt | pwd | pwd_cipher | pwd_plain | | | AES | aes-key-value=123456abc | | | | |
++-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+
1 row in set (0.01 sec)
```
@@ -109,11 +108,11 @@ SHOW ENCRYPT TABLE RULE t_encrypt;
```sql
mysql> SHOW ENCRYPT TABLE RULE t_encrypt;
-+-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+--------------------------+
-| table | logic_column | cipher_column | plain_column | assisted_query_column | like_query_column | encryptor_type | encryptor_props | assisted_query_type | assisted_query_props | like_query_type | like_query_props | query_with_cipher_column |
-+-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+--------------------------+
-| t_encrypt | pwd | pwd_cipher | pwd_plain | | | AES | aes-key-value=123456abc | | | | | true |
-+-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+--------------------------+
++-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+
+| table | logic_column | cipher_column | plain_column | assisted_query_column | like_query_column | encryptor_type | encryptor_props | assisted_query_type | assisted_query_props | like_query_type | like_query_props |
++-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+
+| t_encrypt | pwd | pwd_cipher | pwd_plain | | | AES | aes-key-value=123456abc | | | | |
++-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+
1 row in set (0.01 sec)
```
diff --git a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/encrypt/show-encrypt-rule.en.md b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/encrypt/show-encrypt-rule.en.md
index 945313b1bd6..276a9a78b20 100644
--- a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/encrypt/show-encrypt-rule.en.md
+++ b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/encrypt/show-encrypt-rule.en.md
@@ -47,7 +47,6 @@ databaseName ::=
| assisted_query_props | Assisted query algorithm parameter |
| like_query_type | Like query algorithm type |
| like_query_props | Like query algorithm parameter |
-| query_with_cipher_column | Whether to use encrypted column for query |
@@ -62,12 +61,12 @@ SHOW ENCRYPT RULES FROM encrypt_db;
```sql
mysql> SHOW ENCRYPT RULES FROM encrypt_db;
-+-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+--------------------------+
-| table | logic_column | cipher_column | plain_column | assisted_query_column | like_query_column | encryptor_type | encryptor_props | assisted_query_type | assisted_query_props | like_query_type | like_query_props | query_with_cipher_column |
-+-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+--------------------------+
-| t_user | pwd | pwd_cipher | pwd_plain | | | AES | aes-key-value=123456abc | | | | | true |
-| t_encrypt | pwd | pwd_cipher | pwd_plain | | | AES | aes-key-value=123456abc | | | | | true |
-+-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+--------------------------+
++-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+
+| table | logic_column | cipher_column | plain_column | assisted_query_column | like_query_column | encryptor_type | encryptor_props | assisted_query_type | assisted_query_props | like_query_type | like_query_props |
++-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+
+| t_user | pwd | pwd_cipher | pwd_plain | | | AES | aes-key-value=123456abc | | | | |
+| t_encrypt | pwd | pwd_cipher | pwd_plain | | | AES | aes-key-value=123456abc | | | | |
++-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+
2 rows in set (0.00 sec)
```
@@ -79,12 +78,12 @@ SHOW ENCRYPT RULES;
```sql
mysql> SHOW ENCRYPT RULES;
-+-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+--------------------------+
-| table | logic_column | cipher_column | plain_column | assisted_query_column | like_query_column | encryptor_type | encryptor_props | assisted_query_type | assisted_query_props | like_query_type | like_query_props | query_with_cipher_column |
-+-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+--------------------------+
-| t_user | pwd | pwd_cipher | pwd_plain | | | AES | aes-key-value=123456abc | | | | | true |
-| t_encrypt | pwd | pwd_cipher | pwd_plain | | | AES | aes-key-value=123456abc | | | | | true |
-+-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+--------------------------+
++-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+
+| table | logic_column | cipher_column | plain_column | assisted_query_column | like_query_column | encryptor_type | encryptor_props | assisted_query_type | assisted_query_props | like_query_type | like_query_props |
++-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+
+| t_user | pwd | pwd_cipher | pwd_plain | | | AES | aes-key-value=123456abc | | | | |
+| t_encrypt | pwd | pwd_cipher | pwd_plain | | | AES | aes-key-value=123456abc | | | | |
++-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+
2 rows in set (0.00 sec)
```
@@ -96,11 +95,11 @@ SHOW ENCRYPT TABLE RULE t_encrypt FROM encrypt_db;
```sql
mysql> SHOW ENCRYPT TABLE RULE t_encrypt FROM encrypt_db;
-+-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+--------------------------+
-| table | logic_column | cipher_column | plain_column | assisted_query_column | like_query_column | encryptor_type | encryptor_props | assisted_query_type | assisted_query_props | like_query_type | like_query_props | query_with_cipher_column |
-+-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+--------------------------+
-| t_encrypt | pwd | pwd_cipher | pwd_plain | | | AES | aes-key-value=123456abc | | | | | true |
-+-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+--------------------------+
++-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+
+| table | logic_column | cipher_column | plain_column | assisted_query_column | like_query_column | encryptor_type | encryptor_props | assisted_query_type | assisted_query_props | like_query_type | like_query_props |
++-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+
+| t_encrypt | pwd | pwd_cipher | pwd_plain | | | AES | aes-key-value=123456abc | | | | |
++-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+
1 row in set (0.01 sec)
```
@@ -112,11 +111,11 @@ SHOW ENCRYPT TABLE RULE t_encrypt;
```sql
mysql> SHOW ENCRYPT TABLE RULE t_encrypt;
-+-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+--------------------------+
-| table | logic_column | cipher_column | plain_column | assisted_query_column | like_query_column | encryptor_type | encryptor_props | assisted_query_type | assisted_query_props | like_query_type | like_query_props | query_with_cipher_column |
-+-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+--------------------------+
-| t_encrypt | pwd | pwd_cipher | pwd_plain | | | AES | aes-key-value=123456abc | | | | | true |
-+-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+--------------------------+
++-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+
+| table | logic_column | cipher_column | plain_column | assisted_query_column | like_query_column | encryptor_type | encryptor_props | assisted_query_type | assisted_query_props | like_query_type | like_query_props |
++-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+
+| t_encrypt | pwd | pwd_cipher | pwd_plain | | | AES | aes-key-value=123456abc | | | | |
++-----------+--------------+---------------+--------------+-----------------------+-------------------+----------------+-------------------------+---------------------+----------------------+-----------------+------------------+
1 row in set (0.01 sec)
```
diff --git a/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/api/config/EncryptRuleConfiguration.java b/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/api/config/EncryptRuleConfiguration.java
index e143dd90c66..69916a4466f 100644
--- a/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/api/config/EncryptRuleConfiguration.java
+++ b/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/api/config/EncryptRuleConfiguration.java
@@ -41,18 +41,7 @@ public final class EncryptRuleConfiguration implements DatabaseRuleConfiguration
private final Map<String, AlgorithmConfiguration> likeEncryptors;
- private final boolean queryWithCipherColumn;
-
public EncryptRuleConfiguration(final Collection<EncryptTableRuleConfiguration> tables, final Map<String, AlgorithmConfiguration> encryptors) {
- this(tables, encryptors, Collections.emptyMap(), true);
- }
-
- public EncryptRuleConfiguration(final Collection<EncryptTableRuleConfiguration> tables, final Map<String, AlgorithmConfiguration> encryptors, final boolean queryWithCipherColumn) {
- this(tables, encryptors, Collections.emptyMap(), queryWithCipherColumn);
- }
-
- public EncryptRuleConfiguration(final Collection<EncryptTableRuleConfiguration> tables,
- final Map<String, AlgorithmConfiguration> encryptors, final Map<String, AlgorithmConfiguration> likeEncryptors) {
- this(tables, encryptors, likeEncryptors, true);
+ this(tables, encryptors, Collections.emptyMap());
}
}
diff --git a/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/api/config/rule/EncryptColumnRuleConfiguration.java b/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/api/config/rule/EncryptColumnRuleConfiguration.java
index f38dfea06a9..f9b2e00d7d3 100644
--- a/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/api/config/rule/EncryptColumnRuleConfiguration.java
+++ b/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/api/config/rule/EncryptColumnRuleConfiguration.java
@@ -43,10 +43,8 @@ public final class EncryptColumnRuleConfiguration {
private final String likeQueryEncryptorName;
- private final Boolean queryWithCipherColumn;
-
public EncryptColumnRuleConfiguration(final String logicColumn, final String cipherColumn, final String assistedQueryColumn, final String likeQueryColumn,
- final String plainColumn, final String encryptorName, final Boolean queryWithCipherColumn) {
- this(logicColumn, cipherColumn, assistedQueryColumn, likeQueryColumn, plainColumn, encryptorName, null, null, queryWithCipherColumn);
+ final String plainColumn, final String encryptorName) {
+ this(logicColumn, cipherColumn, assistedQueryColumn, likeQueryColumn, plainColumn, encryptorName, null, null);
}
}
diff --git a/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/api/config/rule/EncryptTableRuleConfiguration.java b/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/api/config/rule/EncryptTableRuleConfiguration.java
index 00cd22aa1ee..f4d1935dd9b 100644
--- a/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/api/config/rule/EncryptTableRuleConfiguration.java
+++ b/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/api/config/rule/EncryptTableRuleConfiguration.java
@@ -32,6 +32,4 @@ public final class EncryptTableRuleConfiguration {
private final String name;
private final Collection<EncryptColumnRuleConfiguration> columns;
-
- private final Boolean queryWithCipherColumn;
}
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/merge/dql/EncryptAlgorithmMetaData.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/merge/dql/EncryptAlgorithmMetaData.java
index 2f03f400ada..67a22116a9f 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/merge/dql/EncryptAlgorithmMetaData.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/merge/dql/EncryptAlgorithmMetaData.java
@@ -18,10 +18,10 @@
package org.apache.shardingsphere.encrypt.merge.dql;
import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
+import org.apache.shardingsphere.encrypt.api.context.EncryptContext;
import org.apache.shardingsphere.encrypt.context.EncryptContextBuilder;
import org.apache.shardingsphere.encrypt.rule.EncryptRule;
-import org.apache.shardingsphere.encrypt.api.context.EncryptContext;
+import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
import org.apache.shardingsphere.infra.binder.segment.select.projection.Projection;
import org.apache.shardingsphere.infra.binder.segment.select.projection.impl.ColumnProjection;
import org.apache.shardingsphere.infra.binder.segment.table.TablesContext;
@@ -58,17 +58,6 @@ public final class EncryptAlgorithmMetaData {
return encryptRule.findEncryptor(tableName, columnName);
}
- /**
- * Judge whether column is support QueryWithCipherColumn or not.
- *
- * @param tableName table name
- * @param columnName column name
- * @return whether column is support QueryWithCipherColumn or not
- */
- public boolean isQueryWithCipherColumn(final String tableName, final String columnName) {
- return encryptRule.isQueryWithCipherColumn(tableName, columnName);
- }
-
/**
* Find encrypt context.
*
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/merge/dql/EncryptMergedResult.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/merge/dql/EncryptMergedResult.java
index a4dffa49539..9cc66287b04 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/merge/dql/EncryptMergedResult.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/merge/dql/EncryptMergedResult.java
@@ -18,8 +18,8 @@
package org.apache.shardingsphere.encrypt.merge.dql;
import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
import org.apache.shardingsphere.encrypt.api.context.EncryptContext;
+import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
import org.apache.shardingsphere.infra.merge.result.MergedResult;
import java.io.InputStream;
@@ -46,7 +46,7 @@ public final class EncryptMergedResult implements MergedResult {
@Override
public Object getValue(final int columnIndex, final Class<?> type) throws SQLException {
Optional<EncryptContext> encryptContext = metaData.findEncryptContext(columnIndex);
- if (!encryptContext.isPresent() || !metaData.isQueryWithCipherColumn(encryptContext.get().getTableName(), encryptContext.get().getColumnName())) {
+ if (!encryptContext.isPresent()) {
return mergedResult.getValue(columnIndex, type);
}
Optional<EncryptAlgorithm> encryptAlgorithm = metaData.findEncryptor(encryptContext.get().getTableName(), encryptContext.get().getColumnName());
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/parameter/rewriter/EncryptPredicateParameterRewriter.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/parameter/rewriter/EncryptPredicateParameterRewriter.java
index 672e9004010..34356c887f7 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/parameter/rewriter/EncryptPredicateParameterRewriter.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/parameter/rewriter/EncryptPredicateParameterRewriter.java
@@ -20,10 +20,10 @@ package org.apache.shardingsphere.encrypt.rewrite.parameter.rewriter;
import lombok.Setter;
import org.apache.shardingsphere.encrypt.rewrite.aware.DatabaseNameAware;
import org.apache.shardingsphere.encrypt.rewrite.aware.EncryptConditionsAware;
+import org.apache.shardingsphere.encrypt.rewrite.aware.EncryptRuleAware;
import org.apache.shardingsphere.encrypt.rewrite.condition.EncryptCondition;
import org.apache.shardingsphere.encrypt.rewrite.condition.impl.EncryptBinaryCondition;
import org.apache.shardingsphere.encrypt.rule.EncryptRule;
-import org.apache.shardingsphere.encrypt.rewrite.aware.EncryptRuleAware;
import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
import org.apache.shardingsphere.infra.binder.type.WhereAvailable;
import org.apache.shardingsphere.infra.database.type.DatabaseTypeEngine;
@@ -57,10 +57,7 @@ public final class EncryptPredicateParameterRewriter implements ParameterRewrite
public void rewrite(final ParameterBuilder paramBuilder, final SQLStatementContext<?> sqlStatementContext, final List<Object> params) {
String schemaName = sqlStatementContext.getTablesContext().getSchemaName().orElseGet(() -> DatabaseTypeEngine.getDefaultSchemaName(sqlStatementContext.getDatabaseType(), databaseName));
for (EncryptCondition each : encryptConditions) {
- boolean queryWithCipherColumn = encryptRule.isQueryWithCipherColumn(each.getTableName(), each.getColumnName());
- if (queryWithCipherColumn) {
- encryptParameters(paramBuilder, each.getPositionIndexMap(), getEncryptedValues(schemaName, each, each.getValues(params)));
- }
+ encryptParameters(paramBuilder, each.getPositionIndexMap(), getEncryptedValues(schemaName, each, each.getValues(params)));
}
}
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptIndexColumnTokenGenerator.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptIndexColumnTokenGenerator.java
index b3bed4fc910..39bd7775ce3 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptIndexColumnTokenGenerator.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptIndexColumnTokenGenerator.java
@@ -19,8 +19,8 @@ package org.apache.shardingsphere.encrypt.rewrite.token.generator;
import com.google.common.base.Preconditions;
import lombok.Setter;
-import org.apache.shardingsphere.encrypt.rule.EncryptRule;
import org.apache.shardingsphere.encrypt.rewrite.aware.EncryptRuleAware;
+import org.apache.shardingsphere.encrypt.rule.EncryptRule;
import org.apache.shardingsphere.infra.binder.segment.select.projection.impl.ColumnProjection;
import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
import org.apache.shardingsphere.infra.binder.type.IndexAvailable;
@@ -67,12 +67,8 @@ public final class EncryptIndexColumnTokenGenerator implements CollectionSQLToke
QuoteCharacter quoteCharacter = columnSegment.getIdentifier().getQuoteCharacter();
int startIndex = columnSegment.getStartIndex();
int stopIndex = columnSegment.getStopIndex();
- boolean queryWithCipherColumn = encryptRule.isQueryWithCipherColumn(tableName, columnName);
- if (queryWithCipherColumn) {
- return encryptRule.findAssistedQueryColumn(tableName, columnName).map(optional -> getAssistedQueryColumnToken(startIndex, stopIndex, optional, quoteCharacter))
- .orElseGet(() -> getCipherColumnToken(tableName, startIndex, stopIndex, columnName, quoteCharacter));
- }
- return getPlainColumnToken(tableName, startIndex, stopIndex, columnName, quoteCharacter);
+ return encryptRule.findAssistedQueryColumn(tableName, columnName).map(optional -> getAssistedQueryColumnToken(startIndex, stopIndex, optional, quoteCharacter))
+ .orElseGet(() -> getCipherColumnToken(tableName, startIndex, stopIndex, columnName, quoteCharacter));
}
private Optional<SQLToken> getAssistedQueryColumnToken(final int startIndex, final int stopIndex, final String columnName, final QuoteCharacter quoteCharacter) {
@@ -86,11 +82,6 @@ public final class EncryptIndexColumnTokenGenerator implements CollectionSQLToke
return Optional.of(new SubstitutableColumnNameToken(startIndex, stopIndex, columnProjections, quoteCharacter));
}
- private Optional<SQLToken> getPlainColumnToken(final String tableName, final int startIndex, final int stopIndex, final String columnName, final QuoteCharacter quoteCharacter) {
- return encryptRule.findPlainColumn(tableName, columnName)
- .map(optional -> new SubstitutableColumnNameToken(startIndex, stopIndex, getColumnProjections(optional), quoteCharacter));
- }
-
private Collection<ColumnProjection> getColumnProjections(final String columnName) {
return Collections.singletonList(new ColumnProjection(null, columnName, null));
}
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptOrderByItemTokenGenerator.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptOrderByItemTokenGenerator.java
index 55f9bc83c07..5c1dd29ba4f 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptOrderByItemTokenGenerator.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptOrderByItemTokenGenerator.java
@@ -18,9 +18,9 @@
package org.apache.shardingsphere.encrypt.rewrite.token.generator;
import lombok.Setter;
+import org.apache.shardingsphere.encrypt.rewrite.aware.EncryptRuleAware;
import org.apache.shardingsphere.encrypt.rule.EncryptRule;
import org.apache.shardingsphere.encrypt.rule.EncryptTable;
-import org.apache.shardingsphere.encrypt.rewrite.aware.EncryptRuleAware;
import org.apache.shardingsphere.infra.binder.segment.select.orderby.OrderByItem;
import org.apache.shardingsphere.infra.binder.segment.select.projection.impl.ColumnProjection;
import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
@@ -82,14 +82,6 @@ public final class EncryptOrderByItemTokenGenerator implements CollectionSQLToke
}
int startIndex = column.getOwner().isPresent() ? column.getOwner().get().getStopIndex() + 2 : column.getStartIndex();
int stopIndex = column.getStopIndex();
- boolean queryWithCipherColumn = encryptRule.isQueryWithCipherColumn(tableName, column.getIdentifier().getValue());
- if (!queryWithCipherColumn) {
- Optional<String> plainColumn = encryptTable.get().findPlainColumn(column.getIdentifier().getValue());
- if (plainColumn.isPresent()) {
- result.add(new SubstitutableColumnNameToken(startIndex, stopIndex, createColumnProjections(plainColumn.get())));
- continue;
- }
- }
Optional<String> assistedQueryColumn = encryptTable.get().findAssistedQueryColumn(column.getIdentifier().getValue());
SubstitutableColumnNameToken encryptColumnNameToken = assistedQueryColumn.map(optional -> new SubstitutableColumnNameToken(startIndex, stopIndex, createColumnProjections(optional)))
.orElseGet(() -> new SubstitutableColumnNameToken(startIndex, stopIndex, createColumnProjections(encryptTable.get().getCipherColumn(column.getIdentifier().getValue()))));
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptPredicateColumnTokenGenerator.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptPredicateColumnTokenGenerator.java
index 4592b6461f3..03c05b6e912 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptPredicateColumnTokenGenerator.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptPredicateColumnTokenGenerator.java
@@ -93,12 +93,6 @@ public final class EncryptPredicateColumnTokenGenerator implements CollectionSQL
int startIndex = columnSegment.getOwner().isPresent() ? columnSegment.getOwner().get().getStopIndex() + 2 : columnSegment.getStartIndex();
int stopIndex = columnSegment.getStopIndex();
String logicColumn = columnSegment.getIdentifier().getValue();
- if (!encryptRule.isQueryWithCipherColumn(tableName, logicColumn)) {
- Optional<String> plainColumn = encryptTable.findPlainColumn(logicColumn);
- if (plainColumn.isPresent()) {
- return new SubstitutableColumnNameToken(startIndex, stopIndex, createColumnProjections(plainColumn.get()));
- }
- }
// TODO remove foreach loop to improve performance
if (isColumnSegmentIncludedInLikeExpression(whereSegments, columnSegment)) {
Optional<String> likeQueryColumn = encryptTable.findLikeQueryColumn(logicColumn);
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptPredicateRightValueTokenGenerator.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptPredicateRightValueTokenGenerator.java
index f15cbb0ac45..c958035f8af 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptPredicateRightValueTokenGenerator.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptPredicateRightValueTokenGenerator.java
@@ -39,7 +39,6 @@ import org.apache.shardingsphere.infra.util.exception.ShardingSpherePrecondition
import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.FunctionSegment;
import java.util.Collection;
-import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
@@ -84,12 +83,10 @@ public final class EncryptPredicateRightValueTokenGenerator
private SQLToken generateSQLToken(final String schemaName, final EncryptCondition encryptCondition) {
List<Object> originalValues = encryptCondition.getValues(parameters);
int startIndex = encryptCondition.getStartIndex();
- boolean queryWithCipherColumn = encryptRule.isQueryWithCipherColumn(encryptCondition.getTableName(), encryptCondition.getColumnName());
- return queryWithCipherColumn ? generateSQLTokenForQueryWithCipherColumn(schemaName, encryptCondition, originalValues, startIndex)
- : generateSQLTokenForQueryWithoutCipherColumn(schemaName, encryptCondition, originalValues, startIndex);
+ return generateSQLToken(schemaName, encryptCondition, originalValues, startIndex);
}
- private SQLToken generateSQLTokenForQueryWithCipherColumn(final String schemaName, final EncryptCondition encryptCondition, final List<Object> originalValues, final int startIndex) {
+ private SQLToken generateSQLToken(final String schemaName, final EncryptCondition encryptCondition, final List<Object> originalValues, final int startIndex) {
int stopIndex = encryptCondition.getStopIndex();
Map<Integer, Object> indexValues = getPositionValues(encryptCondition.getPositionValueMap().keySet(), getEncryptedValues(schemaName, encryptCondition, originalValues));
Collection<Integer> parameterMarkerIndexes = encryptCondition.getPositionIndexMap().keySet();
@@ -114,25 +111,6 @@ public final class EncryptPredicateRightValueTokenGenerator
: encryptRule.getEncryptValues(databaseName, schemaName, encryptCondition.getTableName(), encryptCondition.getColumnName(), originalValues);
}
- private SQLToken generateSQLTokenForQueryWithoutCipherColumn(final String schemaName, final EncryptCondition encryptCondition, final List<Object> originalValues, final int startIndex) {
- int stopIndex = encryptCondition.getStopIndex();
- Map<Integer, Object> indexValues = new HashMap<>();
- Optional<String> plainColumn = encryptRule.findPlainColumn(encryptCondition.getTableName(), encryptCondition.getColumnName());
- if (plainColumn.isPresent()) {
- indexValues.putAll(getPositionValues(encryptCondition.getPositionValueMap().keySet(), originalValues));
- } else {
- indexValues.putAll(getPositionValues(encryptCondition.getPositionValueMap().keySet(), getEncryptedValues(schemaName, encryptCondition, originalValues)));
- }
- Collection<Integer> parameterMarkerIndexes = encryptCondition.getPositionIndexMap().keySet();
- if (encryptCondition instanceof EncryptBinaryCondition && ((EncryptBinaryCondition) encryptCondition).getExpressionSegment() instanceof FunctionSegment) {
- return new EncryptPredicateFunctionRightValueToken(startIndex, stopIndex,
- ((FunctionSegment) ((EncryptBinaryCondition) encryptCondition).getExpressionSegment()).getFunctionName(), indexValues, parameterMarkerIndexes);
- }
- return encryptCondition instanceof EncryptInCondition
- ? new EncryptPredicateInRightValueToken(startIndex, stopIndex, indexValues, parameterMarkerIndexes)
- : new EncryptPredicateEqualRightValueToken(startIndex, stopIndex, indexValues, parameterMarkerIndexes);
- }
-
private Map<Integer, Object> getPositionValues(final Collection<Integer> valuePositions, final List<Object> encryptValues) {
Map<Integer, Object> result = new LinkedHashMap<>();
for (int each : valuePositions) {
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptProjectionTokenGenerator.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptProjectionTokenGenerator.java
index ed095f40082..d183227a77a 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptProjectionTokenGenerator.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptProjectionTokenGenerator.java
@@ -167,13 +167,6 @@ public final class EncryptProjectionTokenGenerator implements CollectionSQLToken
}
private ColumnProjection generatePredicateSubqueryProjection(final String tableName, final ColumnProjection column) {
- boolean queryWithCipherColumn = encryptRule.isQueryWithCipherColumn(tableName, column.getName());
- if (!queryWithCipherColumn) {
- Optional<String> plainColumn = encryptRule.findPlainColumn(tableName, column.getName());
- if (plainColumn.isPresent()) {
- return new ColumnProjection(column.getOwner(), plainColumn.get(), null);
- }
- }
Optional<String> assistedQueryColumn = encryptRule.findAssistedQueryColumn(tableName, column.getName());
if (assistedQueryColumn.isPresent()) {
return new ColumnProjection(column.getOwner(), assistedQueryColumn.get(), null);
@@ -205,11 +198,7 @@ public final class EncryptProjectionTokenGenerator implements CollectionSQLToken
}
private String getEncryptColumnName(final String tableName, final String logicEncryptColumnName) {
- boolean queryWithCipherColumn = encryptRule.isQueryWithCipherColumn(tableName, logicEncryptColumnName);
- if (queryWithCipherColumn) {
- return encryptRule.getCipherColumn(tableName, logicEncryptColumnName);
- }
- return encryptRule.findPlainColumn(tableName, logicEncryptColumnName).orElseGet(() -> encryptRule.getCipherColumn(tableName, logicEncryptColumnName));
+ return encryptRule.getCipherColumn(tableName, logicEncryptColumnName);
}
private ShorthandProjection getShorthandProjection(final ShorthandProjectionSegment segment, final ProjectionsContext projectionsContext) {
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptColumn.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptColumn.java
index 7b168c8e6d4..e78d5cdff8f 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptColumn.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptColumn.java
@@ -44,11 +44,8 @@ public final class EncryptColumn {
private final String likeQueryEncryptorName;
- private final Boolean queryWithCipherColumn;
-
- public EncryptColumn(final String cipherColumn, final String assistedQueryColumn, final String likeQueryColumn, final String plainColumn,
- final String encryptorName, final Boolean queryWithCipherColumn) {
- this(cipherColumn, assistedQueryColumn, plainColumn, likeQueryColumn, encryptorName, null, null, queryWithCipherColumn);
+ public EncryptColumn(final String cipherColumn, final String assistedQueryColumn, final String likeQueryColumn, final String plainColumn, final String encryptorName) {
+ this(cipherColumn, assistedQueryColumn, plainColumn, likeQueryColumn, encryptorName, null, null);
}
/**
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptRule.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptRule.java
index ee7589e6e9c..cdb85bc375b 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptRule.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptRule.java
@@ -24,8 +24,8 @@ import org.apache.shardingsphere.encrypt.context.EncryptContextBuilder;
import org.apache.shardingsphere.encrypt.exception.metadata.EncryptAssistedQueryEncryptorNotFoundException;
import org.apache.shardingsphere.encrypt.exception.metadata.EncryptEncryptorNotFoundException;
import org.apache.shardingsphere.encrypt.exception.metadata.EncryptLikeQueryEncryptorNotFoundException;
-import org.apache.shardingsphere.encrypt.spi.LikeEncryptAlgorithm;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
+import org.apache.shardingsphere.encrypt.spi.LikeEncryptAlgorithm;
import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
import org.apache.shardingsphere.infra.rule.identifier.scope.DatabaseRule;
import org.apache.shardingsphere.infra.rule.identifier.type.ColumnContainedRule;
@@ -57,14 +57,11 @@ public final class EncryptRule implements DatabaseRule, TableContainedRule, Colu
private final Map<String, EncryptTable> tables = new LinkedHashMap<>();
- private final boolean queryWithCipherColumn;
-
public EncryptRule(final EncryptRuleConfiguration ruleConfig) {
configuration = ruleConfig;
ruleConfig.getEncryptors().forEach((key, value) -> encryptors.put(key, TypedSPILoader.getService(EncryptAlgorithm.class, value.getType(), value.getProps())));
ruleConfig.getLikeEncryptors().forEach((key, value) -> likeEncryptors.put(key, TypedSPILoader.getService(LikeEncryptAlgorithm.class, value.getType(), value.getProps())));
ruleConfig.getTables().forEach(each -> tables.put(each.getName().toLowerCase(), new EncryptTable(each)));
- queryWithCipherColumn = ruleConfig.isQueryWithCipherColumn();
}
/**
@@ -281,17 +278,6 @@ public final class EncryptRule implements DatabaseRule, TableContainedRule, Colu
return originColumnName.isPresent() && tables.containsKey(logicTable.toLowerCase()) ? tables.get(logicTable.toLowerCase()).findPlainColumn(originColumnName.get()) : Optional.empty();
}
- /**
- * Judge whether column is query with cipher column or not.
- *
- * @param logicTable logic table name
- * @param logicColumn logic column name
- * @return query with cipher column or not
- */
- public boolean isQueryWithCipherColumn(final String logicTable, final String logicColumn) {
- return findEncryptTable(logicTable).flatMap(encryptTable -> encryptTable.getQueryWithCipherColumn(logicColumn)).orElse(queryWithCipherColumn);
- }
-
private Optional<String> findOriginColumnName(final String logicTable, final String logicColumn) {
for (String each : tables.get(logicTable.toLowerCase()).getLogicColumns()) {
if (logicColumn.equalsIgnoreCase(each)) {
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptTable.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptTable.java
index c7354e8e535..7e227788ee8 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptTable.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptTable.java
@@ -35,18 +35,15 @@ public final class EncryptTable {
private final Map<String, EncryptColumn> columns;
- private final Boolean queryWithCipherColumn;
-
public EncryptTable(final EncryptTableRuleConfiguration config) {
columns = createEncryptColumns(config);
- queryWithCipherColumn = config.getQueryWithCipherColumn();
}
private Map<String, EncryptColumn> createEncryptColumns(final EncryptTableRuleConfiguration config) {
Map<String, EncryptColumn> result = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
for (EncryptColumnRuleConfiguration each : config.getColumns()) {
EncryptColumn encryptColumn = new EncryptColumn(each.getCipherColumn(), each.getAssistedQueryColumn(), each.getPlainColumn(),
- each.getLikeQueryColumn(), each.getEncryptorName(), each.getAssistedQueryEncryptorName(), each.getLikeQueryEncryptorName(), each.getQueryWithCipherColumn());
+ each.getLikeQueryColumn(), each.getEncryptorName(), each.getAssistedQueryEncryptorName(), each.getLikeQueryEncryptorName());
result.put(each.getLogicColumn(), encryptColumn);
}
return result;
@@ -231,16 +228,6 @@ public final class EncryptTable {
return result;
}
- /**
- * Get query with cipher column.
- *
- * @param logicColumn logic column
- * @return query with cipher column
- */
- public Optional<Boolean> getQueryWithCipherColumn(final String logicColumn) {
- return Optional.ofNullable(findEncryptColumn(logicColumn).map(EncryptColumn::getQueryWithCipherColumn).orElse(queryWithCipherColumn));
- }
-
/**
* Find encrypt column.
*
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/yaml/config/YamlEncryptRuleConfiguration.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/yaml/config/YamlEncryptRuleConfiguration.java
index 8cae7531410..5a73265332a 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/yaml/config/YamlEncryptRuleConfiguration.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/yaml/config/YamlEncryptRuleConfiguration.java
@@ -40,8 +40,6 @@ public final class YamlEncryptRuleConfiguration implements YamlRuleConfiguration
private Map<String, YamlAlgorithmConfiguration> likeEncryptors = new LinkedHashMap<>();
- private boolean queryWithCipherColumn = true;
-
@Override
public Class<EncryptRuleConfiguration> getRuleConfigurationType() {
return EncryptRuleConfiguration.class;
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/yaml/config/rule/YamlEncryptColumnRuleConfiguration.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/yaml/config/rule/YamlEncryptColumnRuleConfiguration.java
index fa6f561b988..683a6c885d0 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/yaml/config/rule/YamlEncryptColumnRuleConfiguration.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/yaml/config/rule/YamlEncryptColumnRuleConfiguration.java
@@ -43,6 +43,4 @@ public final class YamlEncryptColumnRuleConfiguration implements YamlConfigurati
private String assistedQueryEncryptorName;
private String likeQueryEncryptorName;
-
- private Boolean queryWithCipherColumn;
}
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/yaml/config/rule/YamlEncryptTableRuleConfiguration.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/yaml/config/rule/YamlEncryptTableRuleConfiguration.java
index ecf6ed28ee8..3738a9329b6 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/yaml/config/rule/YamlEncryptTableRuleConfiguration.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/yaml/config/rule/YamlEncryptTableRuleConfiguration.java
@@ -34,6 +34,4 @@ public final class YamlEncryptTableRuleConfiguration implements YamlConfiguratio
private String name;
private Map<String, YamlEncryptColumnRuleConfiguration> columns = new LinkedHashMap<>();
-
- private Boolean queryWithCipherColumn;
}
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/YamlEncryptRuleConfigurationSwapper.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/YamlEncryptRuleConfigurationSwapper.java
index 34dbe75dd01..85a9f3f1c53 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/YamlEncryptRuleConfigurationSwapper.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/YamlEncryptRuleConfigurationSwapper.java
@@ -25,8 +25,8 @@ import org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptTableRuleCo
import org.apache.shardingsphere.encrypt.yaml.swapper.rule.YamlEncryptTableRuleConfigurationSwapper;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
import org.apache.shardingsphere.infra.yaml.config.pojo.algorithm.YamlAlgorithmConfiguration;
-import org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlRuleConfigurationSwapper;
import org.apache.shardingsphere.infra.yaml.config.swapper.algorithm.YamlAlgorithmConfigurationSwapper;
+import org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlRuleConfigurationSwapper;
import java.util.Collection;
import java.util.LinkedHashMap;
@@ -49,13 +49,12 @@ public final class YamlEncryptRuleConfigurationSwapper implements YamlRuleConfig
data.getTables().forEach(each -> result.getTables().put(each.getName(), tableSwapper.swapToYamlConfiguration(each)));
data.getEncryptors().forEach((key, value) -> result.getEncryptors().put(key, algorithmSwapper.swapToYamlConfiguration(value)));
data.getLikeEncryptors().forEach((key, value) -> result.getLikeEncryptors().put(key, algorithmSwapper.swapToYamlConfiguration(value)));
- result.setQueryWithCipherColumn(data.isQueryWithCipherColumn());
return result;
}
@Override
public EncryptRuleConfiguration swapToObject(final YamlEncryptRuleConfiguration yamlConfig) {
- return new EncryptRuleConfiguration(swapTables(yamlConfig), swapEncryptAlgorithm(yamlConfig), swapLikeEncryptAlgorithm(yamlConfig), yamlConfig.isQueryWithCipherColumn());
+ return new EncryptRuleConfiguration(swapTables(yamlConfig), swapEncryptAlgorithm(yamlConfig), swapLikeEncryptAlgorithm(yamlConfig));
}
private Collection<EncryptTableRuleConfiguration> swapTables(final YamlEncryptRuleConfiguration yamlConfig) {
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/rule/YamlEncryptColumnRuleConfigurationSwapper.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/rule/YamlEncryptColumnRuleConfigurationSwapper.java
index c6922d1f2a4..1b1f5bf77d3 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/rule/YamlEncryptColumnRuleConfigurationSwapper.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/rule/YamlEncryptColumnRuleConfigurationSwapper.java
@@ -37,7 +37,6 @@ public final class YamlEncryptColumnRuleConfigurationSwapper implements YamlConf
result.setEncryptorName(data.getEncryptorName());
result.setAssistedQueryEncryptorName(data.getAssistedQueryEncryptorName());
result.setLikeQueryEncryptorName(data.getLikeQueryEncryptorName());
- result.setQueryWithCipherColumn(data.getQueryWithCipherColumn());
return result;
}
@@ -45,6 +44,6 @@ public final class YamlEncryptColumnRuleConfigurationSwapper implements YamlConf
public EncryptColumnRuleConfiguration swapToObject(final YamlEncryptColumnRuleConfiguration yamlConfig) {
return new EncryptColumnRuleConfiguration(
yamlConfig.getLogicColumn(), yamlConfig.getCipherColumn(), yamlConfig.getAssistedQueryColumn(), yamlConfig.getLikeQueryColumn(), yamlConfig.getPlainColumn(),
- yamlConfig.getEncryptorName(), yamlConfig.getAssistedQueryEncryptorName(), yamlConfig.getLikeQueryEncryptorName(), yamlConfig.getQueryWithCipherColumn());
+ yamlConfig.getEncryptorName(), yamlConfig.getAssistedQueryEncryptorName(), yamlConfig.getLikeQueryEncryptorName());
}
}
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/rule/YamlEncryptTableRuleConfigurationSwapper.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/rule/YamlEncryptTableRuleConfigurationSwapper.java
index 0c2566bae1c..430ae6c417e 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/rule/YamlEncryptTableRuleConfigurationSwapper.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/rule/YamlEncryptTableRuleConfigurationSwapper.java
@@ -41,7 +41,6 @@ public final class YamlEncryptTableRuleConfigurationSwapper implements YamlConfi
result.getColumns().put(each.getLogicColumn(), columnSwapper.swapToYamlConfiguration(each));
}
result.setName(data.getName());
- result.setQueryWithCipherColumn(data.getQueryWithCipherColumn());
return result;
}
@@ -53,6 +52,6 @@ public final class YamlEncryptTableRuleConfigurationSwapper implements YamlConfi
yamlEncryptColumnRuleConfig.setLogicColumn(entry.getKey());
columns.add(columnSwapper.swapToObject(yamlEncryptColumnRuleConfig));
}
- return new EncryptTableRuleConfiguration(yamlConfig.getName(), columns, yamlConfig.getQueryWithCipherColumn());
+ return new EncryptTableRuleConfiguration(yamlConfig.getName(), columns);
}
}
diff --git a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/checker/EncryptRuleConfigurationCheckerTest.java b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/checker/EncryptRuleConfigurationCheckerTest.java
index b6f08753137..be6974c03bc 100644
--- a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/checker/EncryptRuleConfigurationCheckerTest.java
+++ b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/checker/EncryptRuleConfigurationCheckerTest.java
@@ -46,8 +46,8 @@ class EncryptRuleConfigurationCheckerTest {
private EncryptRuleConfiguration createValidConfiguration() {
EncryptRuleConfiguration result = mock(EncryptRuleConfiguration.class);
when(result.getEncryptors()).thenReturn(Collections.singletonMap("aes_encryptor", mock(AlgorithmConfiguration.class)));
- Collection<EncryptColumnRuleConfiguration> columns = Collections.singletonList(new EncryptColumnRuleConfiguration("user_id", "user_cipher", null, null, "user_plain", "aes_encryptor", false));
- when(result.getTables()).thenReturn(Collections.singletonList(new EncryptTableRuleConfiguration("t_encrypt", columns, false)));
+ Collection<EncryptColumnRuleConfiguration> columns = Collections.singletonList(new EncryptColumnRuleConfiguration("user_id", "user_cipher", null, null, "user_plain", "aes_encryptor"));
+ when(result.getTables()).thenReturn(Collections.singletonList(new EncryptTableRuleConfiguration("t_encrypt", columns)));
return result;
}
@@ -62,8 +62,8 @@ class EncryptRuleConfigurationCheckerTest {
private EncryptRuleConfiguration createInvalidCipherColumnConfig() {
EncryptRuleConfiguration result = mock(EncryptRuleConfiguration.class);
when(result.getEncryptors()).thenReturn(Collections.emptyMap());
- Collection<EncryptColumnRuleConfiguration> columns = Collections.singletonList(new EncryptColumnRuleConfiguration("user_id", "user_cipher", null, null, "user_plain", "aes_encryptor", false));
- when(result.getTables()).thenReturn(Collections.singletonList(new EncryptTableRuleConfiguration("t_encrypt", columns, false)));
+ Collection<EncryptColumnRuleConfiguration> columns = Collections.singletonList(new EncryptColumnRuleConfiguration("user_id", "user_cipher", null, null, "user_plain", "aes_encryptor"));
+ when(result.getTables()).thenReturn(Collections.singletonList(new EncryptTableRuleConfiguration("t_encrypt", columns)));
return result;
}
@@ -79,8 +79,8 @@ class EncryptRuleConfigurationCheckerTest {
EncryptRuleConfiguration result = mock(EncryptRuleConfiguration.class);
when(result.getEncryptors()).thenReturn(Collections.emptyMap());
Collection<EncryptColumnRuleConfiguration> columns =
- Collections.singletonList(new EncryptColumnRuleConfiguration("user_id", "user_cipher", "user_assisted", "", "user_plain", "aes_encryptor", "aes_assisted_encryptor", null, false));
- when(result.getTables()).thenReturn(Collections.singletonList(new EncryptTableRuleConfiguration("t_encrypt", columns, false)));
+ Collections.singletonList(new EncryptColumnRuleConfiguration("user_id", "user_cipher", "user_assisted", "", "user_plain", "aes_encryptor", "aes_assisted_encryptor", null));
+ when(result.getTables()).thenReturn(Collections.singletonList(new EncryptTableRuleConfiguration("t_encrypt", columns)));
return result;
}
@@ -96,8 +96,8 @@ class EncryptRuleConfigurationCheckerTest {
EncryptRuleConfiguration result = mock(EncryptRuleConfiguration.class);
when(result.getEncryptors()).thenReturn(Collections.emptyMap());
Collection<EncryptColumnRuleConfiguration> columns =
- Collections.singletonList(new EncryptColumnRuleConfiguration("user_id", "user_cipher", "", "user_like", "user_plain", "aes_encryptor", null, "like_cn_encryptor", false));
- when(result.getTables()).thenReturn(Collections.singletonList(new EncryptTableRuleConfiguration("t_encrypt", columns, false)));
+ Collections.singletonList(new EncryptColumnRuleConfiguration("user_id", "user_cipher", "", "user_like", "user_plain", "aes_encryptor", null, "like_cn_encryptor"));
+ when(result.getTables()).thenReturn(Collections.singletonList(new EncryptTableRuleConfiguration("t_encrypt", columns)));
return result;
}
}
diff --git a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/merge/dal/show/DecoratedEncryptShowCreateTableMergedResultTest.java b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/merge/dal/show/DecoratedEncryptShowCreateTableMergedResultTest.java
index 3f16c188723..1fdeb4f7491 100644
--- a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/merge/dal/show/DecoratedEncryptShowCreateTableMergedResultTest.java
+++ b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/merge/dal/show/DecoratedEncryptShowCreateTableMergedResultTest.java
@@ -68,7 +68,7 @@ class DecoratedEncryptShowCreateTableMergedResultTest {
"CREATE TABLE `t_encrypt` (`id` INT NOT NULL, `user_id_cipher` VARCHAR(100) NOT NULL, "
+ "`user_id` VARCHAR(100) NOT NULL, `order_id` VARCHAR(30) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;");
DecoratedEncryptShowCreateTableMergedResult actual = createDecoratedEncryptShowCreateTableMergedResult(mergedResult,
- mockEncryptRule(Collections.singletonList(new EncryptColumnRuleConfiguration("user_id", "user_id_cipher", null, "", "user_id", null, false))));
+ mockEncryptRule(Collections.singletonList(new EncryptColumnRuleConfiguration("user_id", "user_id_cipher", null, "", "user_id", null))));
assertTrue(actual.next());
assertThat(actual.getValue(2, String.class),
is("CREATE TABLE `t_encrypt` (`id` INT NOT NULL, `user_id` VARCHAR(100) NOT NULL, `order_id` VARCHAR(30) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"));
@@ -81,7 +81,7 @@ class DecoratedEncryptShowCreateTableMergedResultTest {
"CREATE TABLE `t_encrypt` (`id` INT NOT NULL, `user_id_cipher` VARCHAR(100) NOT NULL, "
+ "`user_id_assisted` VARCHAR(100) NOT NULL, `order_id` VARCHAR(30) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;");
DecoratedEncryptShowCreateTableMergedResult actual = createDecoratedEncryptShowCreateTableMergedResult(mergedResult,
- mockEncryptRule(Collections.singletonList(new EncryptColumnRuleConfiguration("user_id", "user_id_cipher", "user_id_assisted", "", null, null, false))));
+ mockEncryptRule(Collections.singletonList(new EncryptColumnRuleConfiguration("user_id", "user_id_cipher", "user_id_assisted", "", null, null))));
assertTrue(actual.next());
assertThat(actual.getValue(2, String.class),
is("CREATE TABLE `t_encrypt` (`id` INT NOT NULL, `user_id` VARCHAR(100) NOT NULL, `order_id` VARCHAR(30) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"));
@@ -94,7 +94,7 @@ class DecoratedEncryptShowCreateTableMergedResultTest {
"CREATE TABLE `t_encrypt` (`id` INT NOT NULL, `user_id_cipher` VARCHAR(100) NOT NULL, "
+ "`user_id_like` VARCHAR(100) NOT NULL, `order_id` VARCHAR(30) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;");
DecoratedEncryptShowCreateTableMergedResult actual = createDecoratedEncryptShowCreateTableMergedResult(mergedResult,
- mockEncryptRule(Collections.singletonList(new EncryptColumnRuleConfiguration("user_id", "user_id_cipher", "", "user_id_like", null, null, null, null, false))));
+ mockEncryptRule(Collections.singletonList(new EncryptColumnRuleConfiguration("user_id", "user_id_cipher", "", "user_id_like", null, null, null, null))));
assertTrue(actual.next());
assertThat(actual.getValue(2, String.class),
is("CREATE TABLE `t_encrypt` (`id` INT NOT NULL, `user_id` VARCHAR(100) NOT NULL, `order_id` VARCHAR(30) NOT NULL,"
@@ -108,7 +108,7 @@ class DecoratedEncryptShowCreateTableMergedResultTest {
"CREATE TABLE `t_encrypt` (`id` INT NOT NULL, `user_id_cipher` VARCHAR(100) NOT NULL, `user_id` VARCHAR(100) NOT NULL, "
+ "`user_id_assisted` VARCHAR(100) NOT NULL, `order_id` VARCHAR(30) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;");
DecoratedEncryptShowCreateTableMergedResult actual = createDecoratedEncryptShowCreateTableMergedResult(mergedResult,
- mockEncryptRule(Collections.singletonList(new EncryptColumnRuleConfiguration("user_id", "user_id_cipher", "user_id_assisted", "", "user_id", null, null, null, false))));
+ mockEncryptRule(Collections.singletonList(new EncryptColumnRuleConfiguration("user_id", "user_id_cipher", "user_id_assisted", "", "user_id", null, null, null))));
assertTrue(actual.next());
assertThat(actual.getValue(2, String.class),
is("CREATE TABLE `t_encrypt` (`id` INT NOT NULL, `user_id` VARCHAR(100) NOT NULL, `order_id` VARCHAR(30) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"));
@@ -121,7 +121,7 @@ class DecoratedEncryptShowCreateTableMergedResultTest {
"CREATE TABLE `t_encrypt` (`id` INT NOT NULL, `user_id_cipher` VARCHAR(100) NOT NULL, `user_id` VARCHAR(100) NOT NULL, "
+ "`user_id_like` VARCHAR(100) NOT NULL, `order_id` VARCHAR(30) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;");
DecoratedEncryptShowCreateTableMergedResult actual = createDecoratedEncryptShowCreateTableMergedResult(mergedResult,
- mockEncryptRule(Collections.singletonList(new EncryptColumnRuleConfiguration("user_id", "user_id_cipher", "", "user_id_like", "user_id", null, null, null, false))));
+ mockEncryptRule(Collections.singletonList(new EncryptColumnRuleConfiguration("user_id", "user_id_cipher", "", "user_id_like", "user_id", null, null, null))));
assertTrue(actual.next());
assertThat(actual.getValue(2, String.class),
is("CREATE TABLE `t_encrypt` (`id` INT NOT NULL, `user_id` VARCHAR(100) NOT NULL, `order_id` VARCHAR(30) NOT NULL,"
@@ -130,7 +130,7 @@ class DecoratedEncryptShowCreateTableMergedResultTest {
private EncryptRule mockEncryptRule(final Collection<EncryptColumnRuleConfiguration> encryptColumnRuleConfigurations) {
EncryptRule result = mock(EncryptRule.class);
- EncryptTable encryptTable = new EncryptTable(new EncryptTableRuleConfiguration("t_encrypt", encryptColumnRuleConfigurations, false));
+ EncryptTable encryptTable = new EncryptTable(new EncryptTableRuleConfiguration("t_encrypt", encryptColumnRuleConfigurations));
when(result.findEncryptTable("t_encrypt")).thenReturn(Optional.of(encryptTable));
return result;
}
@@ -142,8 +142,8 @@ class DecoratedEncryptShowCreateTableMergedResultTest {
"CREATE TABLE `t_encrypt` (`id` INT NOT NULL, `user_id_cipher` VARCHAR(100) NOT NULL, `user_id` VARCHAR(100) NOT NULL, `user_id_like` VARCHAR(100) NOT NULL, "
+ "`order_id_cipher` VARCHAR(30) NOT NULL, `order_id_like` VARCHAR(30) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;");
Collection<EncryptColumnRuleConfiguration> columns = new LinkedList<>();
- columns.add(new EncryptColumnRuleConfiguration("user_id", "user_id_cipher", "", "user_id_like", "user_id", null, null, null, false));
- columns.add(new EncryptColumnRuleConfiguration("order_id", "order_id_cipher", "", "order_id_like", "user_id", null, null, null, false));
+ columns.add(new EncryptColumnRuleConfiguration("user_id", "user_id_cipher", "", "user_id_like", "user_id", null, null, null));
+ columns.add(new EncryptColumnRuleConfiguration("order_id", "order_id_cipher", "", "order_id_like", "user_id", null, null, null));
DecoratedEncryptShowCreateTableMergedResult actual = createDecoratedEncryptShowCreateTableMergedResult(mergedResult, mockEncryptRule(columns));
assertTrue(actual.next());
assertThat(actual.getValue(2, String.class),
diff --git a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/merge/dal/show/MergedEncryptShowCreateTableMergedResultTest.java b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/merge/dal/show/MergedEncryptShowCreateTableMergedResultTest.java
index 631ebd0ff55..955f6741fe0 100644
--- a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/merge/dal/show/MergedEncryptShowCreateTableMergedResultTest.java
+++ b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/merge/dal/show/MergedEncryptShowCreateTableMergedResultTest.java
@@ -67,7 +67,7 @@ class MergedEncryptShowCreateTableMergedResultTest {
"CREATE TABLE `t_encrypt` (`id` INT NOT NULL, `user_id_cipher` VARCHAR(100) NOT NULL, "
+ "`user_id` VARCHAR(100) NOT NULL, `order_id` VARCHAR(30) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;");
MergedEncryptShowCreateTableMergedResult actual = createMergedEncryptShowCreateTableMergedResult(queryResult,
- mockEncryptRule(Collections.singletonList(new EncryptColumnRuleConfiguration("user_id", "user_id_cipher", null, "", "user_id", null, false))));
+ mockEncryptRule(Collections.singletonList(new EncryptColumnRuleConfiguration("user_id", "user_id_cipher", null, "", "user_id", null))));
assertTrue(actual.next());
assertThat(actual.getValue(2, String.class),
is("CREATE TABLE `t_encrypt` (`id` INT NOT NULL, `user_id` VARCHAR(100) NOT NULL, `order_id` VARCHAR(30) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"));
@@ -80,7 +80,7 @@ class MergedEncryptShowCreateTableMergedResultTest {
"CREATE TABLE `t_encrypt` (`id` INT NOT NULL, `user_id_cipher` VARCHAR(100) NOT NULL, "
+ "`user_id_assisted` VARCHAR(100) NOT NULL, `order_id` VARCHAR(30) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;");
MergedEncryptShowCreateTableMergedResult actual = createMergedEncryptShowCreateTableMergedResult(queryResult,
- mockEncryptRule(Collections.singletonList(new EncryptColumnRuleConfiguration("user_id", "user_id_cipher", "user_id_assisted", "", "", null, false))));
+ mockEncryptRule(Collections.singletonList(new EncryptColumnRuleConfiguration("user_id", "user_id_cipher", "user_id_assisted", "", "", null))));
assertTrue(actual.next());
assertThat(actual.getValue(2, String.class),
is("CREATE TABLE `t_encrypt` (`id` INT NOT NULL, `user_id` VARCHAR(100) NOT NULL, `order_id` VARCHAR(30) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"));
@@ -93,7 +93,7 @@ class MergedEncryptShowCreateTableMergedResultTest {
"CREATE TABLE `t_encrypt` (`id` INT NOT NULL, `user_id_cipher` VARCHAR(100) NOT NULL, "
+ "`user_id_like` VARCHAR(100) NOT NULL, `order_id` VARCHAR(30) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;");
MergedEncryptShowCreateTableMergedResult actual = createMergedEncryptShowCreateTableMergedResult(queryResult,
- mockEncryptRule(Collections.singletonList(new EncryptColumnRuleConfiguration("user_id", "user_id_cipher", "", "user_id_like", "", "", "", null, false))));
+ mockEncryptRule(Collections.singletonList(new EncryptColumnRuleConfiguration("user_id", "user_id_cipher", "", "user_id_like", "", "", "", null))));
assertTrue(actual.next());
assertThat(actual.getValue(2, String.class),
is("CREATE TABLE `t_encrypt` (`id` INT NOT NULL, `user_id` VARCHAR(100) NOT NULL, `order_id` VARCHAR(30) NOT NULL,"
@@ -107,7 +107,7 @@ class MergedEncryptShowCreateTableMergedResultTest {
"CREATE TABLE `t_encrypt` (`id` INT NOT NULL, `user_id_cipher` VARCHAR(100) NOT NULL, `user_id` VARCHAR(100) NOT NULL, "
+ "`user_id_assisted` VARCHAR(100) NOT NULL, `order_id` VARCHAR(30) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;");
MergedEncryptShowCreateTableMergedResult actual = createMergedEncryptShowCreateTableMergedResult(queryResult,
- mockEncryptRule(Collections.singletonList(new EncryptColumnRuleConfiguration("user_id", "user_id_cipher", "user_id_assisted", "", "user_id", null, false))));
+ mockEncryptRule(Collections.singletonList(new EncryptColumnRuleConfiguration("user_id", "user_id_cipher", "user_id_assisted", "", "user_id", null))));
assertTrue(actual.next());
assertThat(actual.getValue(2, String.class),
is("CREATE TABLE `t_encrypt` (`id` INT NOT NULL, `user_id` VARCHAR(100) NOT NULL, `order_id` VARCHAR(30) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"));
@@ -115,7 +115,7 @@ class MergedEncryptShowCreateTableMergedResultTest {
private EncryptRule mockEncryptRule(final Collection<EncryptColumnRuleConfiguration> columnRuleConfigurations) {
EncryptRule result = mock(EncryptRule.class);
- EncryptTable encryptTable = new EncryptTable(new EncryptTableRuleConfiguration("t_encrypt", columnRuleConfigurations, false));
+ EncryptTable encryptTable = new EncryptTable(new EncryptTableRuleConfiguration("t_encrypt", columnRuleConfigurations));
when(result.findEncryptTable("t_encrypt")).thenReturn(Optional.of(encryptTable));
return result;
}
diff --git a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/merge/dql/EncryptAlgorithmMetaDataTest.java b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/merge/dql/EncryptAlgorithmMetaDataTest.java
index 7837be0309b..8bf37f83ff1 100644
--- a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/merge/dql/EncryptAlgorithmMetaDataTest.java
+++ b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/merge/dql/EncryptAlgorithmMetaDataTest.java
@@ -17,9 +17,9 @@
package org.apache.shardingsphere.encrypt.merge.dql;
-import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
-import org.apache.shardingsphere.encrypt.rule.EncryptRule;
import org.apache.shardingsphere.encrypt.api.context.EncryptContext;
+import org.apache.shardingsphere.encrypt.rule.EncryptRule;
+import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
import org.apache.shardingsphere.infra.binder.segment.select.projection.ProjectionsContext;
import org.apache.shardingsphere.infra.binder.segment.select.projection.impl.ColumnProjection;
import org.apache.shardingsphere.infra.binder.segment.select.projection.impl.DerivedProjection;
@@ -135,11 +135,4 @@ class EncryptAlgorithmMetaDataTest {
assertTrue(actualEncryptor.isPresent());
assertThat(actualEncryptor.get().getType(), is("MD5"));
}
-
- @Test
- void assertIsQueryWithCipherColumn() {
- when(encryptRule.isQueryWithCipherColumn("t_order", "id")).thenReturn(true);
- EncryptAlgorithmMetaData encryptAlgorithmMetaData = new EncryptAlgorithmMetaData(database, encryptRule, selectStatementContext);
- assertTrue(encryptAlgorithmMetaData.isQueryWithCipherColumn("t_order", "id"));
- }
}
diff --git a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/merge/dql/EncryptMergedResultTest.java b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/merge/dql/EncryptMergedResultTest.java
index ddf23213b9a..755796173b0 100644
--- a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/merge/dql/EncryptMergedResultTest.java
+++ b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/merge/dql/EncryptMergedResultTest.java
@@ -17,9 +17,8 @@
package org.apache.shardingsphere.encrypt.merge.dql;
-import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
-import org.apache.shardingsphere.encrypt.context.EncryptContextBuilder;
import org.apache.shardingsphere.encrypt.api.context.EncryptContext;
+import org.apache.shardingsphere.encrypt.context.EncryptContextBuilder;
import org.apache.shardingsphere.infra.database.DefaultDatabase;
import org.apache.shardingsphere.infra.merge.result.MergedResult;
import org.junit.jupiter.api.Test;
@@ -36,7 +35,6 @@ import java.util.Optional;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -69,40 +67,6 @@ class EncryptMergedResultTest {
assertThat(new EncryptMergedResult(metaData, mergedResult).getValue(1, String.class), is("VALUE"));
}
- @Test
- void assertGetValueWithQueryWithCipherColumnAndMismatchedEncryptor() throws SQLException {
- when(mergedResult.getValue(1, String.class)).thenReturn("VALUE");
- EncryptContext encryptContext = EncryptContextBuilder.build(DefaultDatabase.LOGIC_NAME, DefaultDatabase.LOGIC_NAME, "t_encrypt", "order_id");
- when(metaData.findEncryptContext(1)).thenReturn(Optional.of(encryptContext));
- when(metaData.isQueryWithCipherColumn("t_encrypt", "order_id")).thenReturn(true);
- when(metaData.findEncryptor("t_encrypt", "order_id")).thenReturn(Optional.empty());
- assertThat(new EncryptMergedResult(metaData, mergedResult).getValue(1, String.class), is("VALUE"));
- }
-
- @SuppressWarnings("unchecked")
- @Test
- void assertGetValueWithQueryWithCipherColumnAndMatchedEncryptorWithNotNullCiphertext() throws SQLException {
- when(mergedResult.getValue(1, Object.class)).thenReturn("VALUE");
- EncryptAlgorithm<String, String> encryptAlgorithm = mock(EncryptAlgorithm.class);
- EncryptContext encryptContext = EncryptContextBuilder.build(DefaultDatabase.LOGIC_NAME, DefaultDatabase.LOGIC_NAME, "t_encrypt", "order_id");
- when(encryptAlgorithm.decrypt("VALUE", encryptContext)).thenReturn("ORIGINAL_VALUE");
- when(metaData.findEncryptContext(1)).thenReturn(Optional.of(encryptContext));
- when(metaData.isQueryWithCipherColumn("t_encrypt", "order_id")).thenReturn(true);
- when(metaData.findEncryptor("t_encrypt", "order_id")).thenReturn(Optional.of(encryptAlgorithm));
- assertThat(new EncryptMergedResult(metaData, mergedResult).getValue(1, String.class), is("ORIGINAL_VALUE"));
- }
-
- @SuppressWarnings("unchecked")
- @Test
- void assertGetValueWithQueryWithCipherColumnAndMatchedEncryptorWithNullCiphertext() throws SQLException {
- EncryptAlgorithm<String, String> encryptAlgorithm = mock(EncryptAlgorithm.class);
- EncryptContext encryptContext = EncryptContextBuilder.build(DefaultDatabase.LOGIC_NAME, DefaultDatabase.LOGIC_NAME, "t_encrypt", "order_id");
- when(metaData.findEncryptContext(1)).thenReturn(Optional.of(encryptContext));
- when(metaData.isQueryWithCipherColumn("t_encrypt", "order_id")).thenReturn(true);
- when(metaData.findEncryptor("t_encrypt", "order_id")).thenReturn(Optional.of(encryptAlgorithm));
- assertNull(new EncryptMergedResult(metaData, mergedResult).getValue(1, String.class));
- }
-
@Test
void assertGetCalendarValue() throws SQLException {
Calendar calendar = Calendar.getInstance();
diff --git a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/impl/EncryptAlterTableTokenGeneratorTest.java b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/impl/EncryptAlterTableTokenGeneratorTest.java
index 45f6eb54e60..d9e0b5bc9ff 100644
--- a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/impl/EncryptAlterTableTokenGeneratorTest.java
+++ b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/impl/EncryptAlterTableTokenGeneratorTest.java
@@ -17,12 +17,12 @@
package org.apache.shardingsphere.encrypt.rewrite.impl;
-import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
import org.apache.shardingsphere.encrypt.rewrite.token.generator.EncryptAlterTableTokenGenerator;
import org.apache.shardingsphere.encrypt.rewrite.token.pojo.EncryptAlterTableToken;
import org.apache.shardingsphere.encrypt.rule.EncryptColumn;
import org.apache.shardingsphere.encrypt.rule.EncryptRule;
import org.apache.shardingsphere.encrypt.rule.EncryptTable;
+import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
import org.apache.shardingsphere.infra.binder.statement.ddl.AlterTableStatementContext;
import org.apache.shardingsphere.infra.rewrite.sql.token.pojo.SQLToken;
import org.apache.shardingsphere.infra.rewrite.sql.token.pojo.generic.RemoveToken;
@@ -77,11 +77,11 @@ class EncryptAlterTableTokenGeneratorTest {
}
private EncryptColumn mockEncryptColumn() {
- return new EncryptColumn("cipher_certificate_number", "assisted_certificate_number", "like_certificate_number", "certificate_number_plain", "test", null);
+ return new EncryptColumn("cipher_certificate_number", "assisted_certificate_number", "like_certificate_number", "certificate_number_plain", "test");
}
private EncryptColumn mockNewEncryptColumn() {
- return new EncryptColumn("cipher_certificate_number_new", "assisted_certificate_number_new", "like_certificate_number_new", "certificate_number_new_plain", "test", null);
+ return new EncryptColumn("cipher_certificate_number_new", "assisted_certificate_number_new", "like_certificate_number_new", "certificate_number_new_plain", "test");
}
@Test
diff --git a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/impl/EncryptCreateTableTokenGeneratorTest.java b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/impl/EncryptCreateTableTokenGeneratorTest.java
index 001e4f450e3..84c33a308e1 100644
--- a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/impl/EncryptCreateTableTokenGeneratorTest.java
+++ b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/impl/EncryptCreateTableTokenGeneratorTest.java
@@ -17,11 +17,11 @@
package org.apache.shardingsphere.encrypt.rewrite.impl;
-import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
import org.apache.shardingsphere.encrypt.rewrite.token.generator.EncryptCreateTableTokenGenerator;
import org.apache.shardingsphere.encrypt.rule.EncryptColumn;
import org.apache.shardingsphere.encrypt.rule.EncryptRule;
import org.apache.shardingsphere.encrypt.rule.EncryptTable;
+import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
import org.apache.shardingsphere.infra.binder.statement.ddl.CreateTableStatementContext;
import org.apache.shardingsphere.infra.rewrite.sql.token.pojo.SQLToken;
import org.apache.shardingsphere.infra.rewrite.sql.token.pojo.generic.RemoveToken;
@@ -105,6 +105,6 @@ class EncryptCreateTableTokenGeneratorTest {
}
private EncryptColumn mockEncryptColumn() {
- return new EncryptColumn("cipher_certificate_number", "assisted_certificate_number", "like_certificate_number", "certificate_number_plain", "test", null);
+ return new EncryptColumn("cipher_certificate_number", "assisted_certificate_number", "like_certificate_number", "certificate_number_plain", "test");
}
}
diff --git a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/impl/EncryptProjectionTokenGeneratorTest.java b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/impl/EncryptProjectionTokenGeneratorTest.java
index d264320ef77..f5a5c937091 100644
--- a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/impl/EncryptProjectionTokenGeneratorTest.java
+++ b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/impl/EncryptProjectionTokenGeneratorTest.java
@@ -71,7 +71,7 @@ class EncryptProjectionTokenGeneratorTest {
when(result.findPlainColumn("doctor1", "mobile")).thenReturn(Optional.of("Mobile"));
when(result.findEncryptTable("doctor")).thenReturn(Optional.of(encryptTable1));
when(result.findEncryptTable("doctor1")).thenReturn(Optional.of(encryptTable2));
- EncryptColumn column = new EncryptColumn("mobile", null, null, "mobile", null, null);
+ EncryptColumn column = new EncryptColumn("mobile", null, null, "mobile", null);
when(result.findEncryptColumn("doctor", "mobile")).thenReturn(Optional.of(column));
return result;
}
diff --git a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptPredicateColumnTokenGeneratorTest.java b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptPredicateColumnTokenGeneratorTest.java
index 13635150093..a7cce7de49d 100644
--- a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptPredicateColumnTokenGeneratorTest.java
+++ b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptPredicateColumnTokenGeneratorTest.java
@@ -52,6 +52,6 @@ class EncryptPredicateColumnTokenGeneratorTest {
generator.setSchemas(Collections.emptyMap());
Collection<SubstitutableColumnNameToken> substitutableColumnNameTokens = generator.generateSQLTokens(EncryptGeneratorFixtureBuilder.createUpdateStatementContext());
assertThat(substitutableColumnNameTokens.size(), is(1));
- assertThat(substitutableColumnNameTokens.iterator().next().toString(null), is("pwd_plain"));
+ assertThat(substitutableColumnNameTokens.iterator().next().toString(null), is("pwd_assist"));
}
}
diff --git a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptPredicateRightValueTokenGeneratorTest.java b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptPredicateRightValueTokenGeneratorTest.java
index 6c65c08faa7..5ce467f137e 100644
--- a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptPredicateRightValueTokenGeneratorTest.java
+++ b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptPredicateRightValueTokenGeneratorTest.java
@@ -57,7 +57,7 @@ class EncryptPredicateRightValueTokenGeneratorTest {
generator.setEncryptConditions(getEncryptConditions(updateStatementContext));
Collection<SQLToken> sqlTokens = generator.generateSQLTokens(updateStatementContext);
assertThat(sqlTokens.size(), is(1));
- assertThat(sqlTokens.iterator().next().toString(), is("'123456'"));
+ assertThat(sqlTokens.iterator().next().toString(), is("'assistedEncryptValue'"));
}
private Collection<EncryptCondition> getEncryptConditions(final UpdateStatementContext updateStatementContext) {
diff --git a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/fixture/EncryptGeneratorFixtureBuilder.java b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/fixture/EncryptGeneratorFixtureBuilder.java
index 4d8c5c9065b..984d5233643 100644
--- a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/fixture/EncryptGeneratorFixtureBuilder.java
+++ b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/fixture/EncryptGeneratorFixtureBuilder.java
@@ -76,11 +76,11 @@ public final class EncryptGeneratorFixtureBuilder {
*/
public static EncryptRule createEncryptRule() {
EncryptColumnRuleConfiguration pwdColumnConfig =
- new EncryptColumnRuleConfiguration("pwd", "pwd_cipher", "pwd_assist", "pwd_like", "pwd_plain", "test_encryptor", "test_encryptor", "like_encryptor", false);
+ new EncryptColumnRuleConfiguration("pwd", "pwd_cipher", "pwd_assist", "pwd_like", "pwd_plain", "test_encryptor", "test_encryptor", "like_encryptor");
Map<String, AlgorithmConfiguration> encryptors = Collections.singletonMap("test_encryptor", new AlgorithmConfiguration("CORE.QUERY_ASSISTED.FIXTURE", new Properties()));
Map<String, AlgorithmConfiguration> likeEncryptors = Collections.singletonMap("like_encryptor", new AlgorithmConfiguration("CORE.QUERY_LIKE.FIXTURE", new Properties()));
return new EncryptRule(
- new EncryptRuleConfiguration(Collections.singleton(new EncryptTableRuleConfiguration("t_user", Collections.singletonList(pwdColumnConfig), null)), encryptors, likeEncryptors));
+ new EncryptRuleConfiguration(Collections.singleton(new EncryptTableRuleConfiguration("t_user", Collections.singletonList(pwdColumnConfig))), encryptors, likeEncryptors));
}
/**
diff --git a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptColumnTest.java b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptColumnTest.java
index 5af0e46242d..3aa7b0c8ffa 100644
--- a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptColumnTest.java
+++ b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptColumnTest.java
@@ -25,16 +25,16 @@ class EncryptColumnTest {
@Test
void assertGetAssistedQueryColumn() {
- assertTrue(new EncryptColumn("cipherColumn", "assistedQueryColumn", "likeQueryColumn", "plainColumn", "encryptorName", null).getAssistedQueryColumn().isPresent());
+ assertTrue(new EncryptColumn("cipherColumn", "assistedQueryColumn", "likeQueryColumn", "plainColumn", "encryptorName").getAssistedQueryColumn().isPresent());
}
@Test
void assertGetLikeQueryColumn() {
- assertTrue(new EncryptColumn("cipherColumn", "assistedQueryColumn", "likeQueryColumn", "plainColumn", "encryptorName", null).getLikeQueryColumn().isPresent());
+ assertTrue(new EncryptColumn("cipherColumn", "assistedQueryColumn", "likeQueryColumn", "plainColumn", "encryptorName").getLikeQueryColumn().isPresent());
}
@Test
void assertGetPlainColumn() {
- assertTrue(new EncryptColumn("cipherColumn", "assistedQueryColumn", "likeQueryColumn", "plainColumn", "encryptorName", null).getPlainColumn().isPresent());
+ assertTrue(new EncryptColumn("cipherColumn", "assistedQueryColumn", "likeQueryColumn", "plainColumn", "encryptorName").getPlainColumn().isPresent());
}
}
diff --git a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptRuleTest.java b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptRuleTest.java
index 03d12a34df4..25efc8da98e 100644
--- a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptRuleTest.java
+++ b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptRuleTest.java
@@ -141,32 +141,32 @@ class EncryptRuleTest {
AlgorithmConfiguration queryAssistedEncryptConfig = new AlgorithmConfiguration("CORE.QUERY_ASSISTED.FIXTURE", new Properties());
AlgorithmConfiguration queryLikeEncryptConfig = new AlgorithmConfiguration("CORE.QUERY_LIKE.FIXTURE", new Properties());
EncryptColumnRuleConfiguration pwdColumnConfig =
- new EncryptColumnRuleConfiguration("pwd", "pwd_cipher", "pwd_assist", "pwd_like", "pwd_plain", "test_encryptor", "test_encryptor", "like_encryptor", null);
- EncryptColumnRuleConfiguration creditCardColumnConfig = new EncryptColumnRuleConfiguration("credit_card", "credit_card_cipher", "", "", "credit_card_plain", "test_encryptor", null);
- EncryptTableRuleConfiguration tableConfig = new EncryptTableRuleConfiguration("t_encrypt", Arrays.asList(pwdColumnConfig, creditCardColumnConfig), null);
+ new EncryptColumnRuleConfiguration("pwd", "pwd_cipher", "pwd_assist", "pwd_like", "pwd_plain", "test_encryptor", "test_encryptor", "like_encryptor");
+ EncryptColumnRuleConfiguration creditCardColumnConfig = new EncryptColumnRuleConfiguration("credit_card", "credit_card_cipher", "", "", "credit_card_plain", "test_encryptor");
+ EncryptTableRuleConfiguration tableConfig = new EncryptTableRuleConfiguration("t_encrypt", Arrays.asList(pwdColumnConfig, creditCardColumnConfig));
return new EncryptRuleConfiguration(Collections.singleton(tableConfig), getEncryptors(queryAssistedEncryptConfig), getLikeEncryptors(queryLikeEncryptConfig));
}
@Test
void assertAssistedQueryEncryptorNameSpecified() {
EncryptColumnRuleConfiguration pwdColumnConfig =
- new EncryptColumnRuleConfiguration("pwd", "pwd_cipher", "pwd_assist", "", "pwd_plain", "test_encryptor", "assisted_query_test_encryptor", null, null);
+ new EncryptColumnRuleConfiguration("pwd", "pwd_cipher", "pwd_assist", "", "pwd_plain", "test_encryptor", "assisted_query_test_encryptor", null);
assertThat(pwdColumnConfig.getAssistedQueryEncryptorName(), is("assisted_query_test_encryptor"));
}
@Test
void assertLikeQueryEncryptorNameSpecified() {
EncryptColumnRuleConfiguration pwdColumnConfig =
- new EncryptColumnRuleConfiguration("pwd", "pwd_cipher", "", "pwd_like", "pwd_plain", "test_encryptor", "", "like_query_test_encryptor", null);
+ new EncryptColumnRuleConfiguration("pwd", "pwd_cipher", "", "pwd_like", "pwd_plain", "test_encryptor", "", "like_query_test_encryptor");
assertThat(pwdColumnConfig.getLikeQueryEncryptorName(), is("like_query_test_encryptor"));
}
private EncryptRuleConfiguration createEncryptRuleConfigurationWithUpperCaseLogicTable() {
AlgorithmConfiguration queryAssistedEncryptConfig = new AlgorithmConfiguration("CORE.QUERY_ASSISTED.FIXTURE", new Properties());
AlgorithmConfiguration queryLikeEncryptConfig = new AlgorithmConfiguration("CORE.QUERY_LIKE.FIXTURE", new Properties());
- EncryptColumnRuleConfiguration pwdColumnConfig = new EncryptColumnRuleConfiguration("pwd", "pwd_cipher", "", "", "pwd_plain", "test_encryptor", null);
- EncryptColumnRuleConfiguration creditCardColumnConfig = new EncryptColumnRuleConfiguration("credit_card", "credit_card_cipher", "", "", "credit_card_plain", "test_encryptor", null);
- EncryptTableRuleConfiguration tableConfig = new EncryptTableRuleConfiguration("T_ENCRYPT", Arrays.asList(pwdColumnConfig, creditCardColumnConfig), null);
+ EncryptColumnRuleConfiguration pwdColumnConfig = new EncryptColumnRuleConfiguration("pwd", "pwd_cipher", "", "", "pwd_plain", "test_encryptor");
+ EncryptColumnRuleConfiguration creditCardColumnConfig = new EncryptColumnRuleConfiguration("credit_card", "credit_card_cipher", "", "", "credit_card_plain", "test_encryptor");
+ EncryptTableRuleConfiguration tableConfig = new EncryptTableRuleConfiguration("T_ENCRYPT", Arrays.asList(pwdColumnConfig, creditCardColumnConfig));
return new EncryptRuleConfiguration(Collections.singleton(tableConfig), getEncryptors(queryAssistedEncryptConfig), getLikeEncryptors(queryLikeEncryptConfig));
}
diff --git a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptTableTest.java b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptTableTest.java
index 7f1f853822e..5197bb09cc1 100644
--- a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptTableTest.java
+++ b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rule/EncryptTableTest.java
@@ -40,7 +40,7 @@ class EncryptTableTest {
@BeforeEach
void setUp() {
encryptTable = new EncryptTable(new EncryptTableRuleConfiguration("t_encrypt",
- Collections.singleton(new EncryptColumnRuleConfiguration("logicColumn", "cipherColumn", "assistedQueryColumn", "likeQueryColumn", "plainColumn", "myEncryptor", null)), null));
+ Collections.singleton(new EncryptColumnRuleConfiguration("logicColumn", "cipherColumn", "assistedQueryColumn", "likeQueryColumn", "plainColumn", "myEncryptor"))));
}
@Test
@@ -144,22 +144,4 @@ class EncryptTableTest {
assertThat(encryptTable.getLogicAndCipherColumns(), is(Collections.singletonMap("logicColumn", "cipherColumn")));
assertTrue(encryptTable.getLogicAndCipherColumns().containsKey("LOGICCOLUMN"));
}
-
- @Test
- void assertGetQueryWithCipherColumn() {
- Optional<Boolean> actual = encryptTable.getQueryWithCipherColumn("logicColumn");
- assertFalse(actual.isPresent());
-
- encryptTable = new EncryptTable(new EncryptTableRuleConfiguration("t_encrypt",
- Collections.singleton(new EncryptColumnRuleConfiguration("logicColumn", "cipherColumn", "assistedQueryColumn", "likeQueryColumn", "plainColumn", "myEncryptor", null)), true));
- actual = encryptTable.getQueryWithCipherColumn("logicColumn");
- assertTrue(actual.isPresent());
- assertTrue(actual.get());
-
- encryptTable = new EncryptTable(new EncryptTableRuleConfiguration("t_encrypt",
- Collections.singleton(new EncryptColumnRuleConfiguration("logicColumn", "cipherColumn", "assistedQueryColumn", "likeQueryColumn", "plainColumn", "myEncryptor", false)), true));
- actual = encryptTable.getQueryWithCipherColumn("logicColumn");
- assertTrue(actual.isPresent());
- assertFalse(actual.get());
- }
}
diff --git a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/yaml/EncryptRuleConfigurationYamlIT.java b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/yaml/EncryptRuleConfigurationYamlIT.java
index c8725e5fe5d..7d3b8cf7623 100644
--- a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/yaml/EncryptRuleConfigurationYamlIT.java
+++ b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/yaml/EncryptRuleConfigurationYamlIT.java
@@ -23,7 +23,6 @@ import org.apache.shardingsphere.test.it.yaml.YamlRuleConfigurationIT;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.jupiter.api.Assertions.assertTrue;
class EncryptRuleConfigurationYamlIT extends YamlRuleConfigurationIT {
@@ -38,7 +37,6 @@ class EncryptRuleConfigurationYamlIT extends YamlRuleConfigurationIT {
private void assertEncryptRule(final YamlEncryptRuleConfiguration actual) {
assertColumns(actual);
- assertQueryColumn(actual);
assertEncryptAlgorithm(actual);
assertLikeEncryptAlgorithm(actual);
}
@@ -55,10 +53,6 @@ class EncryptRuleConfigurationYamlIT extends YamlRuleConfigurationIT {
assertThat(actual.getTables().get("t_user").getColumns().get("username").getLikeQueryEncryptorName(), is("like_encryptor"));
}
- private void assertQueryColumn(final YamlEncryptRuleConfiguration actual) {
- assertTrue(actual.isQueryWithCipherColumn());
- }
-
private void assertEncryptAlgorithm(final YamlEncryptRuleConfiguration actual) {
assertThat(actual.getEncryptors().size(), is(2));
assertThat(actual.getEncryptors().get("username_encryptor").getType(), is("AES"));
diff --git a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/yaml/swapper/YamlEncryptRuleConfigurationSwapperTest.java b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/yaml/swapper/YamlEncryptRuleConfigurationSwapperTest.java
index 88e303e5b25..35551fd70d5 100644
--- a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/yaml/swapper/YamlEncryptRuleConfigurationSwapperTest.java
+++ b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/yaml/swapper/YamlEncryptRuleConfigurationSwapperTest.java
@@ -46,7 +46,7 @@ class YamlEncryptRuleConfigurationSwapperTest {
}
private EncryptRuleConfiguration createEncryptRuleConfiguration() {
- Collection<EncryptTableRuleConfiguration> tables = Collections.singletonList(new EncryptTableRuleConfiguration("tbl", Collections.emptyList(), null));
+ Collection<EncryptTableRuleConfiguration> tables = Collections.singletonList(new EncryptTableRuleConfiguration("tbl", Collections.emptyList()));
Map<String, AlgorithmConfiguration> encryptors = Collections.singletonMap("myEncryptor", new AlgorithmConfiguration("FIXTURE", new Properties()));
return new EncryptRuleConfiguration(tables, encryptors);
}
diff --git a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/yaml/swapper/rule/YamlEncryptColumnRuleConfigurationSwapperTest.java b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/yaml/swapper/rule/YamlEncryptColumnRuleConfigurationSwapperTest.java
index 10a8e732c5a..8c9b31f64b9 100644
--- a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/yaml/swapper/rule/YamlEncryptColumnRuleConfigurationSwapperTest.java
+++ b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/yaml/swapper/rule/YamlEncryptColumnRuleConfigurationSwapperTest.java
@@ -30,7 +30,7 @@ class YamlEncryptColumnRuleConfigurationSwapperTest {
void assertSwapToYamlConfiguration() {
YamlEncryptColumnRuleConfigurationSwapper swapper = new YamlEncryptColumnRuleConfigurationSwapper();
EncryptColumnRuleConfiguration encryptColumnRuleConfig =
- new EncryptColumnRuleConfiguration("logicColumn", "cipherColumn", "assistedQueryColumn", "likeQueryColumn", "plainColumn", "encryptorName", true);
+ new EncryptColumnRuleConfiguration("logicColumn", "cipherColumn", "assistedQueryColumn", "likeQueryColumn", "plainColumn", "encryptorName");
YamlEncryptColumnRuleConfiguration actual = swapper.swapToYamlConfiguration(encryptColumnRuleConfig);
assertThat(actual.getLogicColumn(), is("logicColumn"));
assertThat(actual.getCipherColumn(), is("cipherColumn"));
@@ -38,7 +38,6 @@ class YamlEncryptColumnRuleConfigurationSwapperTest {
assertThat(actual.getLikeQueryColumn(), is("likeQueryColumn"));
assertThat(actual.getPlainColumn(), is("plainColumn"));
assertThat(actual.getEncryptorName(), is("encryptorName"));
- assertThat(actual.getQueryWithCipherColumn(), is(true));
}
@Test
@@ -51,7 +50,6 @@ class YamlEncryptColumnRuleConfigurationSwapperTest {
yamlEncryptColumnRuleConfig.setLikeQueryColumn("likeQueryColumn");
yamlEncryptColumnRuleConfig.setPlainColumn("plainColumn");
yamlEncryptColumnRuleConfig.setEncryptorName("encryptorName");
- yamlEncryptColumnRuleConfig.setQueryWithCipherColumn(true);
EncryptColumnRuleConfiguration actual = swapper.swapToObject(yamlEncryptColumnRuleConfig);
assertThat(actual.getLogicColumn(), is("logicColumn"));
assertThat(actual.getCipherColumn(), is("cipherColumn"));
@@ -59,6 +57,5 @@ class YamlEncryptColumnRuleConfigurationSwapperTest {
assertThat(actual.getLikeQueryColumn(), is("likeQueryColumn"));
assertThat(actual.getPlainColumn(), is("plainColumn"));
assertThat(actual.getEncryptorName(), is("encryptorName"));
- assertThat(actual.getQueryWithCipherColumn(), is(true));
}
}
diff --git a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/yaml/swapper/rule/YamlEncryptTableRuleConfigurationSwapperTest.java b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/yaml/swapper/rule/YamlEncryptTableRuleConfigurationSwapperTest.java
index 6e6e828b784..9d9e6ee0040 100644
--- a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/yaml/swapper/rule/YamlEncryptTableRuleConfigurationSwapperTest.java
+++ b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/yaml/swapper/rule/YamlEncryptTableRuleConfigurationSwapperTest.java
@@ -29,10 +29,7 @@ import java.util.LinkedHashMap;
import java.util.Map;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertNull;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.jupiter.api.Assertions.assertTrue;
class YamlEncryptTableRuleConfigurationSwapperTest {
@@ -41,27 +38,23 @@ class YamlEncryptTableRuleConfigurationSwapperTest {
@Test
void assertSwapToYamlConfiguration() {
Collection<EncryptColumnRuleConfiguration> encryptColumnRuleConfigs = Arrays.asList(
- new EncryptColumnRuleConfiguration("encrypt_column_1", "encrypt_cipher_1", "", "", "", "test_encryptor_1", null),
- new EncryptColumnRuleConfiguration("encrypt_column_2", "encrypt_cipher_2", "", "", "", "test_encryptor_2", true),
- new EncryptColumnRuleConfiguration("encrypt_column_3", "encrypt_cipher_3", "", "", "", "test_encryptor_3", false));
- EncryptTableRuleConfiguration encryptTableRuleConfig = new EncryptTableRuleConfiguration("test_table", encryptColumnRuleConfigs, true);
+ new EncryptColumnRuleConfiguration("encrypt_column_1", "encrypt_cipher_1", "", "", "", "test_encryptor_1"),
+ new EncryptColumnRuleConfiguration("encrypt_column_2", "encrypt_cipher_2", "", "", "", "test_encryptor_2"),
+ new EncryptColumnRuleConfiguration("encrypt_column_3", "encrypt_cipher_3", "", "", "", "test_encryptor_3"));
+ EncryptTableRuleConfiguration encryptTableRuleConfig = new EncryptTableRuleConfiguration("test_table", encryptColumnRuleConfigs);
YamlEncryptTableRuleConfiguration actualYamlEncryptTableRuleConfig = swapper.swapToYamlConfiguration(encryptTableRuleConfig);
assertThat(actualYamlEncryptTableRuleConfig.getName(), is("test_table"));
- assertTrue(actualYamlEncryptTableRuleConfig.getQueryWithCipherColumn());
Map<String, YamlEncryptColumnRuleConfiguration> actualColumns = actualYamlEncryptTableRuleConfig.getColumns();
assertThat(actualColumns.size(), is(3));
YamlEncryptColumnRuleConfiguration actualYamlEncryptColumnRuleConfigFirst = actualColumns.get("encrypt_column_1");
assertThat(actualYamlEncryptColumnRuleConfigFirst.getCipherColumn(), is("encrypt_cipher_1"));
assertThat(actualYamlEncryptColumnRuleConfigFirst.getEncryptorName(), is("test_encryptor_1"));
- assertNull(actualYamlEncryptColumnRuleConfigFirst.getQueryWithCipherColumn());
YamlEncryptColumnRuleConfiguration actualYamlEncryptColumnRuleConfigSecond = actualColumns.get("encrypt_column_2");
assertThat(actualYamlEncryptColumnRuleConfigSecond.getCipherColumn(), is("encrypt_cipher_2"));
assertThat(actualYamlEncryptColumnRuleConfigSecond.getEncryptorName(), is("test_encryptor_2"));
- assertTrue(actualYamlEncryptColumnRuleConfigSecond.getQueryWithCipherColumn());
YamlEncryptColumnRuleConfiguration actualYamlEncryptColumnRuleConfigThird = actualColumns.get("encrypt_column_3");
assertThat(actualYamlEncryptColumnRuleConfigThird.getCipherColumn(), is("encrypt_cipher_3"));
assertThat(actualYamlEncryptColumnRuleConfigThird.getEncryptorName(), is("test_encryptor_3"));
- assertFalse(actualYamlEncryptColumnRuleConfigThird.getQueryWithCipherColumn());
}
@Test
@@ -73,16 +66,13 @@ class YamlEncryptTableRuleConfigurationSwapperTest {
encryptColumnRuleConfig.setLikeQueryColumn("encrypt_like");
encryptColumnRuleConfig.setPlainColumn("encrypt_plain");
encryptColumnRuleConfig.setEncryptorName("test_encryptor");
- encryptColumnRuleConfig.setQueryWithCipherColumn(true);
Map<String, YamlEncryptColumnRuleConfiguration> columns = new LinkedHashMap<>(1);
columns.put("test_column", encryptColumnRuleConfig);
YamlEncryptTableRuleConfiguration yamlEncryptTableRuleConfig = new YamlEncryptTableRuleConfiguration();
yamlEncryptTableRuleConfig.setName("test_table");
yamlEncryptTableRuleConfig.setColumns(columns);
- yamlEncryptTableRuleConfig.setQueryWithCipherColumn(true);
EncryptTableRuleConfiguration actualEncryptTableRuleConfig = swapper.swapToObject(yamlEncryptTableRuleConfig);
assertThat(actualEncryptTableRuleConfig.getName(), is("test_table"));
- assertTrue(actualEncryptTableRuleConfig.getQueryWithCipherColumn());
Collection<EncryptColumnRuleConfiguration> actualColumns = actualEncryptTableRuleConfig.getColumns();
assertThat(actualColumns.size(), is(1));
EncryptColumnRuleConfiguration actualEncryptColumnRuleConfig = actualColumns.iterator().next();
@@ -92,6 +82,5 @@ class YamlEncryptTableRuleConfigurationSwapperTest {
assertThat(actualEncryptColumnRuleConfig.getLikeQueryColumn(), is("encrypt_like"));
assertThat(actualEncryptColumnRuleConfig.getPlainColumn(), is("encrypt_plain"));
assertThat(actualEncryptColumnRuleConfig.getEncryptorName(), is("test_encryptor"));
- assertTrue(actualEncryptColumnRuleConfig.getQueryWithCipherColumn());
}
}
diff --git a/features/encrypt/core/src/test/resources/yaml/encrypt-rule.yaml b/features/encrypt/core/src/test/resources/yaml/encrypt-rule.yaml
index d1e71c14256..38346b46b97 100644
--- a/features/encrypt/core/src/test/resources/yaml/encrypt-rule.yaml
+++ b/features/encrypt/core/src/test/resources/yaml/encrypt-rule.yaml
@@ -28,7 +28,6 @@ rules:
assistedQueryEncryptorName: assisted_encryptor
likeQueryColumn: like_query_username
likeQueryEncryptorName: like_encryptor
- queryWithCipherColumn: true
encryptors:
username_encryptor:
type: AES
diff --git a/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/converter/EncryptRuleStatementConverter.java b/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/converter/EncryptRuleStatementConverter.java
index 8afd691a82b..391d938c26f 100644
--- a/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/converter/EncryptRuleStatementConverter.java
+++ b/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/converter/EncryptRuleStatementConverter.java
@@ -60,7 +60,7 @@ public final class EncryptRuleStatementConverter {
for (EncryptColumnSegment each : ruleSegment.getColumns()) {
columns.add(createEncryptColumnRuleConfiguration(ruleSegment.getTableName(), each));
}
- return new EncryptTableRuleConfiguration(ruleSegment.getTableName(), columns, ruleSegment.getQueryWithCipherColumn());
+ return new EncryptTableRuleConfiguration(ruleSegment.getTableName(), columns);
}
private static EncryptColumnRuleConfiguration createEncryptColumnRuleConfiguration(final String tableName, final EncryptColumnSegment columnSegment) {
@@ -68,7 +68,7 @@ public final class EncryptRuleStatementConverter {
String likeQueryEncryptorName = null == columnSegment.getLikeQueryEncryptor() ? null : getLikeQueryEncryptorName(tableName, columnSegment.getName());
return new EncryptColumnRuleConfiguration(columnSegment.getName(), columnSegment.getCipherColumn(), columnSegment.getAssistedQueryColumn(),
columnSegment.getLikeQueryColumn(), columnSegment.getPlainColumn(), getEncryptorName(tableName, columnSegment.getName()),
- assistedQueryEncryptorName, likeQueryEncryptorName, columnSegment.getQueryWithCipherColumn());
+ assistedQueryEncryptorName, likeQueryEncryptorName);
}
private static Map<String, AlgorithmConfiguration> createEncryptorConfigurations(final EncryptRuleSegment ruleSegment) {
diff --git a/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/query/ShowEncryptRuleExecutor.java b/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/query/ShowEncryptRuleExecutor.java
index eb46a48a28a..c7a16e678b3 100644
--- a/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/query/ShowEncryptRuleExecutor.java
+++ b/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/query/ShowEncryptRuleExecutor.java
@@ -53,13 +53,12 @@ public final class ShowEncryptRuleExecutor implements RQLExecutor<ShowEncryptRul
private Collection<LocalDataQueryResultRow> buildData(final EncryptRuleConfiguration ruleConfig, final ShowEncryptRulesStatement sqlStatement) {
return ruleConfig.getTables().stream().filter(each -> Objects.isNull(sqlStatement.getTableName()) || each.getName().equals(sqlStatement.getTableName()))
- .map(each -> buildColumnData(each, ruleConfig.getEncryptors(),
- ruleConfig.getLikeEncryptors(), ruleConfig.isQueryWithCipherColumn()))
+ .map(each -> buildColumnData(each, ruleConfig.getEncryptors(), ruleConfig.getLikeEncryptors()))
.flatMap(Collection::stream).collect(Collectors.toList());
}
private Collection<LocalDataQueryResultRow> buildColumnData(final EncryptTableRuleConfiguration tableRuleConfig, final Map<String, AlgorithmConfiguration> encryptors,
- final Map<String, AlgorithmConfiguration> likeEncryptors, final boolean queryWithCipherColumn) {
+ final Map<String, AlgorithmConfiguration> likeEncryptors) {
Collection<LocalDataQueryResultRow> result = new LinkedList<>();
for (EncryptColumnRuleConfiguration each : tableRuleConfig.getColumns()) {
AlgorithmConfiguration encryptorAlgorithmConfig = encryptors.get(each.getEncryptorName());
@@ -77,8 +76,7 @@ public final class ShowEncryptRuleExecutor implements RQLExecutor<ShowEncryptRul
Objects.isNull(assistedQueryEncryptorAlgorithmConfig) ? nullToEmptyString(null) : assistedQueryEncryptorAlgorithmConfig.getType(),
Objects.isNull(assistedQueryEncryptorAlgorithmConfig) ? nullToEmptyString(null) : PropertiesConverter.convert(assistedQueryEncryptorAlgorithmConfig.getProps()),
Objects.isNull(likeQueryEncryptorAlgorithmConfig) ? nullToEmptyString(null) : likeQueryEncryptorAlgorithmConfig.getType(),
- Objects.isNull(likeQueryEncryptorAlgorithmConfig) ? nullToEmptyString(null) : PropertiesConverter.convert(likeQueryEncryptorAlgorithmConfig.getProps()),
- isQueryWithCipherColumn(queryWithCipherColumn, tableRuleConfig, each).toString())));
+ Objects.isNull(likeQueryEncryptorAlgorithmConfig) ? nullToEmptyString(null) : PropertiesConverter.convert(likeQueryEncryptorAlgorithmConfig.getProps()))));
}
return result;
}
@@ -87,21 +85,11 @@ public final class ShowEncryptRuleExecutor implements RQLExecutor<ShowEncryptRul
return null == obj ? "" : obj;
}
- private Boolean isQueryWithCipherColumn(final boolean queryWithCipherColumn, final EncryptTableRuleConfiguration tableRuleConfig, final EncryptColumnRuleConfiguration columnRuleConfig) {
- if (Objects.nonNull(columnRuleConfig.getQueryWithCipherColumn())) {
- return columnRuleConfig.getQueryWithCipherColumn();
- }
- if (Objects.nonNull(tableRuleConfig.getQueryWithCipherColumn())) {
- return tableRuleConfig.getQueryWithCipherColumn();
- }
- return queryWithCipherColumn;
- }
-
@Override
public Collection<String> getColumnNames() {
return Arrays.asList("table", "logic_column", "cipher_column", "plain_column",
"assisted_query_column", "like_query_column", "encryptor_type", "encryptor_props",
- "assisted_query_type", "assisted_query_props", "like_query_type", "like_query_props", "query_with_cipher_column");
+ "assisted_query_type", "assisted_query_props", "like_query_type", "like_query_props");
}
@Override
diff --git a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/converter/EncryptRuleStatementConverterTest.java b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/converter/EncryptRuleStatementConverterTest.java
index 79f5c642379..52fad93f861 100644
--- a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/converter/EncryptRuleStatementConverterTest.java
+++ b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/converter/EncryptRuleStatementConverterTest.java
@@ -35,7 +35,7 @@ class EncryptRuleStatementConverterTest {
@Test
void assertCovert() {
- EncryptRuleConfiguration actual = EncryptRuleStatementConverter.convert(Collections.singleton(new EncryptRuleSegment("t_encrypt", createColumns(), null)));
+ EncryptRuleConfiguration actual = EncryptRuleStatementConverter.convert(Collections.singleton(new EncryptRuleSegment("t_encrypt", createColumns())));
assertThat(actual.getTables().iterator().next().getName(), is("t_encrypt"));
assertThat(actual.getTables().iterator().next().getColumns().iterator().next().getLogicColumn(), is("user_id"));
assertThat(actual.getTables().iterator().next().getColumns().iterator().next().getCipherColumn(), is("user_cipher"));
@@ -48,6 +48,6 @@ class EncryptRuleStatementConverterTest {
return Collections.singleton(new EncryptColumnSegment("user_id", "user_cipher", "user_plain", "assisted_column", "like_column",
new AlgorithmSegment("MD5", PropertiesBuilder.build(new Property("MD5-key", "MD5-value"))),
new AlgorithmSegment("MD5", PropertiesBuilder.build(new Property("MD5-key", "MD5-value"))),
- new AlgorithmSegment("CHAR_DIGEST_LIKE", PropertiesBuilder.build(new Property("MD5-key", "MD5-value"))), null));
+ new AlgorithmSegment("CHAR_DIGEST_LIKE", PropertiesBuilder.build(new Property("MD5-key", "MD5-value")))));
}
}
diff --git a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/query/ShowEncryptRuleExecutorTest.java b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/query/ShowEncryptRuleExecutorTest.java
index a1dcdad4001..73efcfb0caf 100644
--- a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/query/ShowEncryptRuleExecutorTest.java
+++ b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/query/ShowEncryptRuleExecutorTest.java
@@ -63,14 +63,13 @@ class ShowEncryptRuleExecutorTest {
assertThat(row.getCell(10), is(""));
assertThat(row.getCell(11), is(""));
assertThat(row.getCell(12), is(""));
- assertThat(row.getCell(13), is("true"));
}
@Test
void assertGetColumnNames() {
RQLExecutor<ShowEncryptRulesStatement> executor = new ShowEncryptRuleExecutor();
Collection<String> columns = executor.getColumnNames();
- assertThat(columns.size(), is(13));
+ assertThat(columns.size(), is(12));
Iterator<String> iterator = columns.iterator();
assertThat(iterator.next(), is("table"));
assertThat(iterator.next(), is("logic_column"));
@@ -84,7 +83,6 @@ class ShowEncryptRuleExecutorTest {
assertThat(iterator.next(), is("assisted_query_props"));
assertThat(iterator.next(), is("like_query_type"));
assertThat(iterator.next(), is("like_query_props"));
- assertThat(iterator.next(), is("query_with_cipher_column"));
}
private ShardingSphereDatabase mockDatabase() {
@@ -96,8 +94,8 @@ class ShowEncryptRuleExecutorTest {
}
private RuleConfiguration getRuleConfiguration() {
- EncryptColumnRuleConfiguration encryptColumnRuleConfig = new EncryptColumnRuleConfiguration("user_id", "user_cipher", "user_assisted", "user_like", "user_plain", "test", null);
- EncryptTableRuleConfiguration encryptTableRuleConfig = new EncryptTableRuleConfiguration("t_encrypt", Collections.singleton(encryptColumnRuleConfig), null);
+ EncryptColumnRuleConfiguration encryptColumnRuleConfig = new EncryptColumnRuleConfiguration("user_id", "user_cipher", "user_assisted", "user_like", "user_plain", "test");
+ EncryptTableRuleConfiguration encryptTableRuleConfig = new EncryptTableRuleConfiguration("t_encrypt", Collections.singleton(encryptColumnRuleConfig));
AlgorithmConfiguration shardingSphereAlgorithmConfig = new AlgorithmConfiguration("md5", new Properties());
return new EncryptRuleConfiguration(Collections.singleton(encryptTableRuleConfig), Collections.singletonMap("test", shardingSphereAlgorithmConfig));
}
diff --git a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/AlterEncryptRuleStatementUpdaterTest.java b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/AlterEncryptRuleStatementUpdaterTest.java
index e5cd4af4dbd..eb94922ae33 100644
--- a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/AlterEncryptRuleStatementUpdaterTest.java
+++ b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/AlterEncryptRuleStatementUpdaterTest.java
@@ -74,8 +74,8 @@ class AlterEncryptRuleStatementUpdaterTest {
EncryptColumnSegment columnSegment = new EncryptColumnSegment("user_id", "user_cipher", "user_plain", "assisted_column", "like_column",
"int varchar(10)", null, null, null, null, new AlgorithmSegment("test", new Properties()),
new AlgorithmSegment("test", new Properties()),
- new AlgorithmSegment("test", new Properties()), null);
- EncryptRuleSegment ruleSegment = new EncryptRuleSegment("t_encrypt", Collections.singleton(columnSegment), null);
+ new AlgorithmSegment("test", new Properties()));
+ EncryptRuleSegment ruleSegment = new EncryptRuleSegment("t_encrypt", Collections.singleton(columnSegment));
AlterEncryptRuleStatement statement = new AlterEncryptRuleStatement(Collections.singleton(ruleSegment));
assertThrows(InvalidRuleConfigurationException.class, () -> updater.checkSQLStatement(database, statement, createCurrentRuleConfiguration()));
}
@@ -91,26 +91,26 @@ class AlterEncryptRuleStatementUpdaterTest {
EncryptColumnSegment columnSegment = new EncryptColumnSegment("user_id", "user_cipher", "user_plain", "assisted_column", "like_column",
new AlgorithmSegment(encryptorName, new Properties()),
new AlgorithmSegment("test", new Properties()),
- new AlgorithmSegment("test", new Properties()), null);
- EncryptRuleSegment ruleSegment = new EncryptRuleSegment("t_encrypt", Collections.singleton(columnSegment), null);
+ new AlgorithmSegment("test", new Properties()));
+ EncryptRuleSegment ruleSegment = new EncryptRuleSegment("t_encrypt", Collections.singleton(columnSegment));
return new AlterEncryptRuleStatement(Collections.singleton(ruleSegment));
}
private EncryptRuleConfiguration createCurrentRuleConfiguration() {
- EncryptTableRuleConfiguration tableRuleConfig = new EncryptTableRuleConfiguration("t_encrypt", Collections.emptyList(), null);
+ EncryptTableRuleConfiguration tableRuleConfig = new EncryptTableRuleConfiguration("t_encrypt", Collections.emptyList());
return new EncryptRuleConfiguration(new LinkedList<>(Collections.singleton(tableRuleConfig)), Collections.emptyMap());
}
private EncryptRuleConfiguration createCurrentRuleConfigurationWithMultipleTableRules() {
- EncryptColumnRuleConfiguration columnRuleConfig = new EncryptColumnRuleConfiguration("user_id", "user_cipher", "", "", "user_plain", "t_encrypt_user_id_MD5", null);
- EncryptTableRuleConfiguration tableRuleConfig = new EncryptTableRuleConfiguration("t_encrypt", Collections.singleton(columnRuleConfig), null);
+ EncryptColumnRuleConfiguration columnRuleConfig = new EncryptColumnRuleConfiguration("user_id", "user_cipher", "", "", "user_plain", "t_encrypt_user_id_MD5");
+ EncryptTableRuleConfiguration tableRuleConfig = new EncryptTableRuleConfiguration("t_encrypt", Collections.singleton(columnRuleConfig));
Map<String, AlgorithmConfiguration> encryptors = Collections.singletonMap("t_encrypt_user_id_MD5", new AlgorithmConfiguration("TEST", new Properties()));
return new EncryptRuleConfiguration(new LinkedList<>(Arrays.asList(tableRuleConfig,
- new EncryptTableRuleConfiguration("t_encrypt_another", Collections.singleton(columnRuleConfig), null))), encryptors, true);
+ new EncryptTableRuleConfiguration("t_encrypt_another", Collections.singleton(columnRuleConfig)))), encryptors);
}
private EncryptRuleConfiguration createToBeAlteredRuleConfiguration() {
- EncryptTableRuleConfiguration tableRuleConfig = new EncryptTableRuleConfiguration("t_encrypt", Collections.emptyList(), null);
+ EncryptTableRuleConfiguration tableRuleConfig = new EncryptTableRuleConfiguration("t_encrypt", Collections.emptyList());
return new EncryptRuleConfiguration(new LinkedList<>(Collections.singleton(tableRuleConfig)), Collections.emptyMap());
}
}
diff --git a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleStatementUpdaterTest.java b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleStatementUpdaterTest.java
index be576b9d3c4..b27be589427 100644
--- a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleStatementUpdaterTest.java
+++ b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleStatementUpdaterTest.java
@@ -70,8 +70,8 @@ class CreateEncryptRuleStatementUpdaterTest {
EncryptColumnSegment columnSegment = new EncryptColumnSegment("user_id", "user_cipher", "user_plain", "assisted_column", "like_column",
"int varchar(10)", null, null, null, null, new AlgorithmSegment("test", new Properties()),
new AlgorithmSegment("test", new Properties()),
- new AlgorithmSegment("CHAR_DIGEST_LIKE", new Properties()), null);
- EncryptRuleSegment ruleSegment = new EncryptRuleSegment("t_user", Collections.singleton(columnSegment), null);
+ new AlgorithmSegment("CHAR_DIGEST_LIKE", new Properties()));
+ EncryptRuleSegment ruleSegment = new EncryptRuleSegment("t_user", Collections.singleton(columnSegment));
CreateEncryptRuleStatement statement = new CreateEncryptRuleStatement(false, Collections.singleton(ruleSegment));
assertThrows(InvalidRuleConfigurationException.class, () -> updater.checkSQLStatement(database, statement, null));
}
@@ -89,9 +89,9 @@ class CreateEncryptRuleStatementUpdaterTest {
private CreateEncryptRuleStatement createAESEncryptRuleSQLStatement(final boolean ifNotExists) {
EncryptColumnSegment encryptColumnSegment = new EncryptColumnSegment("user_id", "user_cipher", "user_plain", "assisted_column", "like_column",
- new AlgorithmSegment("AES", PropertiesBuilder.build(new Property("aes-key-value", "abc"))), null, null, null);
+ new AlgorithmSegment("AES", PropertiesBuilder.build(new Property("aes-key-value", "abc"))), null, null);
Collection<EncryptRuleSegment> rules = new LinkedList<>();
- rules.add(new EncryptRuleSegment("t_user", Collections.singleton(encryptColumnSegment), null));
+ rules.add(new EncryptRuleSegment("t_user", Collections.singleton(encryptColumnSegment)));
return new CreateEncryptRuleStatement(ifNotExists, rules);
}
@@ -99,13 +99,13 @@ class CreateEncryptRuleStatementUpdaterTest {
EncryptColumnSegment tUserColumnSegment = new EncryptColumnSegment("user_id", "user_cipher", "user_plain", "assisted_column", "like_column",
new AlgorithmSegment(encryptorName, new Properties()),
new AlgorithmSegment(encryptorName, new Properties()),
- new AlgorithmSegment(encryptorName, new Properties()), null);
+ new AlgorithmSegment(encryptorName, new Properties()));
EncryptColumnSegment tOrderColumnSegment = new EncryptColumnSegment("order_id", "order_cipher", "order_plain", "assisted_column", "like_column",
new AlgorithmSegment(encryptorName, new Properties()),
new AlgorithmSegment(encryptorName, new Properties()),
- new AlgorithmSegment(encryptorName, new Properties()), null);
- EncryptRuleSegment tUserRuleSegment = new EncryptRuleSegment("t_user", Collections.singleton(tUserColumnSegment), null);
- EncryptRuleSegment tOrderRuleSegment = new EncryptRuleSegment("t_order", Collections.singleton(tOrderColumnSegment), null);
+ new AlgorithmSegment(encryptorName, new Properties()));
+ EncryptRuleSegment tUserRuleSegment = new EncryptRuleSegment("t_user", Collections.singleton(tUserColumnSegment));
+ EncryptRuleSegment tOrderRuleSegment = new EncryptRuleSegment("t_order", Collections.singleton(tOrderColumnSegment));
Collection<EncryptRuleSegment> rules = new LinkedList<>();
rules.add(tUserRuleSegment);
rules.add(tOrderRuleSegment);
@@ -114,8 +114,8 @@ class CreateEncryptRuleStatementUpdaterTest {
private EncryptRuleConfiguration getCurrentRuleConfig() {
Collection<EncryptTableRuleConfiguration> rules = new LinkedList<>();
- rules.add(new EncryptTableRuleConfiguration("t_user", Collections.emptyList(), null));
- rules.add(new EncryptTableRuleConfiguration("t_order", Collections.emptyList(), null));
+ rules.add(new EncryptTableRuleConfiguration("t_user", Collections.emptyList()));
+ rules.add(new EncryptTableRuleConfiguration("t_order", Collections.emptyList()));
return new EncryptRuleConfiguration(rules, new HashMap<>());
}
@@ -130,13 +130,13 @@ class CreateEncryptRuleStatementUpdaterTest {
EncryptColumnSegment tUserColumnSegment = new EncryptColumnSegment("user_id", "user_cipher", "user_plain", "assisted_column", "like_column",
new AlgorithmSegment("AES", new Properties()),
new AlgorithmSegment("AES", new Properties()),
- new AlgorithmSegment("CHAR_DIGEST_LIKE", new Properties()), null);
+ new AlgorithmSegment("CHAR_DIGEST_LIKE", new Properties()));
EncryptColumnSegment tOrderColumnSegment = new EncryptColumnSegment("order_id", "order_cipher", "order_plain", "assisted_column", "like_column",
new AlgorithmSegment("AES", new Properties()),
new AlgorithmSegment("AES", new Properties()),
- new AlgorithmSegment("CHAR_DIGEST_LIKE", new Properties()), null);
- EncryptRuleSegment tUserRuleSegment = new EncryptRuleSegment("t_user", Collections.singleton(tUserColumnSegment), null);
- EncryptRuleSegment tOrderRuleSegment = new EncryptRuleSegment("t_order", Collections.singleton(tOrderColumnSegment), null);
+ new AlgorithmSegment("CHAR_DIGEST_LIKE", new Properties()));
+ EncryptRuleSegment tUserRuleSegment = new EncryptRuleSegment("t_user", Collections.singleton(tUserColumnSegment));
+ EncryptRuleSegment tOrderRuleSegment = new EncryptRuleSegment("t_order", Collections.singleton(tOrderColumnSegment));
Collection<EncryptRuleSegment> rules = new LinkedList<>();
rules.add(tUserRuleSegment);
rules.add(tOrderRuleSegment);
diff --git a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleStatementUpdaterTest.java b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleStatementUpdaterTest.java
index 22304005a87..6f886d98305 100644
--- a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleStatementUpdaterTest.java
+++ b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleStatementUpdaterTest.java
@@ -96,20 +96,20 @@ class DropEncryptRuleStatementUpdaterTest {
private EncryptRuleConfiguration createCurrentRuleConfiguration() {
EncryptColumnRuleConfiguration columnRuleConfig = new EncryptColumnRuleConfiguration("user_id", "user_cipher", "", "", "user_plain", "t_encrypt_user_id_MD5", "t_encrypt_test_assisted",
- "t_encrypt_test_like", null);
+ "t_encrypt_test_like");
Map<String, AlgorithmConfiguration> encryptors = new HashMap<>(3, 1);
encryptors.put("t_encrypt_user_id_MD5", new AlgorithmConfiguration("TEST", new Properties()));
encryptors.put("t_encrypt_test_assisted", new AlgorithmConfiguration("TEST", new Properties()));
encryptors.put("t_encrypt_test_like", new AlgorithmConfiguration("TEST", new Properties()));
- EncryptTableRuleConfiguration tableRuleConfig = new EncryptTableRuleConfiguration("t_encrypt", Collections.singleton(columnRuleConfig), null);
- return new EncryptRuleConfiguration(new LinkedList<>(Collections.singleton(tableRuleConfig)), encryptors, true);
+ EncryptTableRuleConfiguration tableRuleConfig = new EncryptTableRuleConfiguration("t_encrypt", Collections.singleton(columnRuleConfig));
+ return new EncryptRuleConfiguration(new LinkedList<>(Collections.singleton(tableRuleConfig)), encryptors);
}
private EncryptRuleConfiguration createCurrentRuleConfigurationWithMultipleTableRules() {
- EncryptColumnRuleConfiguration columnRuleConfig = new EncryptColumnRuleConfiguration("user_id", "user_cipher", "", "", "user_plain", "t_encrypt_user_id_MD5", null);
- EncryptTableRuleConfiguration tableRuleConfig = new EncryptTableRuleConfiguration("t_encrypt", Collections.singleton(columnRuleConfig), null);
+ EncryptColumnRuleConfiguration columnRuleConfig = new EncryptColumnRuleConfiguration("user_id", "user_cipher", "", "", "user_plain", "t_encrypt_user_id_MD5");
+ EncryptTableRuleConfiguration tableRuleConfig = new EncryptTableRuleConfiguration("t_encrypt", Collections.singleton(columnRuleConfig));
Map<String, AlgorithmConfiguration> encryptors = Collections.singletonMap("t_encrypt_user_id_MD5", new AlgorithmConfiguration("TEST", new Properties()));
return new EncryptRuleConfiguration(new LinkedList<>(Arrays.asList(tableRuleConfig,
- new EncryptTableRuleConfiguration("t_encrypt_another", Collections.singleton(columnRuleConfig), null))), encryptors, true);
+ new EncryptTableRuleConfiguration("t_encrypt_another", Collections.singleton(columnRuleConfig)))), encryptors);
}
}
diff --git a/features/encrypt/distsql/parser/src/main/antlr4/imports/encrypt/Keyword.g4 b/features/encrypt/distsql/parser/src/main/antlr4/imports/encrypt/Keyword.g4
index 1f437610b45..ca365ab76b3 100644
--- a/features/encrypt/distsql/parser/src/main/antlr4/imports/encrypt/Keyword.g4
+++ b/features/encrypt/distsql/parser/src/main/antlr4/imports/encrypt/Keyword.g4
@@ -111,10 +111,6 @@ LIKE_QUERY_COLUMN
: L I K E 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
;
diff --git a/features/encrypt/distsql/parser/src/main/antlr4/imports/encrypt/RDLStatement.g4 b/features/encrypt/distsql/parser/src/main/antlr4/imports/encrypt/RDLStatement.g4
index b34f494264b..0fb72dda5ab 100644
--- a/features/encrypt/distsql/parser/src/main/antlr4/imports/encrypt/RDLStatement.g4
+++ b/features/encrypt/distsql/parser/src/main/antlr4/imports/encrypt/RDLStatement.g4
@@ -32,7 +32,7 @@ dropEncryptRule
;
encryptRuleDefinition
- : tableName LP_ COLUMNS LP_ encryptColumnDefinition (COMMA_ encryptColumnDefinition)* RP_ (COMMA_ QUERY_WITH_CIPHER_COLUMN EQ_ queryWithCipherColumn)? RP_
+ : tableName LP_ COLUMNS LP_ encryptColumnDefinition (COMMA_ encryptColumnDefinition)* RP_ RP_
;
resourceName
@@ -40,7 +40,7 @@ resourceName
;
encryptColumnDefinition
- : LP_ columnDefinition (COMMA_ plainColumnDefinition)? COMMA_ cipherColumnDefinition (COMMA_ assistedQueryColumnDefinition)? (COMMA_ likeQueryColumnDefinition)? COMMA_ encryptAlgorithm (COMMA_ assistedQueryAlgorithm)? (COMMA_ likeQueryAlgorithm)? (COMMA_ QUERY_WITH_CIPHER_COLUMN EQ_ queryWithCipherColumn)? RP_
+ : LP_ columnDefinition (COMMA_ plainColumnDefinition)? COMMA_ cipherColumnDefinition (COMMA_ assistedQueryColumnDefinition)? (COMMA_ likeQueryColumnDefinition)? COMMA_ encryptAlgorithm (COMMA_ assistedQueryAlgorithm)? (COMMA_ likeQueryAlgorithm)? RP_
;
columnDefinition
@@ -99,10 +99,6 @@ likeQueryAlgorithm
: LIKE_QUERY_ALGORITHM LP_ algorithmDefinition RP_
;
-queryWithCipherColumn
- : TRUE | FALSE
- ;
-
ifExists
: IF EXISTS
;
diff --git a/features/encrypt/distsql/parser/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/core/EncryptDistSQLStatementVisitor.java b/features/encrypt/distsql/parser/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/core/EncryptDistSQLStatementVisitor.java
index 1f23a92ef79..29eb1d2b8da 100644
--- a/features/encrypt/distsql/parser/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/core/EncryptDistSQLStatementVisitor.java
+++ b/features/encrypt/distsql/parser/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/core/EncryptDistSQLStatementVisitor.java
@@ -79,8 +79,7 @@ public final class EncryptDistSQLStatementVisitor extends EncryptDistSQLStatemen
@Override
public ASTNode visitEncryptRuleDefinition(final EncryptRuleDefinitionContext ctx) {
return new EncryptRuleSegment(getIdentifierValue(ctx.tableName()),
- ctx.encryptColumnDefinition().stream().map(each -> (EncryptColumnSegment) visit(each)).collect(Collectors.toList()),
- null == ctx.queryWithCipherColumn() ? null : Boolean.parseBoolean(getIdentifierValue(ctx.queryWithCipherColumn())));
+ ctx.encryptColumnDefinition().stream().map(each -> (EncryptColumnSegment) visit(each)).collect(Collectors.toList()));
}
@Override
@@ -97,8 +96,7 @@ public final class EncryptDistSQLStatementVisitor extends EncryptDistSQLStatemen
null == ctx.likeQueryColumnDefinition() ? null : getIdentifierValue(ctx.likeQueryColumnDefinition().dataType()),
null == ctx.encryptAlgorithm() ? null : (AlgorithmSegment) visit(ctx.encryptAlgorithm().algorithmDefinition()),
null == ctx.assistedQueryAlgorithm() ? null : (AlgorithmSegment) visit(ctx.assistedQueryAlgorithm().algorithmDefinition()),
- null == ctx.likeQueryAlgorithm() ? null : (AlgorithmSegment) visit(ctx.likeQueryAlgorithm().algorithmDefinition()),
- null == ctx.queryWithCipherColumn() ? null : Boolean.parseBoolean(getIdentifierValue(ctx.queryWithCipherColumn())));
+ null == ctx.likeQueryAlgorithm() ? null : (AlgorithmSegment) visit(ctx.likeQueryAlgorithm().algorithmDefinition()));
}
@Override
diff --git a/features/encrypt/distsql/statement/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/segment/EncryptColumnSegment.java b/features/encrypt/distsql/statement/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/segment/EncryptColumnSegment.java
index 60e57ddd048..77c2349da6f 100644
--- a/features/encrypt/distsql/statement/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/segment/EncryptColumnSegment.java
+++ b/features/encrypt/distsql/statement/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/segment/EncryptColumnSegment.java
@@ -58,8 +58,6 @@ public final class EncryptColumnSegment implements ASTNode {
private final AlgorithmSegment likeQueryEncryptor;
- private final Boolean queryWithCipherColumn;
-
/**
* Is the data type correct.
*
diff --git a/features/encrypt/distsql/statement/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/segment/EncryptRuleSegment.java b/features/encrypt/distsql/statement/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/segment/EncryptRuleSegment.java
index fc02b509c68..a6ad1d0f79f 100644
--- a/features/encrypt/distsql/statement/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/segment/EncryptRuleSegment.java
+++ b/features/encrypt/distsql/statement/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/segment/EncryptRuleSegment.java
@@ -33,6 +33,4 @@ public final class EncryptRuleSegment implements ASTNode {
private final String tableName;
private final Collection<EncryptColumnSegment> columns;
-
- private final Boolean queryWithCipherColumn;
}
diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/constant/DistSQLScriptConstants.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/constant/DistSQLScriptConstants.java
index 7191b82107f..947356557b9 100644
--- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/constant/DistSQLScriptConstants.java
+++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/constant/DistSQLScriptConstants.java
@@ -165,8 +165,7 @@ public final class DistSQLScriptConstants {
+ System.lineSeparator()
+ "%s"
+ System.lineSeparator()
- + "),"
- + "QUERY_WITH_CIPHER_COLUMN=%s)";
+ + "))";
public static final String ENCRYPT_COLUMN = "(NAME=%s, %s, %s)";
diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationExecutor.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationExecutor.java
index 08027b9ccc8..16e5b9f172b 100644
--- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationExecutor.java
+++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationExecutor.java
@@ -434,9 +434,8 @@ public final class ConvertYamlConfigurationExecutor implements QueryableRALExecu
Iterator<EncryptTableRuleConfiguration> iterator = ruleConfig.getTables().iterator();
while (iterator.hasNext()) {
EncryptTableRuleConfiguration tableRuleConfig = iterator.next();
- boolean queryWithCipher = null == tableRuleConfig.getQueryWithCipherColumn() || tableRuleConfig.getQueryWithCipherColumn();
stringBuilder.append(String.format(DistSQLScriptConstants.ENCRYPT, tableRuleConfig.getName(),
- getEncryptColumns(tableRuleConfig.getColumns(), ruleConfig.getEncryptors(), ruleConfig.getLikeEncryptors()), queryWithCipher));
+ getEncryptColumns(tableRuleConfig.getColumns(), ruleConfig.getEncryptors(), ruleConfig.getLikeEncryptors())));
if (iterator.hasNext()) {
stringBuilder.append(DistSQLScriptConstants.COMMA).append(System.lineSeparator());
}
diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/rule/ShowRulesUsedStorageUnitExecutorTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/rule/ShowRulesUsedStorageUnitExecutorTest.java
index 0326057fe59..d4eb0abca52 100644
--- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/rule/ShowRulesUsedStorageUnitExecutorTest.java
+++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/rule/ShowRulesUsedStorageUnitExecutorTest.java
@@ -120,7 +120,7 @@ class ShowRulesUsedStorageUnitExecutorTest {
private EncryptRule mockEncryptRule() {
EncryptRule result = mock(EncryptRule.class);
EncryptRuleConfiguration config = mock(EncryptRuleConfiguration.class);
- when(config.getTables()).thenReturn(Collections.singleton(new EncryptTableRuleConfiguration("encrypt_table", Collections.emptyList(), false)));
+ when(config.getTables()).thenReturn(Collections.singleton(new EncryptTableRuleConfiguration("encrypt_table", Collections.emptyList())));
when(result.getConfiguration()).thenReturn(config);
return result;
}
diff --git a/proxy/backend/core/src/test/resources/expected/convert-encrypt.yaml b/proxy/backend/core/src/test/resources/expected/convert-encrypt.yaml
index 697eae28b06..e1a8b15080a 100644
--- a/proxy/backend/core/src/test/resources/expected/convert-encrypt.yaml
+++ b/proxy/backend/core/src/test/resources/expected/convert-encrypt.yaml
@@ -33,4 +33,4 @@ CREATE ENCRYPT RULE t_encrypt (
COLUMNS(
(NAME=user_id, PLAIN=user_plain, CIPHER=user_cipher, ASSISTED_QUERY_COLUMN=user_assisted, LIKE_QUERY_COLUMN=user_like, ENCRYPT_ALGORITHM(TYPE(NAME='aes', PROPERTIES('aes-key-value'='123456abc'))), ASSISTED_QUERY_ALGORITHM(TYPE(NAME='md5')), LIKE_QUERY_ALGORITHM(TYPE(NAME='char_digest_like'))),
(NAME=order_id, CIPHER=order_cipher, ENCRYPT_ALGORITHM(TYPE(NAME='md5')))
-),QUERY_WITH_CIPHER_COLUMN=true);
+));
diff --git a/proxy/backend/core/src/test/resources/expected/convert-mix.yaml b/proxy/backend/core/src/test/resources/expected/convert-mix.yaml
index 8f54537781f..0d0a677b5fe 100644
--- a/proxy/backend/core/src/test/resources/expected/convert-mix.yaml
+++ b/proxy/backend/core/src/test/resources/expected/convert-mix.yaml
@@ -61,7 +61,7 @@ CREATE ENCRYPT RULE t_encrypt (
COLUMNS(
(NAME=user_id, PLAIN=user_plain, CIPHER=user_cipher, ASSISTED_QUERY_COLUMN=user_assisted, LIKE_QUERY_COLUMN=user_like, ENCRYPT_ALGORITHM(TYPE(NAME='aes', PROPERTIES('aes-key-value'='123456abc'))), ASSISTED_QUERY_ALGORITHM(TYPE(NAME='md5')), LIKE_QUERY_ALGORITHM(TYPE(NAME='char_digest_like'))),
(NAME=order_id, CIPHER=order_cipher, ENCRYPT_ALGORITHM(TYPE(NAME='md5')))
-),QUERY_WITH_CIPHER_COLUMN=true);
+));
CREATE SHARDING TABLE RULE t_order (
DATANODES('replica_ds_${0..1}.t_order_${0..1}'),
diff --git a/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/AbstractEncryptDriverTest.java b/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/AbstractEncryptDriverTest.java
index 9f418930bd8..0a2ac38cf3b 100644
--- a/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/AbstractEncryptDriverTest.java
+++ b/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/AbstractEncryptDriverTest.java
@@ -40,24 +40,19 @@ import java.util.stream.Collectors;
public abstract class AbstractEncryptDriverTest extends AbstractDriverTest {
- private static ShardingSphereDataSource queryWithPlainDataSource;
-
private static ShardingSphereDataSource queryWithCipherDataSource;
private static final List<String> ACTUAL_DATA_SOURCE_NAMES = Collections.singletonList("encrypt");
- private static final String CONFIG_FILE_WITH_QUERY_WITH_PLAIN = "config/config-encrypt-query-with-plain.yaml";
-
private static final String CONFIG_FILE_WITH_QUERY_WITH_CIPHER = "config/config-encrypt-query-with-cipher.yaml";
@BeforeAll
static void initEncryptDataSource() throws SQLException, IOException {
- if (null != queryWithPlainDataSource && null != queryWithCipherDataSource) {
+ if (null != queryWithCipherDataSource) {
return;
}
DataSource dataSource = getDataSourceMap().values().iterator().next();
- queryWithPlainDataSource = (ShardingSphereDataSource) YamlShardingSphereDataSourceFactory.createDataSource(dataSource, getFile(CONFIG_FILE_WITH_QUERY_WITH_CIPHER));
- queryWithCipherDataSource = (ShardingSphereDataSource) YamlShardingSphereDataSourceFactory.createDataSource(dataSource, getFile(CONFIG_FILE_WITH_QUERY_WITH_PLAIN));
+ queryWithCipherDataSource = (ShardingSphereDataSource) YamlShardingSphereDataSourceFactory.createDataSource(dataSource, getFile(CONFIG_FILE_WITH_QUERY_WITH_CIPHER));
}
private static File getFile(final String fileName) {
@@ -71,7 +66,7 @@ public abstract class AbstractEncryptDriverTest extends AbstractDriverTest {
@BeforeEach
void initTable() {
- try (Connection connection = queryWithPlainDataSource.getConnection()) {
+ try (Connection connection = queryWithCipherDataSource.getConnection()) {
RunScript.execute(connection, new InputStreamReader(Objects.requireNonNull(AbstractDriverTest.class.getClassLoader().getResourceAsStream("sql/encrypt_data.sql"))));
} catch (final SQLException ex) {
throw new RuntimeException(ex);
@@ -79,7 +74,7 @@ public abstract class AbstractEncryptDriverTest extends AbstractDriverTest {
}
protected final Connection getEncryptConnection() {
- return queryWithPlainDataSource.getConnection();
+ return queryWithCipherDataSource.getConnection();
}
protected final ShardingSphereConnection getEncryptConnectionWithProps() {
@@ -88,11 +83,6 @@ public abstract class AbstractEncryptDriverTest extends AbstractDriverTest {
@AfterAll
static void close() throws Exception {
- if (null == queryWithPlainDataSource) {
- return;
- }
- queryWithPlainDataSource.close();
- queryWithPlainDataSource = null;
if (null == queryWithCipherDataSource) {
return;
}
diff --git a/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/statement/EncryptStatementTest.java b/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/statement/EncryptStatementTest.java
index 53e6e318283..5306e90a572 100644
--- a/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/statement/EncryptStatementTest.java
+++ b/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/statement/EncryptStatementTest.java
@@ -152,21 +152,6 @@ class EncryptStatementTest extends AbstractEncryptDriverTest {
}
}
- @Test
- void assertSelectWithPlainColumn() throws SQLException {
- try (Statement statement = getEncryptConnectionWithProps().createStatement()) {
- ResultSet resultSet = statement.executeQuery(SELECT_SQL_WITH_PLAIN);
- int count = 1;
- List<Object> ids = Arrays.asList(1, 5);
- while (resultSet.next()) {
- assertThat(resultSet.getObject("id"), is(ids.get(count - 1)));
- assertThat(resultSet.getObject("pwd"), is("plainValue"));
- count += 1;
- }
- assertThat(count - 1, is(ids.size()));
- }
- }
-
private void assertResultSet(final int resultSetCount, final int id, final Object pwd, final Object plain) throws SQLException {
try (
Connection connection = getActualDataSources().get("encrypt").getConnection();
diff --git a/test/e2e/driver/src/test/resources/config/config-encrypt-query-with-plain.yaml b/test/e2e/driver/src/test/resources/config/config-encrypt-query-with-plain.yaml
deleted file mode 100644
index f1086c029d6..00000000000
--- a/test/e2e/driver/src/test/resources/config/config-encrypt-query-with-plain.yaml
+++ /dev/null
@@ -1,54 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-databaseName: logic_db_plain
-
-rules:
-- !ENCRYPT
- tables:
- t_encrypt:
- columns:
- pwd:
- plainColumn: plain_pwd
- cipherColumn: cipher_pwd
- encryptorName: jdbc_encryptor_fixture
- t_query_encrypt:
- columns:
- pwd:
- cipherColumn: cipher_pwd
- assistedQueryColumn: assist_pwd
- encryptorName: jdbc_encryptor_fixture
- assistedQueryEncryptorName: jdbc_query_assisted_encryptor_fixture
- t_encrypt_contains_column:
- columns:
- plain_pwd:
- plainColumn: plain_pwd
- cipherColumn: cipher_pwd
- encryptorName: jdbc_encryptor_fixture
- plain_pwd2:
- plainColumn: plain_pwd2
- cipherColumn: cipher_pwd2
- encryptorName: jdbc_encryptor_fixture
- encryptors:
- jdbc_encryptor_fixture:
- type: JDBC.FIXTURE
- jdbc_query_assisted_encryptor_fixture:
- type: JDBC.QUERY_ASSISTED.FIXTURE
- queryWithCipherColumn: false
-
-props:
- sql-show: true
diff --git a/test/e2e/operation/pipeline/src/test/resources/env/common/migration-command.xml b/test/e2e/operation/pipeline/src/test/resources/env/common/migration-command.xml
index 4592ef89ff3..92925be0d9d 100644
--- a/test/e2e/operation/pipeline/src/test/resources/env/common/migration-command.xml
+++ b/test/e2e/operation/pipeline/src/test/resources/env/common/migration-command.xml
@@ -59,8 +59,7 @@
<create-target-order-table-encrypt-rule>
CREATE ENCRYPT RULE t_order (
- COLUMNS((NAME=status, CIPHER=status,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc'))))),
- QUERY_WITH_CIPHER_COLUMN=true)
+ COLUMNS((NAME=status, CIPHER=status,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc'))))))
</create-target-order-table-encrypt-rule>
<create-target-order-table-rule>
diff --git a/test/e2e/sql/src/test/resources/cases/rdl/dataset/rdl_empty_rules/alter_encrypt_rule.xml b/test/e2e/sql/src/test/resources/cases/rdl/dataset/rdl_empty_rules/alter_encrypt_rule.xml
index 5d9712911e5..ab018c46692 100644
--- a/test/e2e/sql/src/test/resources/cases/rdl/dataset/rdl_empty_rules/alter_encrypt_rule.xml
+++ b/test/e2e/sql/src/test/resources/cases/rdl/dataset/rdl_empty_rules/alter_encrypt_rule.xml
@@ -29,7 +29,6 @@
<column name="assisted_query_props" />
<column name="like_query_type" />
<column name="like_query_props" />
- <column name="query_with_cipher_column" />
</metadata>
- <row values="t_user| pwd| pwd_cipher| pwd_plain| | | AES| aes-key-value=123456abcd| | | | | true" />
+ <row values="t_user| pwd| pwd_cipher| pwd_plain| | | AES| aes-key-value=123456abcd| | | | " />
</dataset>
diff --git a/test/e2e/sql/src/test/resources/cases/rdl/dataset/rdl_empty_rules/create_encrypt_rule.xml b/test/e2e/sql/src/test/resources/cases/rdl/dataset/rdl_empty_rules/create_encrypt_rule.xml
index d1b2998cb60..399ae608add 100644
--- a/test/e2e/sql/src/test/resources/cases/rdl/dataset/rdl_empty_rules/create_encrypt_rule.xml
+++ b/test/e2e/sql/src/test/resources/cases/rdl/dataset/rdl_empty_rules/create_encrypt_rule.xml
@@ -29,7 +29,6 @@
<column name="assisted_query_props" />
<column name="like_query_type" />
<column name="like_query_props" />
- <column name="query_with_cipher_column" />
</metadata>
- <row values="t_user| pwd| pwd_cipher| pwd_plain| | | AES| aes-key-value=123456abc| | | | | true" />
+ <row values="t_user| pwd| pwd_cipher| pwd_plain| | | AES| aes-key-value=123456abc| | | | " />
</dataset>
diff --git a/test/e2e/sql/src/test/resources/cases/rdl/dataset/rdl_empty_rules/drop_encrypt_rule.xml b/test/e2e/sql/src/test/resources/cases/rdl/dataset/rdl_empty_rules/drop_encrypt_rule.xml
index e965e32b5e0..fc084f5a499 100644
--- a/test/e2e/sql/src/test/resources/cases/rdl/dataset/rdl_empty_rules/drop_encrypt_rule.xml
+++ b/test/e2e/sql/src/test/resources/cases/rdl/dataset/rdl_empty_rules/drop_encrypt_rule.xml
@@ -29,6 +29,5 @@
<column name="assisted_query_props" />
<column name="like_query_type" />
<column name="like_query_props" />
- <column name="query_with_cipher_column" />
</metadata>
</dataset>
diff --git a/test/e2e/sql/src/test/resources/cases/rdl/rdl-integration-alter.xml b/test/e2e/sql/src/test/resources/cases/rdl/rdl-integration-alter.xml
index 143204b14e2..164947df0f3 100644
--- a/test/e2e/sql/src/test/resources/cases/rdl/rdl-integration-alter.xml
+++ b/test/e2e/sql/src/test/resources/cases/rdl/rdl-integration-alter.xml
@@ -32,9 +32,9 @@
</assertion>
</test-case>
- <test-case sql="ALTER ENCRYPT RULE t_user (COLUMNS((NAME=pwd,PLAIN=pwd_plain,CIPHER=pwd_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abcd'))))),QUERY_WITH_CIPHER_COLUMN=true);" db-types="MySQL, PostgreSQL">
+ <test-case sql="ALTER ENCRYPT RULE t_user (COLUMNS((NAME=pwd,PLAIN=pwd_plain,CIPHER=pwd_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abcd'))))));" db-types="MySQL, PostgreSQL">
<assertion expected-data-file="alter_encrypt_rule.xml">
- <initial-sql sql="CREATE ENCRYPT RULE t_user (COLUMNS((NAME=pwd,PLAIN=pwd_plain,CIPHER=pwd_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc'))))),QUERY_WITH_CIPHER_COLUMN=true);" />
+ <initial-sql sql="CREATE ENCRYPT RULE t_user (COLUMNS((NAME=pwd,PLAIN=pwd_plain,CIPHER=pwd_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc'))))));" />
<assertion-sql sql="SHOW ENCRYPT TABLE RULE t_user;" />
<destroy-sql sql="DROP ENCRYPT RULE t_user " />
</assertion>
diff --git a/test/e2e/sql/src/test/resources/cases/rdl/rdl-integration-create.xml b/test/e2e/sql/src/test/resources/cases/rdl/rdl-integration-create.xml
index 4ef939f38d4..f00c0cd7f39 100644
--- a/test/e2e/sql/src/test/resources/cases/rdl/rdl-integration-create.xml
+++ b/test/e2e/sql/src/test/resources/cases/rdl/rdl-integration-create.xml
@@ -31,7 +31,7 @@
</assertion>
</test-case>
- <test-case sql="CREATE ENCRYPT RULE t_user (COLUMNS((NAME=pwd,PLAIN=pwd_plain,CIPHER=pwd_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc'))))),QUERY_WITH_CIPHER_COLUMN=true);" db-types="MySQL, PostgreSQL">
+ <test-case sql="CREATE ENCRYPT RULE t_user (COLUMNS((NAME=pwd,PLAIN=pwd_plain,CIPHER=pwd_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc'))))));" db-types="MySQL, PostgreSQL">
<assertion expected-data-file="create_encrypt_rule.xml">
<assertion-sql sql="SHOW ENCRYPT TABLE RULE t_user;" />
<destroy-sql sql="DROP ENCRYPT RULE t_user " />
diff --git a/test/e2e/sql/src/test/resources/cases/rdl/rdl-integration-drop.xml b/test/e2e/sql/src/test/resources/cases/rdl/rdl-integration-drop.xml
index 732f9dff644..facc049bd03 100644
--- a/test/e2e/sql/src/test/resources/cases/rdl/rdl-integration-drop.xml
+++ b/test/e2e/sql/src/test/resources/cases/rdl/rdl-integration-drop.xml
@@ -34,7 +34,7 @@
<test-case sql="DROP ENCRYPT RULE t_user;" db-types="MySQL, PostgreSQL">
<assertion expected-data-file="drop_encrypt_rule.xml">
- <initial-sql sql="CREATE ENCRYPT RULE t_user (COLUMNS((NAME=pwd,PLAIN=pwd_plain,CIPHER=pwd_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc'))))),QUERY_WITH_CIPHER_COLUMN=true);" />
+ <initial-sql sql="CREATE ENCRYPT RULE t_user (COLUMNS((NAME=pwd,PLAIN=pwd_plain,CIPHER=pwd_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc'))))));" />
<assertion-sql sql="SHOW ENCRYPT TABLE RULE t_user;" />
</assertion>
</test-case>
diff --git a/test/e2e/sql/src/test/resources/cases/rql/dataset/dbtbl_with_readwrite_splitting_and_encrypt/show_encrypt_rule.xml b/test/e2e/sql/src/test/resources/cases/rql/dataset/dbtbl_with_readwrite_splitting_and_encrypt/show_encrypt_rule.xml
index d1b2998cb60..399ae608add 100644
--- a/test/e2e/sql/src/test/resources/cases/rql/dataset/dbtbl_with_readwrite_splitting_and_encrypt/show_encrypt_rule.xml
+++ b/test/e2e/sql/src/test/resources/cases/rql/dataset/dbtbl_with_readwrite_splitting_and_encrypt/show_encrypt_rule.xml
@@ -29,7 +29,6 @@
<column name="assisted_query_props" />
<column name="like_query_type" />
<column name="like_query_props" />
- <column name="query_with_cipher_column" />
</metadata>
- <row values="t_user| pwd| pwd_cipher| pwd_plain| | | AES| aes-key-value=123456abc| | | | | true" />
+ <row values="t_user| pwd| pwd_cipher| pwd_plain| | | AES| aes-key-value=123456abc| | | | " />
</dataset>
diff --git a/test/e2e/sql/src/test/resources/cases/rql/dataset/dbtbl_with_readwrite_splitting_and_encrypt/show_encrypt_rules.xml b/test/e2e/sql/src/test/resources/cases/rql/dataset/dbtbl_with_readwrite_splitting_and_encrypt/show_encrypt_rules.xml
index 3db552c54d2..34ed4cd0f24 100644
--- a/test/e2e/sql/src/test/resources/cases/rql/dataset/dbtbl_with_readwrite_splitting_and_encrypt/show_encrypt_rules.xml
+++ b/test/e2e/sql/src/test/resources/cases/rql/dataset/dbtbl_with_readwrite_splitting_and_encrypt/show_encrypt_rules.xml
@@ -29,11 +29,10 @@
<column name="assisted_query_props" />
<column name="like_query_type" />
<column name="like_query_props" />
- <column name="query_with_cipher_column" />
</metadata>
- <row values="t_user| pwd| pwd_cipher| pwd_plain| | | AES| aes-key-value=123456abc| | | | | true" />
- <row values="t_user_details| number| number_cipher| number_plain| | | AES| aes-key-value=123456abc| | | | | true" />
- <row values="t_user_details| number_new| number_new_cipher| number_new_plain| | | AES| aes-key-value=123456abc| | | | | true" />
- <row values="t_user_encrypt_federate| pwd| cipher_pwd| plain_pwd| | | AES| aes-key-value=123456abc| | | | | true" />
- <row values="t_user_encrypt_federate_sharding| pwd| cipher_pwd| plain_pwd| | | AES| aes-key-value=123456abc| | | | | true" />
+ <row values="t_user| pwd| pwd_cipher| pwd_plain| | | AES| aes-key-value=123456abc| | | | " />
+ <row values="t_user_details| number| number_cipher| number_plain| | | AES| aes-key-value=123456abc| | | | " />
+ <row values="t_user_details| number_new| number_new_cipher| number_new_plain| | | AES| aes-key-value=123456abc| | | | " />
+ <row values="t_user_encrypt_federate| pwd| cipher_pwd| plain_pwd| | | AES| aes-key-value=123456abc| | | | " />
+ <row values="t_user_encrypt_federate_sharding| pwd| cipher_pwd| plain_pwd| | | AES| aes-key-value=123456abc| | | | " />
</dataset>
diff --git a/test/e2e/sql/src/test/resources/cases/rql/dataset/encrypt/show_encrypt_rule.xml b/test/e2e/sql/src/test/resources/cases/rql/dataset/encrypt/show_encrypt_rule.xml
index db7f1487958..3f295ab211b 100644
--- a/test/e2e/sql/src/test/resources/cases/rql/dataset/encrypt/show_encrypt_rule.xml
+++ b/test/e2e/sql/src/test/resources/cases/rql/dataset/encrypt/show_encrypt_rule.xml
@@ -29,10 +29,9 @@
<column name="assisted_query_props" />
<column name="like_query_type" />
<column name="like_query_props" />
- <column name="query_with_cipher_column" />
</metadata>
- <row values="t_user| user_name| user_name_cipher| user_name_plain| | user_name_like| AES| aes-key-value=123456abc| | | CHAR_DIGEST_LIKE| mask=4093| true" />
- <row values="t_user| password| password_cipher| | | | AES| aes-key-value=123456abc| | | | | true" />
- <row values="t_user| email| email_cipher| | | | AES| aes-key-value=123456abc| | | | | true" />
- <row values="t_user| telephone| telephone_cipher| telephone_plain| | telephone_like| AES| aes-key-value=123456abc| | | CHAR_DIGEST_LIKE| mask=4093| true" />
+ <row values="t_user| user_name| user_name_cipher| user_name_plain| | user_name_like| AES| aes-key-value=123456abc| | | CHAR_DIGEST_LIKE| mask=4093" />
+ <row values="t_user| password| password_cipher| | | | AES| aes-key-value=123456abc| | | | " />
+ <row values="t_user| email| email_cipher| | | | AES| aes-key-value=123456abc| | | | " />
+ <row values="t_user| telephone| telephone_cipher| telephone_plain| | telephone_like| AES| aes-key-value=123456abc| | | CHAR_DIGEST_LIKE| mask=4093" />
</dataset>
diff --git a/test/e2e/sql/src/test/resources/cases/rql/dataset/encrypt/show_encrypt_rules.xml b/test/e2e/sql/src/test/resources/cases/rql/dataset/encrypt/show_encrypt_rules.xml
index 1a359d7ef40..6fb9c61cca3 100644
--- a/test/e2e/sql/src/test/resources/cases/rql/dataset/encrypt/show_encrypt_rules.xml
+++ b/test/e2e/sql/src/test/resources/cases/rql/dataset/encrypt/show_encrypt_rules.xml
@@ -29,14 +29,13 @@
<column name="assisted_query_props" />
<column name="like_query_type" />
<column name="like_query_props" />
- <column name="query_with_cipher_column" />
</metadata>
- <row values="t_user| user_name| user_name_cipher| user_name_plain| | user_name_like| AES| aes-key-value=123456abc| | | CHAR_DIGEST_LIKE| mask=4093| true" />
- <row values="t_user| password| password_cipher| | | | AES| aes-key-value=123456abc| | | | | true" />
- <row values="t_user| email| email_cipher| | | | AES| aes-key-value=123456abc| | | | | true" />
- <row values="t_user| telephone| telephone_cipher| telephone_plain| | telephone_like| AES| aes-key-value=123456abc| | | CHAR_DIGEST_LIKE| mask=4093| true" />
- <row values="t_user_details| number| number_cipher| number_plain| | | AES| aes-key-value=123456abc| | | | | true" />
- <row values="t_user_details| number_new| number_new_cipher| number_new_plain| | | AES| aes-key-value=123456abc| | | | | true" />
- <row values="t_merchant| business_code| business_code_cipher| business_code_plain| | business_code_like| AES| aes-key-value=123456abc| | | CHAR_DIGEST_LIKE | mask=4093 | true" />
- <row values="t_merchant| telephone| telephone_cipher| telephone_plain| | telephone_like| AES| aes-key-value=123456abc| | | CHAR_DIGEST_LIKE | mask=4093 | true" />
+ <row values="t_user| user_name| user_name_cipher| user_name_plain| | user_name_like| AES| aes-key-value=123456abc| | | CHAR_DIGEST_LIKE| mask=4093" />
+ <row values="t_user| password| password_cipher| | | | AES| aes-key-value=123456abc| | | | " />
+ <row values="t_user| email| email_cipher| | | | AES| aes-key-value=123456abc| | | | " />
+ <row values="t_user| telephone| telephone_cipher| telephone_plain| | telephone_like| AES| aes-key-value=123456abc| | | CHAR_DIGEST_LIKE| mask=4093" />
+ <row values="t_user_details| number| number_cipher| number_plain| | | AES| aes-key-value=123456abc| | | | " />
+ <row values="t_user_details| number_new| number_new_cipher| number_new_plain| | | AES| aes-key-value=123456abc| | | | " />
+ <row values="t_merchant| business_code| business_code_cipher| business_code_plain| | business_code_like| AES| aes-key-value=123456abc| | | CHAR_DIGEST_LIKE | mask=4093 " />
+ <row values="t_merchant| telephone| telephone_cipher| telephone_plain| | telephone_like| AES| aes-key-value=123456abc| | | CHAR_DIGEST_LIKE | mask=4093 " />
</dataset>
diff --git a/test/e2e/sql/src/test/resources/cases/rql/dataset/encrypt_and_readwrite_splitting/show_encrypt_rule.xml b/test/e2e/sql/src/test/resources/cases/rql/dataset/encrypt_and_readwrite_splitting/show_encrypt_rule.xml
index d1b2998cb60..399ae608add 100644
--- a/test/e2e/sql/src/test/resources/cases/rql/dataset/encrypt_and_readwrite_splitting/show_encrypt_rule.xml
+++ b/test/e2e/sql/src/test/resources/cases/rql/dataset/encrypt_and_readwrite_splitting/show_encrypt_rule.xml
@@ -29,7 +29,6 @@
<column name="assisted_query_props" />
<column name="like_query_type" />
<column name="like_query_props" />
- <column name="query_with_cipher_column" />
</metadata>
- <row values="t_user| pwd| pwd_cipher| pwd_plain| | | AES| aes-key-value=123456abc| | | | | true" />
+ <row values="t_user| pwd| pwd_cipher| pwd_plain| | | AES| aes-key-value=123456abc| | | | " />
</dataset>
diff --git a/test/e2e/sql/src/test/resources/cases/rql/dataset/encrypt_and_readwrite_splitting/show_encrypt_rules.xml b/test/e2e/sql/src/test/resources/cases/rql/dataset/encrypt_and_readwrite_splitting/show_encrypt_rules.xml
index 0c69f265e64..182b1acc8e5 100644
--- a/test/e2e/sql/src/test/resources/cases/rql/dataset/encrypt_and_readwrite_splitting/show_encrypt_rules.xml
+++ b/test/e2e/sql/src/test/resources/cases/rql/dataset/encrypt_and_readwrite_splitting/show_encrypt_rules.xml
@@ -29,13 +29,12 @@
<column name="assisted_query_props" />
<column name="like_query_type" />
<column name="like_query_props" />
- <column name="query_with_cipher_column" />
</metadata>
- <row values="t_user| pwd| pwd_cipher| pwd_plain| | | AES| aes-key-value=123456abc| | | | | true" />
- <row values="t_user_details| number| number_cipher| number_plain| | | AES| aes-key-value=123456abc| | | | | true" />
- <row values="t_user_details| number_new| number_new_cipher| number_new_plain| | | AES| aes-key-value=123456abc| | | | | true" />
- <row values="t_user_encrypt_federate| pwd| cipher_pwd| plain_pwd| | | AES| aes-key-value=123456abc| | | | | true" />
- <row values="t_user_encrypt_federate_sharding| pwd| cipher_pwd| plain_pwd| | | AES| aes-key-value=123456abc| | | | | true" />
- <row values="t_merchant| business_code| business_code_cipher| business_code_plain| | | AES| aes-key-value=123456abc| | | | | true" />
- <row values="t_merchant| telephone| telephone_cipher| telephone_plain| | | AES| aes-key-value=123456abc| | | | | true" />
+ <row values="t_user| pwd| pwd_cipher| pwd_plain| | | AES| aes-key-value=123456abc| | | | " />
+ <row values="t_user_details| number| number_cipher| number_plain| | | AES| aes-key-value=123456abc| | | | " />
+ <row values="t_user_details| number_new| number_new_cipher| number_new_plain| | | AES| aes-key-value=123456abc| | | | " />
+ <row values="t_user_encrypt_federate| pwd| cipher_pwd| plain_pwd| | | AES| aes-key-value=123456abc| | | | " />
+ <row values="t_user_encrypt_federate_sharding| pwd| cipher_pwd| plain_pwd| | | AES| aes-key-value=123456abc| | | | " />
+ <row values="t_merchant| business_code| business_code_cipher| business_code_plain| | | AES| aes-key-value=123456abc| | | | " />
+ <row values="t_merchant| telephone| telephone_cipher| telephone_plain| | | AES| aes-key-value=123456abc| | | | " />
</dataset>
diff --git a/test/e2e/sql/src/test/resources/cases/rql/dataset/sharding_and_encrypt/show_encrypt_rule.xml b/test/e2e/sql/src/test/resources/cases/rql/dataset/sharding_and_encrypt/show_encrypt_rule.xml
index d1b2998cb60..399ae608add 100644
--- a/test/e2e/sql/src/test/resources/cases/rql/dataset/sharding_and_encrypt/show_encrypt_rule.xml
+++ b/test/e2e/sql/src/test/resources/cases/rql/dataset/sharding_and_encrypt/show_encrypt_rule.xml
@@ -29,7 +29,6 @@
<column name="assisted_query_props" />
<column name="like_query_type" />
<column name="like_query_props" />
- <column name="query_with_cipher_column" />
</metadata>
- <row values="t_user| pwd| pwd_cipher| pwd_plain| | | AES| aes-key-value=123456abc| | | | | true" />
+ <row values="t_user| pwd| pwd_cipher| pwd_plain| | | AES| aes-key-value=123456abc| | | | " />
</dataset>
diff --git a/test/e2e/sql/src/test/resources/cases/rql/dataset/sharding_and_encrypt/show_encrypt_rules.xml b/test/e2e/sql/src/test/resources/cases/rql/dataset/sharding_and_encrypt/show_encrypt_rules.xml
index 0c69f265e64..182b1acc8e5 100644
--- a/test/e2e/sql/src/test/resources/cases/rql/dataset/sharding_and_encrypt/show_encrypt_rules.xml
+++ b/test/e2e/sql/src/test/resources/cases/rql/dataset/sharding_and_encrypt/show_encrypt_rules.xml
@@ -29,13 +29,12 @@
<column name="assisted_query_props" />
<column name="like_query_type" />
<column name="like_query_props" />
- <column name="query_with_cipher_column" />
</metadata>
- <row values="t_user| pwd| pwd_cipher| pwd_plain| | | AES| aes-key-value=123456abc| | | | | true" />
- <row values="t_user_details| number| number_cipher| number_plain| | | AES| aes-key-value=123456abc| | | | | true" />
- <row values="t_user_details| number_new| number_new_cipher| number_new_plain| | | AES| aes-key-value=123456abc| | | | | true" />
- <row values="t_user_encrypt_federate| pwd| cipher_pwd| plain_pwd| | | AES| aes-key-value=123456abc| | | | | true" />
- <row values="t_user_encrypt_federate_sharding| pwd| cipher_pwd| plain_pwd| | | AES| aes-key-value=123456abc| | | | | true" />
- <row values="t_merchant| business_code| business_code_cipher| business_code_plain| | | AES| aes-key-value=123456abc| | | | | true" />
- <row values="t_merchant| telephone| telephone_cipher| telephone_plain| | | AES| aes-key-value=123456abc| | | | | true" />
+ <row values="t_user| pwd| pwd_cipher| pwd_plain| | | AES| aes-key-value=123456abc| | | | " />
+ <row values="t_user_details| number| number_cipher| number_plain| | | AES| aes-key-value=123456abc| | | | " />
+ <row values="t_user_details| number_new| number_new_cipher| number_new_plain| | | AES| aes-key-value=123456abc| | | | " />
+ <row values="t_user_encrypt_federate| pwd| cipher_pwd| plain_pwd| | | AES| aes-key-value=123456abc| | | | " />
+ <row values="t_user_encrypt_federate_sharding| pwd| cipher_pwd| plain_pwd| | | AES| aes-key-value=123456abc| | | | " />
+ <row values="t_merchant| business_code| business_code_cipher| business_code_plain| | | AES| aes-key-value=123456abc| | | | " />
+ <row values="t_merchant| telephone| telephone_cipher| telephone_plain| | | AES| aes-key-value=123456abc| | | | " />
</dataset>
diff --git a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/distsql/rdl/EncryptRuleAssert.java b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/distsql/rdl/EncryptRuleAssert.java
index af7d55a4edc..e12551b821d 100644
--- a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/distsql/rdl/EncryptRuleAssert.java
+++ b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/distsql/rdl/EncryptRuleAssert.java
@@ -29,10 +29,10 @@ import java.util.Collection;
import java.util.List;
import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.hamcrest.MatcherAssert.assertThat;
/**
* Encrypt rule assert.
@@ -53,7 +53,6 @@ public final class EncryptRuleAssert {
} else {
assertNotNull(actual, assertContext.getText("Actual encrypt rule should exist."));
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/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/distsql/rdl/ExpectedEncryptRule.java b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/distsql/rdl/ExpectedEncryptRule.java
index c3a8600408d..215403b6e27 100644
--- a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/distsql/rdl/ExpectedEncryptRule.java
+++ b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/distsql/rdl/ExpectedEncryptRule.java
@@ -21,7 +21,6 @@ import lombok.Getter;
import lombok.Setter;
import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.AbstractExpectedIdentifierSQLSegment;
-import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import java.util.LinkedList;
import java.util.List;
@@ -35,7 +34,4 @@ public final class ExpectedEncryptRule extends AbstractExpectedIdentifierSQLSegm
@XmlElement(name = "column")
private final List<ExpectedEncryptColumn> columns = new LinkedList<>();
-
- @XmlAttribute(name = "query-with-cipher-column")
- private Boolean queryWithCipherColumn;
}
diff --git a/test/it/parser/src/main/resources/sql/supported/rdl/alter.xml b/test/it/parser/src/main/resources/sql/supported/rdl/alter.xml
index 4d100a5097d..2d738e7b3ce 100644
--- a/test/it/parser/src/main/resources/sql/supported/rdl/alter.xml
+++ b/test/it/parser/src/main/resources/sql/supported/rdl/alter.xml
@@ -29,7 +29,7 @@
<sql-case id="alter-encrypt-rule" value="ALTER ENCRYPT RULE t_encrypt (COLUMNS((NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc')))), (NAME=order_id, CIPHER =order_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='MD5')))))" db-types="ShardingSphere" />
<sql-case id="alter-encrypt-rule-with-assisted-query-column" value="ALTER ENCRYPT RULE t_encrypt (COLUMNS((NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,ASSISTED_QUERY_COLUMN=assisted_column, ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc'))), ASSISTED_QUERY_ALGORITHM(TYPE(NAME='MD5'))), (NAME=order_id, CIPHER =order_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='MD5')))))" db-types="ShardingSphere" />
<sql-case id="alter-encrypt-rule-with-like-query-column" value="ALTER ENCRYPT RULE t_encrypt (COLUMNS((NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,LIKE_QUERY_COLUMN=like_column, ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc'))), LIKE_QUERY_ALGORITHM(TYPE(NAME='CHAR_DIGEST_LIKE'))), (NAME=order_id, CIPHER =order_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='MD5')))))" db-types="ShardingSphere" />
- <sql-case id="alter-encrypt-rule-with-query-with-cipher-column" value="ALTER ENCRYPT RULE t_encrypt (COLUMNS((NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher, ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc')))), (NAME=order_id, CIPHER =order_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='MD5')))), QUERY_WITH_CIPHER_COLUMN=false)" db-types="ShardingSphere" />
+ <sql-case id="alter-encrypt-rule-with-query-with-cipher-column" value="ALTER ENCRYPT RULE t_encrypt (COLUMNS((NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher, ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc')))), (NAME=order_id, CIPHER =order_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='MD5')))))" db-types="ShardingSphere" />
<sql-case id="alter-default-shadow-algorithm" value="ALTER DEFAULT SHADOW ALGORITHM TYPE(NAME='SQL_HINT')" db-types="ShardingSphere" />
<sql-case id="alter-shadow-rule" value="ALTER SHADOW RULE shadow_rule(SOURCE=demo_ds,SHADOW=demo_ds_shadow,t_order(TYPE(NAME='REGEX_MATCH',PROPERTIES('operation'='insert','column'='user_id','regex'='[1]')),TYPE(NAME='SQL_HINT')))" db-types="ShardingSphere" />
<sql-case id="alter-sharding-auto-table-rule" value="ALTER SHARDING TABLE RULE t_order (STORAGE_UNITS(ms_group_0,ms_group_1), SHARDING_COLUMN=order_id, TYPE(NAME='hash_mod',PROPERTIES('sharding-count'='4')),KEY_GENERATE_STRATEGY(COLUMN=another_id,TYPE(NAME='snowflake')))" db-types="ShardingSphere" />
diff --git a/test/it/parser/src/main/resources/sql/supported/rdl/create.xml b/test/it/parser/src/main/resources/sql/supported/rdl/create.xml
index 08b6382aa17..0d8dedb8973 100644
--- a/test/it/parser/src/main/resources/sql/supported/rdl/create.xml
+++ b/test/it/parser/src/main/resources/sql/supported/rdl/create.xml
@@ -71,7 +71,7 @@
<sql-case id="create-broadcast-table-rule-with-quota" value="CREATE BROADCAST TABLE RULE `t_1`,`t_2` " db-types="ShardingSphere" />
<sql-case id="create-readwrite-splitting-rule-with-quota" value="CREATE READWRITE_SPLITTING RULE `ms_group_0` (WRITE_STORAGE_UNIT=primary_ds, READ_STORAGE_UNITS(replica_ds_0,replica_ds_1), TYPE(NAME='random')))" db-types="ShardingSphere" />
<sql-case id="create-encrypt-rule-with-quota" value="CREATE ENCRYPT RULE `encrypt` (COLUMNS((NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc')))), (NAME=order_id, CIPHER =order_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='MD5')))))" db-types="ShardingSphere" />
- <sql-case id="create-encrypt-rule-with-query-with-cipher-column" value="CREATE ENCRYPT RULE `encrypt` (COLUMNS((NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc'))))),QUERY_WITH_CIPHER_COLUMN=false)" db-types="ShardingSphere" />
+ <sql-case id="create-encrypt-rule-with-query-with-cipher-column" value="CREATE ENCRYPT RULE `encrypt` (COLUMNS((NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,ENCRYPT_ALGORITHM(TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc'))))))" db-types="ShardingSphere" />
<sql-case id="create-shadow-rule-with-quota" value="CREATE SHADOW RULE `shadow_rule`(SOURCE=demo_ds,SHADOW=demo_ds_shadow,t_order(TYPE(NAME='REGEX_MATCH',PROPERTIES('operation'='insert','column'='user_id','regex'='[1]')),TYPE(NAME='SQL_HINT')))" db-types="ShardingSphere" />
<sql-case id="single-register-migration-source-storage-unit" value="REGISTER MIGRATION SOURCE STORAGE UNIT ds_0 (URL='jdbc:mysql://127.0.0.1:3306/test0',USER='ROOT',PASSWORD='123456');" db-types="ShardingSphere" />
<sql-case id="create-mask-rule" value="CREATE MASK RULE t_mask (COLUMNS((NAME=phone_number,TYPE(NAME='MASK_FROM_X_TO_Y', PROPERTIES('from-x'=1, 'to-y'=2, 'replace-char'='*'))), (NAME=address,TYPE(NAME=MD5))));" db-types="ShardingSphere" />
diff --git a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-cipher/dml/select/select-where.xml b/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-cipher/dml/select/select-where.xml
index 5db6d3d833e..9b044f659d9 100644
--- a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-cipher/dml/select/select-where.xml
+++ b/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-cipher/dml/select/select-where.xml
@@ -69,21 +69,6 @@
<output sql="SELECT a.account_id, a.cipher_password AS password, a.cipher_amount AS a, a.status AS s FROM t_account_bak AS a WHERE a.cipher_amount in (?, ?)" parameters="encrypt_1000, encrypt_2000" />
</rewrite-assertion>
- <rewrite-assertion id="select_plain_with_table_level_query_with_cipher_column_for_parameters" db-types="MySQL">
- <input sql="SELECT a.account_id, a.password, a.amount AS a, a.status AS s FROM t_account_detail AS a WHERE a.account_id = ? AND a.password = ? AND a.amount = ? AND a.status = ?" parameters="1, aaa, 1000, OK" />
- <output sql="SELECT a.account_id, a.plain_password AS password, a.plain_amount AS a, a.status AS s FROM t_account_detail AS a WHERE a.account_id = ? AND a.plain_password = ? AND a.plain_amount = ? AND a.status = ?" parameters="1, aaa, 1000, OK" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_plain_with_table_level_query_with_cipher_column_for_literals" db-types="MySQL">
- <input sql="SELECT a.account_id, a.password, a.amount AS a, a.status AS s FROM t_account_detail AS a WHERE a.account_id = 1 AND a.password = 'aaa' AND a.amount = '1000' AND a.status = 'OK'" />
- <output sql="SELECT a.account_id, a.plain_password AS password, a.plain_amount AS a, a.status AS s FROM t_account_detail AS a WHERE a.account_id = 1 AND a.plain_password = 'aaa' AND a.plain_amount = '1000' AND a.status = 'OK'" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_cipher_with_table_level_query_with_cipher_column_for_literals" db-types="MySQL">
- <input sql="SELECT a.account_id, a.password, a.amount AS a, a.status AS s FROM t_account_detail AS a WHERE a.account_id = 1 AND a.password = 'aaa' AND a.amount = 1000 AND a.status = 'OK'" />
- <output sql="SELECT a.account_id, a.plain_password AS password, a.plain_amount AS a, a.status AS s FROM t_account_detail AS a WHERE a.account_id = 1 AND a.plain_password = 'aaa' AND a.plain_amount = 1000 AND a.status = 'OK'" />
- </rewrite-assertion>
-
<rewrite-assertion id="select_where_with_cipher_column_like_concat_for_literals" db-types="PostgreSQL,openGauss">
<input sql="SELECT a.account_id, a.password, a.amount AS a, a.status AS s FROM t_account_bak AS a WHERE a.account_id = 1 AND a.certificate_number like concat('%','abc','%')" />
<output sql="SELECT a.account_id, a.cipher_password AS password, a.cipher_amount AS a, a.status AS s FROM t_account_bak AS a WHERE a.account_id = 1 AND a.like_query_certificate_number like concat ('like_query_%', 'like_query_abc', 'like_query_%')" />
diff --git a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/ddl/alter/alter-table.xml b/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/ddl/alter/alter-table.xml
deleted file mode 100644
index d4bbf2522bf..00000000000
--- a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/ddl/alter/alter-table.xml
+++ /dev/null
@@ -1,79 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<rewrite-assertions yaml-rule="scenario/encrypt/config/query-with-plain.yaml">
- <rewrite-assertion id="alter_table_add_column_for_plain" db-types="MySQL">
- <input sql="ALTER TABLE t_account_bak ADD COLUMN id INT NOT NULL, ADD COLUMN password VARCHAR(255) NOT NULL DEFAULT ''" />
- <output sql="ALTER TABLE t_account_bak ADD COLUMN id INT NOT NULL, ADD COLUMN cipher_password VARCHAR(255) NOT NULL DEFAULT '', ADD COLUMN assisted_query_password VARCHAR(255) NOT NULL DEFAULT '', ADD COLUMN like_query_password VARCHAR(255) NOT NULL DEFAULT '', ADD COLUMN plain_password VARCHAR(255) NOT NULL DEFAULT ''" />
- </rewrite-assertion>
-
- <rewrite-assertion id="alter_table_modify_column_for_plain" db-types="MySQL">
- <input sql="ALTER TABLE t_account_bak MODIFY COLUMN password VARCHAR(255) NOT NULL DEFAULT ''" />
- <output sql="ALTER TABLE t_account_bak MODIFY COLUMN cipher_password VARCHAR(255) NOT NULL DEFAULT '', MODIFY COLUMN assisted_query_password VARCHAR(255) NOT NULL DEFAULT '', MODIFY COLUMN like_query_password VARCHAR(255) NOT NULL DEFAULT '', MODIFY COLUMN plain_password VARCHAR(255) NOT NULL DEFAULT ''" />
- </rewrite-assertion>
-
- <rewrite-assertion id="alter_table_change_column_for_plain" db-types="MySQL">
- <input sql="ALTER TABLE t_account_bak CHANGE COLUMN password password_new VARCHAR(255) NOT NULL DEFAULT ''" />
- <output sql="ALTER TABLE t_account_bak CHANGE COLUMN cipher_password password_new_cipher VARCHAR(255) NOT NULL DEFAULT '', CHANGE COLUMN assisted_query_password password_new_assisted VARCHAR(255) NOT NULL DEFAULT '', CHANGE COLUMN like_query_password password_new_like VARCHAR(255) NOT NULL DEFAULT '', CHANGE COLUMN plain_password password_new_plain VARCHAR(255) NOT NULL DEFAULT ''" />
- </rewrite-assertion>
-
- <rewrite-assertion id="alter_table_drop_column_for_plain" db-types="MySQL">
- <input sql="ALTER TABLE t_account_bak DROP COLUMN password" />
- <output sql="ALTER TABLE t_account_bak DROP COLUMN cipher_password, DROP COLUMN assisted_query_password, DROP COLUMN like_query_password, DROP COLUMN plain_password" />
- </rewrite-assertion>
-
- <rewrite-assertion id="alter_table_drop_columns_for_plain" db-types="MySQL">
- <input sql="ALTER TABLE t_account_bak DROP COLUMN password, DROP COLUMN amount" />
- <output sql="ALTER TABLE t_account_bak DROP COLUMN cipher_password, DROP COLUMN assisted_query_password, DROP COLUMN like_query_password, DROP COLUMN plain_password, DROP COLUMN cipher_amount, DROP COLUMN plain_amount" />
- </rewrite-assertion>
-
- <rewrite-assertion id="alter_table_drop_mix_columns_for_plain" db-types="MySQL">
- <input sql="ALTER TABLE t_account_bak DROP COLUMN password, DROP COLUMN id" />
- <output sql="ALTER TABLE t_account_bak DROP COLUMN cipher_password, DROP COLUMN assisted_query_password, DROP COLUMN like_query_password, DROP COLUMN plain_password, DROP COLUMN id" />
- </rewrite-assertion>
-
- <rewrite-assertion id="alter_table_add_index_for_plain" db-types="MySQL">
- <input sql="ALTER TABLE t_account_bak ADD INDEX t_account_bak_amount(`amount`)" />
- <output sql="ALTER TABLE t_account_bak ADD INDEX t_account_bak_amount(`plain_amount`)" />
- </rewrite-assertion>
-
- <rewrite-assertion id="alter_table_modify_column_amount_for_plain" db-types="MySQL">
- <input sql="ALTER TABLE t_account MODIFY COLUMN amount text" />
- <output sql="ALTER TABLE t_account MODIFY COLUMN cipher_amount text" />
- </rewrite-assertion>
-
- <rewrite-assertion id="alter_table_change_column_amount_for_plain" db-types="MySQL">
- <input sql="ALTER TABLE t_account CHANGE COLUMN amount amount_new text" />
- <output sql="ALTER TABLE t_account CHANGE COLUMN cipher_amount amount_new_cipher text" />
- </rewrite-assertion>
-
- <rewrite-assertion id="alter_table_add_column_with_position_cipher" db-types="MySQL">
- <input sql="ALTER TABLE t_account ADD COLUMN status text AFTER amount" />
- <output sql="ALTER TABLE t_account ADD COLUMN status text AFTER cipher_amount" />
- </rewrite-assertion>
-
- <rewrite-assertion id="alter_table_modify_column_with_position_cipher" db-types="MySQL">
- <input sql="ALTER TABLE t_account MODIFY COLUMN status text AFTER amount" />
- <output sql="ALTER TABLE t_account MODIFY COLUMN status text AFTER cipher_amount" />
- </rewrite-assertion>
-
- <rewrite-assertion id="alter_table_add_column_with_cipher" db-types="MySQL">
- <input sql="ALTER TABLE t_account ADD COLUMN amount INT" />
- <output sql="ALTER TABLE t_account ADD COLUMN cipher_amount INT" />
- </rewrite-assertion>
-</rewrite-assertions>
diff --git a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/ddl/create/create-index.xml b/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/ddl/create/create-index.xml
deleted file mode 100644
index 4c79e936dac..00000000000
--- a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/ddl/create/create-index.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<rewrite-assertions yaml-rule="scenario/encrypt/config/query-with-plain.yaml">
- <rewrite-assertion id="create_index_with_assisted_query_column_for_cipher" db-types="MySQL">
- <input sql="CREATE INDEX t_account_bak_certificate_number_idx ON t_account_bak(certificate_number)" />
- <output sql="CREATE INDEX t_account_bak_certificate_number_idx ON t_account_bak(plain_certificate_number)" />
- </rewrite-assertion>
-
- <rewrite-assertion id="create_index_with_cipher_column_for_cipher" db-types="MySQL">
- <input sql="CREATE INDEX t_account_bak_amount_idx ON t_account_bak(amount)" />
- <output sql="CREATE INDEX t_account_bak_amount_idx ON t_account_bak(plain_amount)" />
- </rewrite-assertion>
-</rewrite-assertions>
diff --git a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/ddl/create/create-table.xml b/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/ddl/create/create-table.xml
deleted file mode 100644
index 2418856ca9a..00000000000
--- a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/ddl/create/create-table.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<rewrite-assertions yaml-rule="scenario/encrypt/config/query-with-plain.yaml">
- <rewrite-assertion id="create_table_for_plain" db-types="MySQL">
- <input sql="CREATE TABLE t_account_bak (id INT NOT NULL, name VARCHAR(100) NOT NULL DEFAULT '', password VARCHAR(255) NOT NULL DEFAULT '', PRIMARY KEY (`id`))" />
- <output sql="CREATE TABLE t_account_bak (id INT NOT NULL, name VARCHAR(100) NOT NULL DEFAULT '', cipher_password VARCHAR(255) NOT NULL DEFAULT '', assisted_query_password VARCHAR(255) NOT NULL DEFAULT '', like_query_password VARCHAR(255) NOT NULL DEFAULT '', plain_password VARCHAR(255) NOT NULL DEFAULT '', PRIMARY KEY (`id`))" />
- </rewrite-assertion>
-
- <rewrite-assertion id="create_table_with_index_for_plain" db-types="MySQL">
- <input sql="CREATE TABLE t_account_bak (id INT NOT NULL, name VARCHAR(100) NOT NULL DEFAULT '', password VARCHAR(255) NOT NULL DEFAULT '', PRIMARY KEY (`id`), KEY `t_account_bak_amount_idx` (`amount`))" />
- <output sql="CREATE TABLE t_account_bak (id INT NOT NULL, name VARCHAR(100) NOT NULL DEFAULT '', cipher_password VARCHAR(255) NOT NULL DEFAULT '', assisted_query_password VARCHAR(255) NOT NULL DEFAULT '', like_query_password VARCHAR(255) NOT NULL DEFAULT '', plain_password VARCHAR(255) NOT NULL DEFAULT '', PRIMARY KEY (`id`), KEY `t_account_bak_amount_idx` (`plain_amount`))" />
- </rewrite-assertion>
-</rewrite-assertions>
diff --git a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/delete/delete.xml b/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/delete/delete.xml
deleted file mode 100644
index bcd8a477ff4..00000000000
--- a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/delete/delete.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<rewrite-assertions yaml-rule="scenario/encrypt/config/query-with-plain.yaml">
-<!-- TODO FIX ME.-->
-<!-- <rewrite-assertion id="delete_for_parameters_for_plain" db-types="MySQL">-->
-<!-- <input sql="DELETE FROM t_account WHERE account_id = ? AND password = ? AND amount = ? AND status = ?" parameters="1, aaa, 1000, OK" />-->
-<!-- <output sql="DELETE FROM t_account WHERE account_id = ? AND assisted_query_password = ? AND cipher_amount = ? AND status = ?" parameters="1, assisted_query_aaa, encrypt_1000, OK" />-->
-<!-- </rewrite-assertion>-->
-
- <rewrite-assertion id="delete_for_literals_for_plain" db-types="MySQL">
- <input sql="DELETE FROM t_account WHERE account_id = 1 AND password = 'aaa' AND password like 'aaa' AND amount = 1000 AND status = 'OK'" />
- <output sql="DELETE FROM t_account WHERE account_id = 1 AND assisted_query_password = 'assisted_query_aaa' AND like_query_password like 'like_query_aaa' AND cipher_amount = 'encrypt_1000' AND status = 'OK'" />
- </rewrite-assertion>
-
- <rewrite-assertion id="delete_t_account_bak__parameters_for_plain" db-types="MySQL">
- <input sql="DELETE FROM t_account_bak WHERE account_id = ? AND password = ? AND password like ? AND amount = ? AND status = ?" parameters="1, aaa, aaa, 1000, OK" />
- <output sql="DELETE FROM t_account_bak WHERE account_id = ? AND plain_password = ? AND plain_password like ? AND plain_amount = ? AND status = ?" parameters="1, aaa, aaa, 1000, OK" />
- </rewrite-assertion>
-
- <rewrite-assertion id="delete_t_account_bak_for_literals_for_plain" db-types="MySQL">
- <input sql="DELETE FROM t_account_bak WHERE account_id = 1 AND password = 'aaa' AND password like 'aaa' AND amount = 1000 AND status = 'OK'" />
- <output sql="DELETE FROM t_account_bak WHERE account_id = 1 AND plain_password = 'aaa' AND plain_password like 'aaa' AND plain_amount = 1000 AND status = 'OK'" />
- </rewrite-assertion>
-
- <rewrite-assertion id="delete_t_account_bak_with_alias_for_parameters" db-types="MySQL">
- <input sql="DELETE t FROM t_account_bak t WHERE t.account_id = ? AND t.password = ? AND t.password like ? AND t.amount = ? AND t.status = ?" parameters="1, aaa, aaa, 1000, OK" />
- <output sql="DELETE t FROM t_account_bak t WHERE t.account_id = ? AND t.plain_password = ? AND t.plain_password like ? AND t.plain_amount = ? AND t.status = ?" parameters="1, aaa, aaa, 1000, OK" />
- </rewrite-assertion>
-
- <rewrite-assertion id="delete_t_account_bak_with_alias_for_literals" db-types="MySQL">
- <input sql="DELETE t FROM t_account_bak t WHERE t.account_id = 1 AND t.password = 'aaa' AND t.password like 'aaa' AND t.amount = 1000 AND t.status = 'OK'" />
- <output sql="DELETE t FROM t_account_bak t WHERE t.account_id = 1 AND t.plain_password = 'aaa' AND t.plain_password like 'aaa' AND t.plain_amount = 1000 AND t.status = 'OK'" />
- </rewrite-assertion>
-</rewrite-assertions>
diff --git a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/insert/insert-column.xml b/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/insert/insert-column.xml
deleted file mode 100644
index 6d2b492636a..00000000000
--- a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/insert/insert-column.xml
+++ /dev/null
@@ -1,124 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<rewrite-assertions yaml-rule="scenario/encrypt/config/query-with-plain.yaml">
- <rewrite-assertion id="insert_values_with_columns_for_parameters_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account(account_id, certificate_number, password, amount, status) VALUES (?, ?, ?, ?, ?), (2, '222X', 'bbb', 2000, 'OK'), (?, ?, ?, ?, ?), (4, '444X', 'ddd', 4000, 'OK')" parameters="1, 111X, aaa, 1000, OK, 3, 333X, ccc, 3000, OK" />
- <output sql="INSERT INTO t_account(account_id, cipher_certificate_number, assisted_query_certificate_number, like_query_certificate_number, cipher_password, assisted_query_password, like_query_password, cipher_amount, status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?), (2, 'encrypt_222X', 'assisted_query_222X', 'like_query_222X', 'encrypt_bbb', 'assisted_query_bbb', 'like_query_bbb', 'encrypt_2000', 'OK'), (?, ?, ?, ?, ?, ?, ?, ?, ?), (4, 'encrypt_444X', 'assisted_query_444X', 'like_quer [...]
- </rewrite-assertion>
-
- <rewrite-assertion id="insert_values_with_columns_for_literals_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account(account_id, certificate_number, password, amount, status) VALUES (1, '111X', 'aaa', 1000, 'OK'), (2, '222X', 'bbb', 2000, 'OK'), (3, '333X', 'ccc', 3000, 'OK'), (4, '444X', 'ddd', 4000, 'OK')" />
- <output sql="INSERT INTO t_account(account_id, cipher_certificate_number, assisted_query_certificate_number, like_query_certificate_number, cipher_password, assisted_query_password, like_query_password, cipher_amount, status) VALUES (1, 'encrypt_111X', 'assisted_query_111X', 'like_query_111X', 'encrypt_aaa', 'assisted_query_aaa', 'like_query_aaa', 'encrypt_1000', 'OK'), (2, 'encrypt_222X', 'assisted_query_222X', 'like_query_222X', 'encrypt_bbb', 'assisted_query_bbb', 'like_query_ [...]
- </rewrite-assertion>
-
- <rewrite-assertion id="insert_values_with_columns_and_configuration_for_different_sequence_for_parameters_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account(password, certificate_number, account_id, amount, status) VALUES (?, ?, ?, ?, ?), ('bbb', '222X', 2, 2000, 'OK'), (?, ?, ?, ?, ?), ('ddd', '444X', 4, 4000, 'OK')" parameters="aaa, 111X, 1, 1000, OK, ccc, 333X, 3, 3000, OK" />
- <output sql="INSERT INTO t_account(cipher_password, assisted_query_password, like_query_password, cipher_certificate_number, assisted_query_certificate_number, like_query_certificate_number, account_id, cipher_amount, status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?), ('encrypt_bbb', 'assisted_query_bbb', 'like_query_bbb', 'encrypt_222X', 'assisted_query_222X', 'like_query_222X', 2, 'encrypt_2000', 'OK'), (?, ?, ?, ?, ?, ?, ?, ?, ?), ('encrypt_ddd', 'assisted_query_ddd', 'like_query_ddd [...]
- </rewrite-assertion>
-
- <rewrite-assertion id="insert_values_with_columns_and_configuration_for_different_sequence_for_literals_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account(password, certificate_number, account_id, amount, status) VALUES ('aaa', '111X', 1, 1000, 'OK'), ('bbb', '222X', 2, 2000, 'OK'), ('ccc', '333X', 3, 3000, 'OK'), ('ddd', '444X', 4, 4000, 'OK')" />
- <output sql="INSERT INTO t_account(cipher_password, assisted_query_password, like_query_password, cipher_certificate_number, assisted_query_certificate_number, like_query_certificate_number, account_id, cipher_amount, status) VALUES ('encrypt_aaa', 'assisted_query_aaa', 'like_query_aaa', 'encrypt_111X', 'assisted_query_111X', 'like_query_111X', 1, 'encrypt_1000', 'OK'), ('encrypt_bbb', 'assisted_query_bbb', 'like_query_bbb', 'encrypt_222X', 'assisted_query_222X', 'like_query_222X [...]
- </rewrite-assertion>
-
- <rewrite-assertion id="insert_values_with_columns_with_plain_for_parameters_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account_bak(account_id, certificate_number, password, amount, status) VALUES (?, ?, ?, ?, ?), (2, '222X', 'bbb', 2000, 'OK'), (?, ?, ?, ?, ?), (4, '444X', 'ddd', 4000, 'OK')" parameters="1, 111X, aaa, 1000, OK, 3, 333X, ccc, 3000, OK" />
- <output sql="INSERT INTO t_account_bak(account_id, cipher_certificate_number, assisted_query_certificate_number, like_query_certificate_number, plain_certificate_number, cipher_password, assisted_query_password, like_query_password, plain_password, cipher_amount, plain_amount, status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?), (2, 'encrypt_222X', 'assisted_query_222X', 'like_query_222X', '222X', 'encrypt_bbb', 'assisted_query_bbb', 'like_query_bbb', 'bbb', 'encrypt_2000', 2000, [...]
- </rewrite-assertion>
-
- <rewrite-assertion id="insert_values_with_columns_with_plain_for_literals_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account_bak(account_id, certificate_number, password, amount, status) VALUES (1, '111X', 'aaa', 1000, 'OK'), (2, '222X', 'bbb', 2000, 'OK'), (3, '333X', 'ccc', 3000, 'OK'), (4, '444X', 'ddd', 4000, 'OK')" />
- <output sql="INSERT INTO t_account_bak(account_id, cipher_certificate_number, assisted_query_certificate_number, like_query_certificate_number, plain_certificate_number, cipher_password, assisted_query_password, like_query_password, plain_password, cipher_amount, plain_amount, status) VALUES (1, 'encrypt_111X', 'assisted_query_111X', 'like_query_111X', '111X', 'encrypt_aaa', 'assisted_query_aaa', 'like_query_aaa', 'aaa', 'encrypt_1000', 1000, 'OK'), (2, 'encrypt_222X', 'assisted_ [...]
- </rewrite-assertion>
-
- <rewrite-assertion id="insert_values_without_columns_for_parameters_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account VALUES (?, ?, ?, ?), (2, '222X', 'bbb', 2000), (?, ?, ?, ?), (4, '444X', 'ddd', 4000)" parameters="1, 111X, aaa, 1000, 3, 333X, ccc, 3000" />
- <output sql="INSERT INTO t_account(account_id, cipher_certificate_number, assisted_query_certificate_number, like_query_certificate_number, cipher_password, assisted_query_password, like_query_password, cipher_amount) VALUES (?, ?, ?, ?, ?, ?, ?, ?), (2, 'encrypt_222X', 'assisted_query_222X', 'like_query_222X', 'encrypt_bbb', 'assisted_query_bbb', 'like_query_bbb', 'encrypt_2000'), (?, ?, ?, ?, ?, ?, ?, ?), (4, 'encrypt_444X', 'assisted_query_444X', 'like_query_444X', 'encrypt_dd [...]
- </rewrite-assertion>
-
- <rewrite-assertion id="insert_values_without_columns_for_literals_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account VALUES (1, '111X', 'aaa', 1000), (2, '222X', 'bbb', 2000), (3, '333X', 'ccc', 3000), (4, '444X', 'ddd', 4000)" />
- <output sql="INSERT INTO t_account(account_id, cipher_certificate_number, assisted_query_certificate_number, like_query_certificate_number, cipher_password, assisted_query_password, like_query_password, cipher_amount) VALUES (1, 'encrypt_111X', 'assisted_query_111X', 'like_query_111X', 'encrypt_aaa', 'assisted_query_aaa', 'like_query_aaa', 'encrypt_1000'), (2, 'encrypt_222X', 'assisted_query_222X', 'like_query_222X', 'encrypt_bbb', 'assisted_query_bbb', 'like_query_bbb', 'encrypt [...]
- </rewrite-assertion>
-
- <rewrite-assertion id="insert_values_without_columns_with_plain_for_parameters_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account_bak VALUES (?, ?, ?, ?), (2, '222X', 'bbb', 2000), (?, ?, ?, ?), (4, '444X', 'ddd', 4000)" parameters="1, 111X, aaa, 1000, 3, 333X, ccc, 3000" />
- <output sql="INSERT INTO t_account_bak(account_id, cipher_certificate_number, assisted_query_certificate_number, like_query_certificate_number, plain_certificate_number, cipher_password, assisted_query_password, like_query_password, plain_password, cipher_amount, plain_amount) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?), (2, 'encrypt_222X', 'assisted_query_222X', 'like_query_222X', '222X', 'encrypt_bbb', 'assisted_query_bbb', 'like_query_bbb', 'bbb', 'encrypt_2000', 2000), (?, ?, ?, [...]
- </rewrite-assertion>
-
- <rewrite-assertion id="insert_values_without_columns_with_plain_for_literals_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account_bak VALUES (1, '111X', 'aaa', 1000), (2, '222X', 'bbb', 2000), (3, '333X', 'ccc', 3000), (4, '444X', 'ddd', 4000)" />
- <output sql="INSERT INTO t_account_bak(account_id, cipher_certificate_number, assisted_query_certificate_number, like_query_certificate_number, plain_certificate_number, cipher_password, assisted_query_password, like_query_password, plain_password, cipher_amount, plain_amount) VALUES (1, 'encrypt_111X', 'assisted_query_111X', 'like_query_111X', '111X', 'encrypt_aaa', 'assisted_query_aaa', 'like_query_aaa', 'aaa', 'encrypt_1000', 1000), (2, 'encrypt_222X', 'assisted_query_222X', ' [...]
- </rewrite-assertion>
-
- <rewrite-assertion id="mixed_insert_values_with_columns_for_parameters_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account(account_id, certificate_number, password, amount, status) VALUES (?, '111X', ?, ?, ?), (2, '222X', 'bbb', 2000, 'OK'), (?, '333X', ?, ?, ?), (4, '444X', 'ddd', 4000, 'OK')" parameters="1, aaa, 1000, OK, 3, ccc, 3000, OK" />
- <output sql="INSERT INTO t_account(account_id, cipher_certificate_number, assisted_query_certificate_number, like_query_certificate_number, cipher_password, assisted_query_password, like_query_password, cipher_amount, status) VALUES (?, 'encrypt_111X', 'assisted_query_111X', 'like_query_111X', ?, ?, ?, ?, ?), (2, 'encrypt_222X', 'assisted_query_222X', 'like_query_222X', 'encrypt_bbb', 'assisted_query_bbb', 'like_query_bbb', 'encrypt_2000', 'OK'), (?, 'encrypt_333X', 'assisted_que [...]
- </rewrite-assertion>
-
- <rewrite-assertion id="mixed_insert_values_with_columns_for_literals_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account(account_id, certificate_number, password, amount, status) VALUES (1, ?, 'aaa', 1000, 'OK'), (2, '222X', 'bbb', 2000, 'OK'), (3, ?, 'ccc', 3000, 'OK'), (4, '444X', 'ddd', 4000, 'OK')" parameters="111X, 333X" />
- <output sql="INSERT INTO t_account(account_id, cipher_certificate_number, assisted_query_certificate_number, like_query_certificate_number, cipher_password, assisted_query_password, like_query_password, cipher_amount, status) VALUES (1, ?, ?, ?, 'encrypt_aaa', 'assisted_query_aaa', 'like_query_aaa', 'encrypt_1000', 'OK'), (2, 'encrypt_222X', 'assisted_query_222X', 'like_query_222X', 'encrypt_bbb', 'assisted_query_bbb', 'like_query_bbb', 'encrypt_2000', 'OK'), (3, ?, ?, ?, 'encryp [...]
- </rewrite-assertion>
-
- <rewrite-assertion id="mixed_insert_values_with_columns_and_configuration_for_different_sequence_for_parameters_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account(password, certificate_number, account_id, amount, status) VALUES (?, ?, ?, 1000, ?), ('bbb', '222X', 2, 2000, 'OK'), (?, ?, ?, 3000, ?), ('ddd', '444X', 4, 4000, 'OK')" parameters="aaa, 111X, 1, OK, ccc, 333X, 3, OK" />
- <output sql="INSERT INTO t_account(cipher_password, assisted_query_password, like_query_password, cipher_certificate_number, assisted_query_certificate_number, like_query_certificate_number, account_id, cipher_amount, status) VALUES (?, ?, ?, ?, ?, ?, ?, 'encrypt_1000', ?), ('encrypt_bbb', 'assisted_query_bbb', 'like_query_bbb', 'encrypt_222X', 'assisted_query_222X', 'like_query_222X', 2, 'encrypt_2000', 'OK'), (?, ?, ?, ?, ?, ?, ?, 'encrypt_3000', ?), ('encrypt_ddd', 'assisted_q [...]
- </rewrite-assertion>
-
- <rewrite-assertion id="mixed_insert_values_with_columns_and_configuration_for_different_sequence_for_literals_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account(password, certificate_number, account_id, amount, status) VALUES ('aaa', ?, 1, 1000, 'OK'), ('bbb', '222X', 2, 2000, 'OK'), ('ccc', ?, 3, 3000, 'OK'), ('ddd', '444X', 4, 4000, 'OK')" parameters="111X, 333X" />
- <output sql="INSERT INTO t_account(cipher_password, assisted_query_password, like_query_password, cipher_certificate_number, assisted_query_certificate_number, like_query_certificate_number, account_id, cipher_amount, status) VALUES ('encrypt_aaa', 'assisted_query_aaa', 'like_query_aaa', ?, ?, ?, 1, 'encrypt_1000', 'OK'), ('encrypt_bbb', 'assisted_query_bbb', 'like_query_bbb', 'encrypt_222X', 'assisted_query_222X', 'like_query_222X', 2, 'encrypt_2000', 'OK'), ('encrypt_ccc', 'ass [...]
- </rewrite-assertion>
-
- <rewrite-assertion id="mixed_insert_values_with_columns_with_plain_for_parameters_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account_bak(account_id, certificate_number, password, amount, status) VALUES (?, ?, ?, ?, 'OK'), (2, '222X', 'bbb', 2000, 'OK'), (?, ?, ?, ?, 'OK'), (4, '444X', 'ddd', 4000, 'OK')" parameters="1, 111X, aaa, 1000, 3, 333X, ccc, 3000" />
- <output sql="INSERT INTO t_account_bak(account_id, cipher_certificate_number, assisted_query_certificate_number, like_query_certificate_number, plain_certificate_number, cipher_password, assisted_query_password, like_query_password, plain_password, cipher_amount, plain_amount, status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'OK'), (2, 'encrypt_222X', 'assisted_query_222X', 'like_query_222X', '222X', 'encrypt_bbb', 'assisted_query_bbb', 'like_query_bbb', 'bbb', 'encrypt_2000', 20 [...]
- </rewrite-assertion>
-
- <rewrite-assertion id="mixed_insert_values_with_columns_with_plain_for_literals_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account_bak(account_id, certificate_number, password, amount, status) VALUES (1, ?, 'aaa', 1000, 'OK'), (2, '222X', 'bbb', 2000, 'OK'), (3, ?, 'ccc', 3000, 'OK'), (4, '444X', 'ddd', 4000, 'OK')" parameters="111X, 333X" />
- <output sql="INSERT INTO t_account_bak(account_id, cipher_certificate_number, assisted_query_certificate_number, like_query_certificate_number, plain_certificate_number, cipher_password, assisted_query_password, like_query_password, plain_password, cipher_amount, plain_amount, status) VALUES (1, ?, ?, ?, ?, 'encrypt_aaa', 'assisted_query_aaa', 'like_query_aaa', 'aaa', 'encrypt_1000', 1000, 'OK'), (2, 'encrypt_222X', 'assisted_query_222X', 'like_query_222X', '222X', 'encrypt_bbb', [...]
- </rewrite-assertion>
-
- <rewrite-assertion id="mixed_insert_values_without_columns_for_parameters_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account VALUES (?, '111X', ?, ?), (2, '222X', 'bbb', 2000), (?, '333X', ?, ?), (4, '444X', 'ddd', 4000)" parameters="1, aaa, 1000, 3, ccc, 3000" />
- <output sql="INSERT INTO t_account(account_id, cipher_certificate_number, assisted_query_certificate_number, like_query_certificate_number, cipher_password, assisted_query_password, like_query_password, cipher_amount) VALUES (?, 'encrypt_111X', 'assisted_query_111X', 'like_query_111X', ?, ?, ?, ?), (2, 'encrypt_222X', 'assisted_query_222X', 'like_query_222X', 'encrypt_bbb', 'assisted_query_bbb', 'like_query_bbb', 'encrypt_2000'), (?, 'encrypt_333X', 'assisted_query_333X', 'like_q [...]
- </rewrite-assertion>
-
- <rewrite-assertion id="mixed_insert_values_without_columns_for_literals_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account VALUES (1, '111X', ?, 1000), (2, '222X', 'bbb', 2000), (3, '333X', ?, 3000), (4, '444X', 'ddd', 4000)" parameters="aaa, ccc" />
- <output sql="INSERT INTO t_account(account_id, cipher_certificate_number, assisted_query_certificate_number, like_query_certificate_number, cipher_password, assisted_query_password, like_query_password, cipher_amount) VALUES (1, 'encrypt_111X', 'assisted_query_111X', 'like_query_111X', ?, ?, ?, 'encrypt_1000'), (2, 'encrypt_222X', 'assisted_query_222X', 'like_query_222X', 'encrypt_bbb', 'assisted_query_bbb', 'like_query_bbb', 'encrypt_2000'), (3, 'encrypt_333X', 'assisted_query_3 [...]
- </rewrite-assertion>
-
- <rewrite-assertion id="mixed_insert_values_without_columns_with_plain_for_parameters_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account_bak VALUES (?, ?, 'aaa', ?), (2, '222X', 'bbb', 2000), (?, ?, 'ccc', ?), (4, '444X', 'ddd', 4000)" parameters="1, 111X, 1000, 3, 333X, 3000" />
- <output sql="INSERT INTO t_account_bak(account_id, cipher_certificate_number, assisted_query_certificate_number, like_query_certificate_number, plain_certificate_number, cipher_password, assisted_query_password, like_query_password, plain_password, cipher_amount, plain_amount) VALUES (?, ?, ?, ?, ?, 'encrypt_aaa', 'assisted_query_aaa', 'like_query_aaa', 'aaa', ?, ?), (2, 'encrypt_222X', 'assisted_query_222X', 'like_query_222X', '222X', 'encrypt_bbb', 'assisted_query_bbb', 'like_q [...]
- </rewrite-assertion>
-
- <rewrite-assertion id="mixed_insert_values_without_columns_with_plain_for_literals_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account_bak VALUES (1, ?, 'aaa', 1000), (2, '222X', 'bbb', 2000), (3, ?, 'ccc', 3000), (4, '444X', 'ddd', 4000)" parameters="111X, 333X" />
- <output sql="INSERT INTO t_account_bak(account_id, cipher_certificate_number, assisted_query_certificate_number, like_query_certificate_number, plain_certificate_number, cipher_password, assisted_query_password, like_query_password, plain_password, cipher_amount, plain_amount) VALUES (1, ?, ?, ?, ?, 'encrypt_aaa', 'assisted_query_aaa', 'like_query_aaa', 'aaa', 'encrypt_1000', 1000), (2, 'encrypt_222X', 'assisted_query_222X', 'like_query_222X', '222X', 'encrypt_bbb', 'assisted_que [...]
- </rewrite-assertion>
-
- <rewrite-assertion id="insert_values_with_null_encrypt_column_for_plain" db-types="MySQL,PostgreSQL,openGauss">
- <input sql="INSERT INTO t_account(account_id, certificate_number, password, amount, status) VALUES (?, ?, ?, ?, ?), (2, '222X', NULL, 2000, 'OK'), (?, ?, ?, ?, ?), (4, '444X', 'ddd', NULL, 'OK')" parameters="1, NULL, aaa, 1000, OK, 3, 333X, NULL, 3000, OK" />
- <output sql="INSERT INTO t_account(account_id, cipher_certificate_number, assisted_query_certificate_number, like_query_certificate_number, cipher_password, assisted_query_password, like_query_password, cipher_amount, status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?), (2, 'encrypt_222X', 'assisted_query_222X', 'like_query_222X', NULL, NULL, NULL, 'encrypt_2000', 'OK'), (?, ?, ?, ?, ?, ?, ?, ?, ?), (4, 'encrypt_444X', 'assisted_query_444X', 'like_query_444X', 'encrypt_ddd', 'assisted_que [...]
- </rewrite-assertion>
-</rewrite-assertions>
diff --git a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/insert/insert-on-duplicate.xml b/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/insert/insert-on-duplicate.xml
deleted file mode 100644
index 8bc32f31f29..00000000000
--- a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/insert/insert-on-duplicate.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<rewrite-assertions yaml-rule="scenario/encrypt/config/query-with-plain.yaml">
- <rewrite-assertion id="insert_values_on_duplicated_update_values_for_plain_for_parameters" db-types="MySQL">
- <input sql="INSERT INTO t_account(account_id, certificate_number, password, amount, status) VALUES (?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE certificate_number = VALUES(certificate_number)" parameters="1, 111X, aaa, 1000, OK" />
- <output sql="INSERT INTO t_account(account_id, cipher_certificate_number, assisted_query_certificate_number, like_query_certificate_number, cipher_password, assisted_query_password, like_query_password, cipher_amount, status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE cipher_certificate_number = VALUES(cipher_certificate_number), assisted_query_certificate_number = VALUES(assisted_query_certificate_number), like_query_certificate_number = VALUES(like_query_certifi [...]
- </rewrite-assertion>
-
- <rewrite-assertion id="insert_values_on_duplicated_update_values_for_plain_for_literals" db-types="MySQL">
- <input sql="INSERT INTO t_account(account_id, certificate_number, password, amount, status) VALUES (1, '111X', 'aaa', 1000, 'OK') ON DUPLICATE KEY UPDATE certificate_number = VALUES(certificate_number)" />
- <output sql="INSERT INTO t_account(account_id, cipher_certificate_number, assisted_query_certificate_number, like_query_certificate_number, cipher_password, assisted_query_password, like_query_password, cipher_amount, status) VALUES (1, 'encrypt_111X', 'assisted_query_111X', 'like_query_111X', 'encrypt_aaa', 'assisted_query_aaa', 'like_query_aaa', 'encrypt_1000', 'OK') ON DUPLICATE KEY UPDATE cipher_certificate_number = VALUES(cipher_certificate_number), assisted_query_certificat [...]
- </rewrite-assertion>
-
- <rewrite-assertion id="insert_values_on_duplicated_update_values_wrong_match_for_plain_for_parameters" db-types="MySQL">
- <input sql="INSERT INTO t_account(account_id, certificate_number, password, amount, status) VALUES (?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE status = VALUES(status)" parameters="1, 111X, aaa, 1000, OK" />
- <output sql="INSERT INTO t_account(account_id, cipher_certificate_number, assisted_query_certificate_number, like_query_certificate_number, cipher_password, assisted_query_password, like_query_password, cipher_amount, status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE status = VALUES(status)" parameters="1, encrypt_111X, assisted_query_111X, like_query_111X, encrypt_aaa, assisted_query_aaa, like_query_aaa, encrypt_1000, OK" />
- </rewrite-assertion>
-
- <rewrite-assertion id="insert_values_on_duplicated_update_values_wrong_match_for_plain_for_literals" db-types="MySQL">
- <input sql="INSERT INTO t_account(account_id, certificate_number, password, amount, status) VALUES (1, '111X', 'aaa', 1000, 'OK') ON DUPLICATE KEY UPDATE status = VALUES(status)" />
- <output sql="INSERT INTO t_account(account_id, cipher_certificate_number, assisted_query_certificate_number, like_query_certificate_number, cipher_password, assisted_query_password, like_query_password, cipher_amount, status) VALUES (1, 'encrypt_111X', 'assisted_query_111X', 'like_query_111X', 'encrypt_aaa', 'assisted_query_aaa', 'like_query_aaa', 'encrypt_1000', 'OK') ON DUPLICATE KEY UPDATE status = VALUES(status)" />
- </rewrite-assertion>
-
- <rewrite-assertion id="insert_values_with_on_duplicate_key_update_with_columns_with_plain_for_parameters_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account_bak(account_id, certificate_number, password, amount, status) VALUES (?, ?, ?, ?, ?), (2, '222X', 'bbb', 2000, 'OK'), (?, ?, ?, ?, ?), (4, '444X', 'ddd', 4000, 'OK') ON DUPLICATE KEY UPDATE password = ?" parameters="1, 111X, aaa, 1000, OK, 3, 333X, ccc, 3000, OK, ccc_update" />
- <output sql="INSERT INTO t_account_bak(account_id, cipher_certificate_number, assisted_query_certificate_number, like_query_certificate_number, plain_certificate_number, cipher_password, assisted_query_password, like_query_password, plain_password, cipher_amount, plain_amount, status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?), (2, 'encrypt_222X', 'assisted_query_222X', 'like_query_222X', '222X', 'encrypt_bbb', 'assisted_query_bbb', 'like_query_bbb', 'bbb', 'encrypt_2000', 2000, [...]
- </rewrite-assertion>
-
- <rewrite-assertion id="insert_values_with_on_duplicate_key_update_with_columns_with_plain_for_literals_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account_bak(account_id, certificate_number, password, amount, status) VALUES (1, '111X', 'aaa', 1000, 'OK'), (2, '222X', 'bbb', 2000, 'OK'), (3, '333X', 'ccc', 3000, 'OK'), (4, '444X', 'ddd', 4000, 'OK') ON DUPLICATE KEY UPDATE password = 'ccc_update'" />
- <output sql="INSERT INTO t_account_bak(account_id, cipher_certificate_number, assisted_query_certificate_number, like_query_certificate_number, plain_certificate_number, cipher_password, assisted_query_password, like_query_password, plain_password, cipher_amount, plain_amount, status) VALUES (1, 'encrypt_111X', 'assisted_query_111X', 'like_query_111X', '111X', 'encrypt_aaa', 'assisted_query_aaa', 'like_query_aaa', 'aaa', 'encrypt_1000', 1000, 'OK'), (2, 'encrypt_222X', 'assisted_ [...]
- </rewrite-assertion>
-
- <rewrite-assertion id="insert_values_with_on_duplicate_key_update_with_insert_value_literals_and_on_duplicate_parameterized_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account_bak(account_id, certificate_number, password, amount, status) VALUES (1, '111X', 'aaa', 1000, 'OK'), (2, '222X', 'bbb', 2000, 'OK'), (3, '333X', 'ccc', 3000, 'OK'), (4, '444X', 'ddd', 4000, 'OK') ON DUPLICATE KEY UPDATE password = ?" parameters="ccc_update" />
- <output sql="INSERT INTO t_account_bak(account_id, cipher_certificate_number, assisted_query_certificate_number, like_query_certificate_number, plain_certificate_number, cipher_password, assisted_query_password, like_query_password, plain_password, cipher_amount, plain_amount, status) VALUES (1, 'encrypt_111X', 'assisted_query_111X', 'like_query_111X', '111X', 'encrypt_aaa', 'assisted_query_aaa', 'like_query_aaa', 'aaa', 'encrypt_1000', 1000, 'OK'), (2, 'encrypt_222X', 'assisted_ [...]
- </rewrite-assertion>
-
- <rewrite-assertion id="mixed_insert_values_with_on_duplicate_key_update_with_columns_with_plain_for_parameters_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account_bak(account_id, certificate_number, password, amount, status) VALUES (?, ?, 'aaa', ?, ?), (2, '222X', ?, 2000, 'OK'), (?, ?, ?, ?, ?), (4, '444X', 'ddd', 4000, 'OK') ON DUPLICATE KEY UPDATE password = ?" parameters="1, 111X, 1000, OK, bbb, 3, 333X, ccc, 3000, OK, ccc_update" />
- <output sql="INSERT INTO t_account_bak(account_id, cipher_certificate_number, assisted_query_certificate_number, like_query_certificate_number, plain_certificate_number, cipher_password, assisted_query_password, like_query_password, plain_password, cipher_amount, plain_amount, status) VALUES (?, ?, ?, ?, ?, 'encrypt_aaa', 'assisted_query_aaa', 'like_query_aaa', 'aaa', ?, ?, ?), (2, 'encrypt_222X', 'assisted_query_222X', 'like_query_222X', '222X', ?, ?, ?, ?, 'encrypt_2000', 2000, [...]
- </rewrite-assertion>
-
- <rewrite-assertion id="mixed_insert_values_with_on_duplicate_key_update_with_insert_value_literals_and_on_duplicate_parameterized_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account_bak(account_id, certificate_number, password, amount, status) VALUES (1, ?, 'aaa', 1000, 'OK'), (2, '222X', 'bbb', 2000, 'OK'), (3, ?, 'ccc', 3000, 'OK'), (4, '444X', 'ddd', 4000, 'OK') ON DUPLICATE KEY UPDATE password = ?" parameters="111X, 333X, ccc_update" />
- <output sql="INSERT INTO t_account_bak(account_id, cipher_certificate_number, assisted_query_certificate_number, like_query_certificate_number, plain_certificate_number, cipher_password, assisted_query_password, like_query_password, plain_password, cipher_amount, plain_amount, status) VALUES (1, ?, ?, ?, ?, 'encrypt_aaa', 'assisted_query_aaa', 'like_query_aaa', 'aaa', 'encrypt_1000', 1000, 'OK'), (2, 'encrypt_222X', 'assisted_query_222X', 'like_query_222X', '222X', 'encrypt_bbb', [...]
- </rewrite-assertion>
-</rewrite-assertions>
diff --git a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/insert/insert-set.xml b/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/insert/insert-set.xml
deleted file mode 100644
index 40efe925d8e..00000000000
--- a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/insert/insert-set.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<rewrite-assertions yaml-rule="scenario/encrypt/config/query-with-plain.yaml">
- <rewrite-assertion id="insert_set_for_parameters_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account SET account_id = ?, certificate_number = ?, password = ?, amount = ?, status = ?" parameters="1, 111X, aaa, 1000, OK" />
- <output sql="INSERT INTO t_account SET account_id = ?, cipher_certificate_number = ?, assisted_query_certificate_number = ?, like_query_certificate_number = ?, cipher_password = ?, assisted_query_password = ?, like_query_password = ?, cipher_amount = ?, status = ?" parameters="1, encrypt_111X, assisted_query_111X, like_query_111X, encrypt_aaa, assisted_query_aaa, like_query_aaa, encrypt_1000, OK" />
- </rewrite-assertion>
-
- <rewrite-assertion id="insert_set_for_literals_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account SET account_id = 1, certificate_number = '111X', password = 'aaa', amount = 1000, status = 'OK'" />
- <output sql="INSERT INTO t_account SET account_id = 1, cipher_certificate_number = 'encrypt_111X', assisted_query_certificate_number = 'assisted_query_111X', like_query_certificate_number = 'like_query_111X', cipher_password = 'encrypt_aaa', assisted_query_password = 'assisted_query_aaa', like_query_password = 'like_query_aaa', cipher_amount = 'encrypt_1000', status = 'OK'" />
- </rewrite-assertion>
-
- <rewrite-assertion id="insert_set_with_plain_for_parameters_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account_bak SET account_id = ?, certificate_number = ?, password = ?, amount = ?, status = ?" parameters="1, 111X, aaa, 1000, OK" />
- <output sql="INSERT INTO t_account_bak SET account_id = ?, cipher_certificate_number = ?, assisted_query_certificate_number = ?, like_query_certificate_number = ?, plain_certificate_number = ?, cipher_password = ?, assisted_query_password = ?, like_query_password = ?, plain_password = ?, cipher_amount = ?, plain_amount = ?, status = ?" parameters="1, encrypt_111X, assisted_query_111X, like_query_111X, 111X, encrypt_aaa, assisted_query_aaa, like_query_aaa, aaa, encrypt_1000, 1000, OK" />
- </rewrite-assertion>
-
- <rewrite-assertion id="insert_set_with_plain_for_literals_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account_bak SET account_id = 1, certificate_number = '111X', password = 'aaa', amount = 1000, status = 'OK'" />
- <output sql="INSERT INTO t_account_bak SET account_id = 1, cipher_certificate_number = 'encrypt_111X', assisted_query_certificate_number = 'assisted_query_111X', like_query_certificate_number = 'like_query_111X', plain_certificate_number = '111X', cipher_password = 'encrypt_aaa', assisted_query_password = 'assisted_query_aaa', like_query_password = 'like_query_aaa', plain_password = 'aaa', cipher_amount = 'encrypt_1000', plain_amount = 1000, status = 'OK'" />
- </rewrite-assertion>
-
- <rewrite-assertion id="mixed_insert_set_for_parameters_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account SET account_id = 1, certificate_number = ?, password = ?, amount = ?, status = ?" parameters="111X, aaa, 1000, OK" />
- <output sql="INSERT INTO t_account SET account_id = 1, cipher_certificate_number = ?, assisted_query_certificate_number = ?, like_query_certificate_number = ?, cipher_password = ?, assisted_query_password = ?, like_query_password = ?, cipher_amount = ?, status = ?" parameters="encrypt_111X, assisted_query_111X, like_query_111X, encrypt_aaa, assisted_query_aaa, like_query_aaa, encrypt_1000, OK" />
- </rewrite-assertion>
-
- <rewrite-assertion id="mixed_insert_set_for_literals_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account SET account_id = 1, certificate_number = ?, password = 'aaa', amount = 1000, status = 'OK'" parameters="111X" />
- <output sql="INSERT INTO t_account SET account_id = 1, cipher_certificate_number = ?, assisted_query_certificate_number = ?, like_query_certificate_number = ?, cipher_password = 'encrypt_aaa', assisted_query_password = 'assisted_query_aaa', like_query_password = 'like_query_aaa', cipher_amount = 'encrypt_1000', status = 'OK'" parameters="encrypt_111X, assisted_query_111X, like_query_111X" />
- </rewrite-assertion>
-
- <rewrite-assertion id="mixed_insert_set_with_plain_for_parameters_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account_bak SET account_id = ?, certificate_number = ?, password = 'aaa', amount = ?, status = ?" parameters="1, 111X, 1000, OK" />
- <output sql="INSERT INTO t_account_bak SET account_id = ?, cipher_certificate_number = ?, assisted_query_certificate_number = ?, like_query_certificate_number = ?, plain_certificate_number = ?, cipher_password = 'encrypt_aaa', assisted_query_password = 'assisted_query_aaa', like_query_password = 'like_query_aaa', plain_password = 'aaa', cipher_amount = ?, plain_amount = ?, status = ?" parameters="1, encrypt_111X, assisted_query_111X, like_query_111X, 111X, encrypt_1000, 1000, OK" />
- </rewrite-assertion>
-
- <rewrite-assertion id="mixed_insert_set_with_plain_for_literals_for_plain" db-types="MySQL">
- <input sql="INSERT INTO t_account_bak SET account_id = 1, certificate_number = '111X', password = 'aaa', amount = ?, status = 'OK'" parameters="1000" />
- <output sql="INSERT INTO t_account_bak SET account_id = 1, cipher_certificate_number = 'encrypt_111X', assisted_query_certificate_number = 'assisted_query_111X', like_query_certificate_number = 'like_query_111X', plain_certificate_number = '111X', cipher_password = 'encrypt_aaa', assisted_query_password = 'assisted_query_aaa', like_query_password = 'like_query_aaa', plain_password = 'aaa', cipher_amount = ?, plain_amount = ?, status = 'OK'" parameters="encrypt_1000, 1000" />
- </rewrite-assertion>
-</rewrite-assertions>
diff --git a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/select/select-group-by.xml b/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/select/select-group-by.xml
deleted file mode 100644
index 39ad9ad99ae..00000000000
--- a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/select/select-group-by.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<rewrite-assertions yaml-rule="scenario/encrypt/config/query-with-plain.yaml">
-<!-- TODO FIX ME!-->
-<!-- <rewrite-assertion id="select_with_groupby_assisted_for_parameters_for_plain" db-types="MySQL">-->
-<!-- <input sql="SELECT account_id, password, amount AS a, status AS s FROM t_account WHERE account_id = ? AND password = ? AND password like ? AND amount = ? AND status = ? group by password desc" parameters="1, aaa, aaa, 1000, OK" />-->
-<!-- <output sql="SELECT account_id, cipher_password AS password, cipher_amount AS a, status AS s FROM t_account WHERE account_id = ? AND assisted_query_password = ? AND like_query_password like ? AND cipher_amount = ? AND status = ? group by assisted_query_password desc" parameters="1, assisted_query_aaa, like_query_aaa encrypt_1000, OK" />-->
-<!-- </rewrite-assertion>-->
-
- <rewrite-assertion id="select_with_groupby_assisted_for_literals_for_plain" db-types="MySQL">
- <input sql="SELECT account_id, password, amount AS a, status AS s FROM t_account WHERE account_id = 1 AND password = 'aaa' AND password like 'aaa' AND amount = 1000 AND status = 'OK' group by password desc" />
- <output sql="SELECT account_id, cipher_password AS password, cipher_amount AS a, status AS s FROM t_account WHERE account_id = 1 AND assisted_query_password = 'assisted_query_aaa' AND like_query_password like 'like_query_aaa' AND cipher_amount = 'encrypt_1000' AND status = 'OK' group by assisted_query_password desc" />
- </rewrite-assertion>
-
-<!-- TODO FIX ME!-->
-<!-- <rewrite-assertion id="select_with_groupby_cipher_for_parameters_for_plain" db-types="MySQL">-->
-<!-- <input sql="SELECT account_id, password, amount AS a, status AS s FROM t_account WHERE account_id = ? AND password = ? AND password like ? AND amount = ? AND status = ? group by amount desc" parameters="1, aaa, aaa, 1000, OK" />-->
-<!-- <output sql="SELECT account_id, cipher_password AS password, cipher_amount AS a, status AS s FROM t_account WHERE account_id = ? AND assisted_query_password = ? AND like_query_password like ? AND cipher_amount = ? AND status = ? group by cipher_amount desc" parameters="1, assisted_query_aaa, like_query_aaa, encrypt_1000, OK" />-->
-<!-- </rewrite-assertion>-->
-
- <rewrite-assertion id="select_with_groupby_cipher_for_literals_for_plain" db-types="MySQL">
- <input sql="SELECT account_id, password, amount AS a, status AS s FROM t_account WHERE account_id = 1 AND password = 'aaa' AND password like 'aaa' AND amount = 1000 AND status = 'OK' group by amount desc" />
- <output sql="SELECT account_id, cipher_password AS password, cipher_amount AS a, status AS s FROM t_account WHERE account_id = 1 AND assisted_query_password = 'assisted_query_aaa' AND like_query_password like 'like_query_aaa' AND cipher_amount = 'encrypt_1000' AND status = 'OK' group by cipher_amount desc" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_with_groupby_plain_for_parameters_for_plain" db-types="MySQL">
- <input sql="SELECT account_id, password, amount AS a, status AS s FROM t_account_bak WHERE account_id = ? AND password = ? AND password like ? AND amount = ? AND status = ? group by amount desc" parameters="1, aaa, aaa, 1000, OK" />
- <output sql="SELECT account_id, plain_password AS password, plain_amount AS a, status AS s FROM t_account_bak WHERE account_id = ? AND plain_password = ? AND plain_password like ? AND plain_amount = ? AND status = ? group by plain_amount desc" parameters="1, aaa, aaa, 1000, OK" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_with_groupby_plain_for_literals_for_plain" db-types="MySQL">
- <input sql="SELECT account_id, password, amount AS a, status AS s FROM t_account_bak WHERE account_id = 1 AND password = 'aaa' AND password like 'aaa' AND amount = 1000 AND status = 'OK' group by amount desc" />
- <output sql="SELECT account_id, plain_password AS password, plain_amount AS a, status AS s FROM t_account_bak WHERE account_id = 1 AND plain_password = 'aaa' AND plain_password like 'aaa' AND plain_amount = 1000 AND status = 'OK' group by plain_amount desc" />
- </rewrite-assertion>
-</rewrite-assertions>
diff --git a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/select/select-join.xml b/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/select/select-join.xml
deleted file mode 100644
index 2fb06a02712..00000000000
--- a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/select/select-join.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<rewrite-assertions yaml-rule="scenario/encrypt/config/query-with-plain.yaml">
- <rewrite-assertion id="select_join_with_alias_for_plain" db-types="MySQL">
- <input sql="SELECT a.password from t_account a, t_account_bak b where a.certificate_number = b.certificate_number" />
- <output sql="SELECT a.cipher_password AS password from t_account a, t_account_bak b where a.assisted_query_certificate_number = b.plain_certificate_number" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_join_with_table_name_for_plain" db-types="MySQL">
- <input sql="SELECT t_account.password from t_account, t_account_bak where t_account.certificate_number = t_account_bak.certificate_number" />
- <output sql="SELECT t_account.cipher_password AS password from t_account, t_account_bak where t_account.assisted_query_certificate_number = t_account_bak.plain_certificate_number" />
- </rewrite-assertion>
-
-<!-- TODO FIX ME!-->
-<!-- <rewrite-assertion id="select_unqualified_shorthand_projection_with_join_for_plain" db-types="MySQL">-->
-<!-- <input sql="SELECT * FROM t_account t INNER JOIN t_account_bak b ON t.id = b.id WHERE t.amount = ? OR b.amount = ?" parameters="1, 2" />-->
-<!-- <output sql="SELECT `t`.`account_id`, `t`.`cipher_certificate_number` AS `certificate_number`, `t`.`cipher_password` AS `password`, `t`.`cipher_amount` AS `amount`, `t`.`status`, `b`.`account_id`, `b`.`plain_certificate_number` AS `certificate_number`, `b`.`plain_password` AS `password`, `b`.`plain_amount` AS `amount`, `b`.`status` FROM t_account t INNER JOIN t_account_bak b ON t.id = b.id WHERE t.cipher_amount = ? OR b.plain_amount = ?" parameters="encrypt_1, 2" />-->
-<!-- </rewrite-assertion>-->
-
-<!-- TODO FIX ME!-->
-<!-- <rewrite-assertion id="select_with_join_for_plain" db-types="MySQL">-->
-<!-- <input sql="SELECT t_account.amount, t_account_bak.amount FROM t_account LEFT JOIN t_account_bak ON t_account.id = t_account_bak.id WHERE t_account.amount = ? OR t_account_bak.amount = ?" parameters="1, 2" />-->
-<!-- <output sql="SELECT t_account.cipher_amount AS amount, t_account_bak.plain_amount AS amount FROM t_account LEFT JOIN t_account_bak ON t_account.id = t_account_bak.id WHERE t_account.cipher_amount = ? OR t_account_bak.plain_amount = ?" parameters="encrypt_1, 2" />-->
-<!-- </rewrite-assertion>-->
-</rewrite-assertions>
diff --git a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/select/select-order-by.xml b/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/select/select-order-by.xml
deleted file mode 100644
index f55da541ded..00000000000
--- a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/select/select-order-by.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<rewrite-assertions yaml-rule="scenario/encrypt/config/query-with-plain.yaml">
-<!-- TODO FIX ME!-->
-<!-- <rewrite-assertion id="select_plain_for_parameters_with_order_by_cipher" db-types="MySQL">-->
-<!-- <input sql="SELECT account_id, password, amount AS a, status AS s FROM t_account WHERE account_id = ? AND password = ? AND password like ? AND amount = ? AND status = ? order by amount desc" parameters="1, aaa, aaa, 1000, OK" />-->
-<!-- <output sql="SELECT account_id, cipher_password AS password, cipher_amount AS a, status AS s FROM t_account WHERE account_id = ? AND assisted_query_password = ? AND like_query_password like ? AND cipher_amount = ? AND status = ? order by cipher_amount desc" parameters="1, assisted_query_aaa, like_query_aaa, encrypt_1000, OK" />-->
-<!-- </rewrite-assertion>-->
-
- <rewrite-assertion id="select_plain_for_literals_with_order_by_cipher" db-types="MySQL">
- <input sql="SELECT account_id, password, amount AS a, status AS s FROM t_account WHERE account_id = 1 AND password = 'aaa' AND password like 'aaa' AND amount = 1000 AND status = 'OK' order by amount desc" />
- <output sql="SELECT account_id, cipher_password AS password, cipher_amount AS a, status AS s FROM t_account WHERE account_id = 1 AND assisted_query_password = 'assisted_query_aaa' AND like_query_password like 'like_query_aaa' AND cipher_amount = 'encrypt_1000' AND status = 'OK' order by cipher_amount desc" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_plain_for_parameters_with_order_by_plain" db-types="MySQL">
- <input sql="SELECT account_id, password, amount AS a, status AS s FROM t_account_bak WHERE account_id = ? AND password = ? AND password like ? AND amount = ? AND status = ? order by amount desc" parameters="1, aaa, aaa, 1000, OK" />
- <output sql="SELECT account_id, plain_password AS password, plain_amount AS a, status AS s FROM t_account_bak WHERE account_id = ? AND plain_password = ? AND plain_password like ? AND plain_amount = ? AND status = ? order by plain_amount desc" parameters="1, aaa, aaa, 1000, OK" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_plain_for_literals_with_order_by_plain" db-types="MySQL">
- <input sql="SELECT account_id, password, amount AS a, status AS s FROM t_account_bak WHERE account_id = 1 AND password = 'aaa' AND password like 'aaa' AND amount = '1000' AND status = 'OK' order by amount desc" />
- <output sql="SELECT account_id, plain_password AS password, plain_amount AS a, status AS s FROM t_account_bak WHERE account_id = 1 AND plain_password = 'aaa' AND plain_password like 'aaa' AND plain_amount = '1000' AND status = 'OK' order by plain_amount desc" />
- </rewrite-assertion>
-</rewrite-assertions>
diff --git a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/select/select-projection.xml b/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/select/select-projection.xml
deleted file mode 100644
index ee1ef85947c..00000000000
--- a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/select/select-projection.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<rewrite-assertions yaml-rule="scenario/encrypt/config/query-with-plain.yaml">
- <rewrite-assertion id="select_with_unqualified_shorthand" db-types="MySQL">
- <input sql="SELECT * FROM t_account_bak" />
- <output sql="SELECT `t_account_bak`.`account_id`, `t_account_bak`.`plain_certificate_number` AS `certificate_number`, `t_account_bak`.`plain_password` AS `password`, `t_account_bak`.`plain_amount` AS `amount` FROM t_account_bak" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_with_qualified_shorthand" db-types="MySQL">
- <input sql="SELECT a.* FROM t_account_bak a" />
- <output sql="SELECT `a`.`account_id`, `a`.`plain_certificate_number` AS `certificate_number`, `a`.`plain_password` AS `password`, `a`.`plain_amount` AS `amount` FROM t_account_bak a" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_with_mix_qualified_shorthand_and_other_projection" db-types="MySQL">
- <input sql="SELECT a.*, account_id, 1+1 FROM t_account_bak a" />
- <output sql="SELECT `a`.`account_id`, `a`.`plain_certificate_number` AS `certificate_number`, `a`.`plain_password` AS `password`, `a`.`plain_amount` AS `amount`, account_id, 1+1 FROM t_account_bak a" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_with_schema_name_in_shorthand_projection" db-types="MySQL">
- <input sql="SELECT logic_db.t_account.* FROM t_account WHERE account_id = ?" parameters="100" />
- <output sql="SELECT `t_account`.`account_id`, `t_account`.`cipher_certificate_number` AS `certificate_number`, `t_account`.`cipher_password` AS `password`, `t_account`.`cipher_amount` AS `amount` FROM t_account WHERE account_id = ?" parameters="100" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_with_schema_name_in_column_projection" db-types="MySQL">
- <input sql="SELECT logic_db.t_account.account_id FROM t_account WHERE account_id = ?" parameters="100" />
- <output sql="SELECT t_account.account_id FROM t_account WHERE account_id = ?" parameters="100" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_for_predicate_and_right_value_should_be_matched" db-types="MySQL">
- <input sql="SELECT account_id, password, amount AS a, status AS s FROM t_account WHERE account_id = 1 AND password = 'aaa' AND password like 'aaa' AND amount = 1000 AND status = 'OK'" />
- <output sql="SELECT account_id, cipher_password AS password, cipher_amount AS a, status AS s FROM t_account WHERE account_id = 1 AND assisted_query_password = 'assisted_query_aaa' AND like_query_password like 'like_query_aaa' AND cipher_amount = 'encrypt_1000' AND status = 'OK'" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_with_unqualified_shorthand_for_plain" db-types="MySQL">
- <input sql="SELECT * FROM t_account" />
- <output sql="SELECT `t_account`.`account_id`, `t_account`.`cipher_certificate_number` AS `certificate_number`, `t_account`.`cipher_password` AS `password`, `t_account`.`cipher_amount` AS `amount` FROM t_account" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_with_qualified_shorthand_for_plain" db-types="MySQL">
- <input sql="SELECT a.* FROM t_account a" />
- <output sql="SELECT `a`.`account_id`, `a`.`cipher_certificate_number` AS `certificate_number`, `a`.`cipher_password` AS `password`, `a`.`cipher_amount` AS `amount` FROM t_account a" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_with_mix_qualified_shorthand_and_other_projection_for_plain" db-types="MySQL">
- <input sql="SELECT a.*, account_id, 1+1 FROM t_account a" />
- <output sql="SELECT `a`.`account_id`, `a`.`cipher_certificate_number` AS `certificate_number`, `a`.`cipher_password` AS `password`, `a`.`cipher_amount` AS `amount`, account_id, 1+1 FROM t_account a" />
- </rewrite-assertion>
-</rewrite-assertions>
diff --git a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/select/select-subquery.xml b/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/select/select-subquery.xml
deleted file mode 100644
index 8238d475f0f..00000000000
--- a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/select/select-subquery.xml
+++ /dev/null
@@ -1,125 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<rewrite-assertions yaml-rule="scenario/encrypt/config/query-with-plain.yaml">
-<!-- TODO FIX ME!-->
-<!-- <rewrite-assertion id="select_not_nested_subquery_in_projection_for_plain" db-types="MySQL">-->
-<!-- <input sql="SELECT u.certificate_number, u.password, (SELECT o.amount FROM t_account_bak o WHERE o.certificate_number=u.certificate_number) amount FROM t_account u, t_account_bak c WHERE u.certificate_number = c.certificate_number and u.password=?" parameters="1" />-->
-<!-- <output sql="SELECT u.cipher_certificate_number AS certificate_number, u.cipher_password AS password, (SELECT o.cipher_amount AS amount FROM t_account_bak o WHERE o.assisted_query_certificate_number=u.assisted_query_certificate_number) amount FROM t_account u, t_account_bak c WHERE u.assisted_query_certificate_number = c.assisted_query_certificate_number and u.assisted_query_password=?" parameters="assisted_query_1" />-->
-<!-- </rewrite-assertion>-->
-
-<!-- TODO FIX ME!-->
-<!-- <rewrite-assertion id="select_not_nested_subquery_in_table_segment_for_plain" db-types="MySQL">-->
-<!-- <input sql="SELECT u.amount, u.password, o.certificate_number FROM (SELECT certificate_number FROM t_account) o, t_account u WHERE o.certificate_number=u.certificate_number AND u.password=?" parameters="1" />-->
-<!-- <output sql="SELECT u.cipher_amount AS amount, u.cipher_password AS password, o.cipher_certificate_number AS certificate_number FROM (SELECT cipher_certificate_number, assisted_query_certificate_number FROM t_account) o, t_account u WHERE o.assisted_query_certificate_number=u.assisted_query_certificate_number AND u.assisted_query_password=?" parameters="assisted_query_1" />-->
-<!-- </rewrite-assertion>-->
-
-<!-- TODO FIX ME!-->
-<!-- <rewrite-assertion id="select_not_nested_subquery_in_table_segment_refed_for_plain" db-types="MySQL">-->
-<!-- <input sql="SELECT u.amount, u.password, o.certificate_number FROM (SELECT certificate_number FROM t_account_bak) o, t_account u WHERE o.certificate_number=u.certificate_number AND u.password=?" parameters="1" />-->
-<!-- <output sql="SELECT u.cipher_amount AS amount, u.cipher_password AS password, o.plain_certificate_number AS certificate_number FROM (SELECT cipher_certificate_number, assisted_query_certificate_number, plain_certificate_number FROM t_account_bak) o, t_account u WHERE o.assisted_query_certificate_number=u.assisted_query_certificate_number AND u.assisted_query_password=?" parameters="assisted_query_1" />-->
-<!-- </rewrite-assertion>-->
-
- <rewrite-assertion id="select_not_nested_subquery_in_table_segment_alias_for_plain" db-types="MySQL">
- <input sql="SELECT o.certificate_number FROM (SELECT a.certificate_number FROM t_account a) o" />
- <output sql="SELECT o.cipher_certificate_number AS certificate_number FROM (SELECT a.cipher_certificate_number, a.assisted_query_certificate_number FROM t_account a) o" />
- </rewrite-assertion>
-
-<!-- TODO FIX ME!-->
-<!-- <rewrite-assertion id="select_not_nested_subquery_in_table_segment_with_shorthand_project_alias_for_plain" db-types="MySQL">-->
-<!-- <input sql="SELECT u.amount, u.password, o.certificate_number FROM (SELECT a.* FROM t_account a) o, t_account u WHERE o.certificate_number=u.certificate_number AND u.password=?" parameters="1" />-->
-<!-- <output sql="SELECT u.cipher_amount AS amount, u.cipher_password AS password, o.cipher_certificate_number AS certificate_number FROM (SELECT `a`.`account_id`, `a`.`cipher_certificate_number`, `a`.`assisted_query_certificate_number`, `a`.`cipher_password`, `a`.`assisted_query_password`, `a`.`cipher_amount`, `a`.`status` FROM t_account a) o, t_account u WHERE o.assisted_query_certificate_number=u.assisted_query_certificate_number AND u.assisted_query_password=?" parameters="ass [...]
-<!-- </rewrite-assertion>-->
-
-<!-- TODO FIX ME!-->
-<!-- <rewrite-assertion id="select_not_nested_subquery_in_table_segment_with_shorthand_project_for_plain" db-types="MySQL">-->
-<!-- <input sql="SELECT u.amount, u.password, o.certificate_number FROM (SELECT * FROM t_account) o, t_account u WHERE o.certificate_number=u.certificate_number AND u.password=?" parameters="1" />-->
-<!-- <output sql="SELECT u.cipher_amount AS amount, u.cipher_password AS password, o.cipher_certificate_number AS certificate_number FROM (SELECT `t_account`.`account_id`, `t_account`.`cipher_certificate_number`, `t_account`.`assisted_query_certificate_number`, `t_account`.`cipher_password`, `t_account`.`assisted_query_password`, `t_account`.`cipher_amount`, `t_account`.`status` FROM t_account) o, t_account u WHERE o.assisted_query_certificate_number=u.assisted_query_certificate_n [...]
-<!-- </rewrite-assertion>-->
-
-<!-- TODO FIX ME!-->
-<!-- <rewrite-assertion id="select_not_nested_subquery_in_predicate_right_equal_condition_for_plain" db-types="MySQL">-->
-<!-- <input sql="SELECT u.amount, u.password, u.certificate_number FROM t_account_bak u, t_account c WHERE u.certificate_number=(SELECT certificate_number FROM t_account WHERE password=?) AND u.password=?" parameters="1, 2" />-->
-<!-- <output sql="SELECT u.cipher_amount AS amount, u.cipher_password AS password, u.cipher_certificate_number AS certificate_number FROM t_account_bak u, t_account c WHERE u.assisted_query_certificate_number=(SELECT assisted_query_certificate_number FROM t_account WHERE assisted_query_password=?) AND u.assisted_query_password=?" parameters="assisted_query_1, assisted_query_2" />-->
-<!-- </rewrite-assertion>-->
-
-<!-- TODO FIX ME!-->
-<!-- <rewrite-assertion id="select_not_nested_subquery_in_predicate_left_equal_condition_for_plain" db-types="MySQL">-->
-<!-- <input sql="SELECT u.amount, u.password, u.certificate_number FROM t_account_bak u, t_account c WHERE (SELECT certificate_number FROM t_account WHERE password=?)=u.certificate_number AND u.password=?" parameters="1, 2" />-->
-<!-- <output sql="SELECT u.cipher_amount AS amount, u.cipher_password AS password, u.cipher_certificate_number AS certificate_number FROM t_account_bak u, t_account c WHERE (SELECT assisted_query_certificate_number FROM t_account WHERE assisted_query_password=?)=u.assisted_query_certificate_number AND u.assisted_query_password=?" parameters="assisted_query_1, assisted_query_2" />-->
-<!-- </rewrite-assertion>-->
-
- <rewrite-assertion id="select_not_nested_subquery_in_table_with_alias_for_plain" db-types="MySQL">
- <input sql="SELECT count(*) as cnt FROM (SELECT ab.certificate_number FROM t_account ab) X" />
- <output sql="SELECT count(*) as cnt FROM (SELECT ab.cipher_certificate_number, ab.assisted_query_certificate_number FROM t_account ab) X" />
- </rewrite-assertion>
-
-<!-- TODO FIX ME!-->
-<!-- <rewrite-assertion id="select_not_nested_subquery_in_predicate_left_and_right_equal_condition_for_plain" db-types="MySQL">-->
-<!-- <input sql="SELECT u.amount, u.password, u.certificate_number FROM t_account_bak u, t_account c WHERE (SELECT certificate_number FROM t_account WHERE password=?)=(SELECT certificate_number FROM t_account_bak WHERE password=?) AND u.password=?" parameters="1, 2, 3" />-->
-<!-- <output sql="SELECT u.cipher_amount AS amount, u.cipher_password AS password, u.cipher_certificate_number AS certificate_number FROM t_account_bak u, t_account c WHERE (SELECT assisted_query_certificate_number FROM t_account WHERE assisted_query_password=?)=(SELECT assisted_query_certificate_number FROM t_account_bak WHERE assisted_query_password=?) AND u.assisted_query_password=?" parameters="assisted_query_1, assisted_query_2, assisted_query_3" />-->
-<!-- </rewrite-assertion>-->
-
-<!-- TODO FIX ME!-->
-<!-- <rewrite-assertion id="select_not_nested_subquery_in_predicate_exists_for_plain" db-types="MySQL">-->
-<!-- <input sql="SELECT u.amount, u.password, u.certificate_number FROM t_account_bak u WHERE EXISTS(SELECT b.certificate_number from t_account b where b.certificate_number=u.certificate_number)" />-->
-<!-- <output sql="SELECT u.cipher_amount AS amount, u.cipher_password AS password, u.cipher_certificate_number AS certificate_number FROM t_account_bak u WHERE EXISTS(SELECT b.cipher_certificate_number from t_account b where b.assisted_query_certificate_number=u.assisted_query_certificate_number)" />-->
-<!-- </rewrite-assertion>-->
-
-<!-- TODO FIX ME!-->
-<!-- <rewrite-assertion id="select_not_nested_subquery_in_predicate_not_exists_for_plain" db-types="MySQL">-->
-<!-- <input sql="SELECT u.amount, u.password, u.certificate_number FROM t_account_bak u WHERE NOT EXISTS(SELECT b.certificate_number from t_account b where b.certificate_number=u.certificate_number)" />-->
-<!-- <output sql="SELECT u.cipher_amount AS amount, u.cipher_password AS password, u.cipher_certificate_number AS certificate_number FROM t_account_bak u WHERE NOT EXISTS(SELECT b.cipher_certificate_number from t_account b where b.assisted_query_certificate_number=u.assisted_query_certificate_number)" />-->
-<!-- </rewrite-assertion>-->
-
-<!-- TODO FIX ME!-->
-<!-- <rewrite-assertion id="select_not_nested_subquery_in_predicate_in_condition_for_plain" db-types="MySQL">-->
-<!-- <input sql="SELECT u.amount, u.password, u.certificate_number FROM t_account_bak u, t_account c WHERE u.certificate_number IN (SELECT certificate_number FROM t_account WHERE password=?) AND u.password=?" parameters="1, 2" />-->
-<!-- <output sql="SELECT u.cipher_amount AS amount, u.cipher_password AS password, u.cipher_certificate_number AS certificate_number FROM t_account_bak u, t_account c WHERE u.assisted_query_certificate_number IN (SELECT assisted_query_certificate_number FROM t_account WHERE assisted_query_password=?) AND u.assisted_query_password=?" parameters="assisted_query_1, assisted_query_2" />-->
-<!-- </rewrite-assertion>-->
-
- <rewrite-assertion id="select_not_nested_subquery_in_tablesegment_from_alias_for_plain" db-types="MySQL">
- <input sql="SELECT b.certificate_number, b.amount FROM (SELECT a.certificate_number as certificate_number, a.amount FROM t_account a WHERE a.amount = 1373) b" />
- <output sql="SELECT b.cipher_certificate_number AS certificate_number, b.cipher_amount AS amount FROM (SELECT a.cipher_certificate_number, a.assisted_query_certificate_number, a.cipher_amount FROM t_account a WHERE a.cipher_amount = 'encrypt_1373') b" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_not_nested_subquery_in_tablesegment_ref_shorthand_for_plain" db-types="MySQL">
- <input sql="SELECT b.* FROM (SELECT a.certificate_number as certificate_number, a.amount FROM t_account a WHERE a.amount = 1373) b" />
- <output sql="SELECT `b`.`cipher_certificate_number` AS `certificate_number`, `b`.`cipher_amount` AS `amount` FROM (SELECT a.cipher_certificate_number, a.assisted_query_certificate_number, a.cipher_amount FROM t_account a WHERE a.cipher_amount = 'encrypt_1373') b" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_with_exists_sub_query_for_plain" db-types="MySQL">
- <input sql="SELECT out_table.amount FROM t_account out_table WHERE EXISTS (SELECT inner_table.amount FROM t_account inner_table)" />
- <output sql="SELECT out_table.cipher_amount AS amount FROM t_account out_table WHERE EXISTS (SELECT inner_table.cipher_amount FROM t_account inner_table)" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_sub_query_with_order_by_for_plain" db-types="MySQL">
- <input sql="SELECT COUNT(1) AS cnt FROM (SELECT a.amount FROM t_account a ORDER BY a.amount DESC ) AS tmp" />
- <output sql="SELECT COUNT(1) AS cnt FROM (SELECT a.cipher_amount FROM t_account a ORDER BY a.cipher_amount DESC ) AS tmp" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_shorthand_from_sub_query_with_simple_select" db-types="MySQL">
- <input sql="SELECT * FROM (SELECT * FROM t_account a) AS temp" />
- <output sql="SELECT `temp`.`account_id`, `temp`.`cipher_certificate_number` AS `certificate_number`, `temp`.`cipher_password` AS `password`, `temp`.`cipher_amount` AS `amount` FROM (SELECT `a`.`account_id`, `a`.`cipher_certificate_number`, `a`.`assisted_query_certificate_number`, `a`.`cipher_password`, `a`.`assisted_query_password`, `a`.`cipher_amount` FROM t_account a) AS temp" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_shorthand_from_sub_query_with_select_join" db-types="MySQL">
- <input sql="SELECT * FROM (SELECT a1.* FROM t_account a1 INNER JOIN t_account a2) AS temp" />
- <output sql="SELECT `temp`.`account_id`, `temp`.`cipher_certificate_number` AS `certificate_number`, `temp`.`cipher_password` AS `password`, `temp`.`cipher_amount` AS `amount` FROM (SELECT `a1`.`account_id`, `a1`.`cipher_certificate_number`, `a1`.`assisted_query_certificate_number`, `a1`.`cipher_password`, `a1`.`assisted_query_password`, `a1`.`cipher_amount` FROM t_account a1 INNER JOIN t_account a2) AS temp" />
- </rewrite-assertion>
-</rewrite-assertions>
diff --git a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/select/select-where.xml b/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/select/select-where.xml
deleted file mode 100644
index 4849fe534c7..00000000000
--- a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/select/select-where.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<rewrite-assertions yaml-rule="scenario/encrypt/config/query-with-plain.yaml">
-<!-- TODO FIX ME!-->
-<!-- <rewrite-assertion id="select_for_parameters" db-types="MySQL">-->
-<!-- <input sql="SELECT account_id, password, amount AS a, status AS s FROM t_account WHERE account_id = ? AND password = ? AND amount = ? AND status = ?" parameters="1, aaa, 1000, OK" />-->
-<!-- <output sql="SELECT account_id, cipher_password AS password, cipher_amount AS a, status AS s FROM t_account WHERE account_id = ? AND assisted_query_password = ? AND cipher_amount = ? AND status = ?" parameters="1, assisted_query_aaa, encrypt_1000, OK" />-->
-<!-- </rewrite-assertion>-->
-
- <rewrite-assertion id="select_for_literals" db-types="MySQL">
- <input sql="SELECT account_id, password, amount AS a, status AS s FROM t_account WHERE account_id = 1 AND password = 'aaa' AND password like 'aaa' AND amount = 1000 AND status = 'OK'" />
- <output sql="SELECT account_id, cipher_password AS password, cipher_amount AS a, status AS s FROM t_account WHERE account_id = 1 AND assisted_query_password = 'assisted_query_aaa' AND like_query_password like 'like_query_aaa' AND cipher_amount = 'encrypt_1000' AND status = 'OK'" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_plain_for_parameters_with_in_has_no_left_space" db-types="MySQL">
- <input sql="SELECT a.account_id, a.password, a.amount AS a, a.status AS s FROM t_account_bak AS a WHERE a.password in(?, ?) AND a.amount in (?, ?)" parameters="aaa, aaa, 1000, 1000" />
- <output sql="SELECT a.account_id, a.plain_password AS password, a.plain_amount AS a, a.status AS s FROM t_account_bak AS a WHERE a.plain_password in(?, ?) AND a.plain_amount in (?, ?)" parameters="aaa, aaa, 1000, 1000" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_plain_for_parameters_with_in_has_no_left_space_and_parameter_has_left_space" db-types="MySQL">
- <input sql="SELECT a.account_id, a.password, a.amount AS a, a.status AS s FROM t_account_bak AS a WHERE a.password in( ?, ?) AND a.amount in (?, ?)" parameters="aaa, aaa, 1000, 1000" />
- <output sql="SELECT a.account_id, a.plain_password AS password, a.plain_amount AS a, a.status AS s FROM t_account_bak AS a WHERE a.plain_password in(?, ?) AND a.plain_amount in (?, ?)" parameters="aaa, aaa, 1000, 1000" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_plain_for_parameters_with_in_has_no_left_space_and_parameter_has_left_newline" db-types="MySQL">
- <input sql="SELECT a.account_id, a.password, a.amount AS a, a.status AS s FROM t_account_bak AS a WHERE a.password in(
- ?, ?) AND a.amount in (?, ?)" parameters="aaa, aaa, 1000, 1000" />
- <output sql="SELECT a.account_id, a.plain_password AS password, a.plain_amount AS a, a.status AS s FROM t_account_bak AS a WHERE a.plain_password in(?, ?) AND a.plain_amount in (?, ?)" parameters="aaa, aaa, 1000, 1000" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_plain_for_parameters_with_in_has_more_than_one_left_space_and_parameter_has_left_newline" db-types="MySQL">
- <input sql="SELECT a.account_id, a.password, a.amount AS a, a.status AS s FROM t_account_bak AS a WHERE a.password in (
- ?, ?) AND a.amount in (?, ?)" parameters="aaa, aaa, 1000, 1000" />
- <output sql="SELECT a.account_id, a.plain_password AS password, a.plain_amount AS a, a.status AS s FROM t_account_bak AS a WHERE a.plain_password in (?, ?) AND a.plain_amount in (?, ?)" parameters="aaa, aaa, 1000, 1000" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_where_with_predicate_with_in_expr_for_literals" db-types="PostgreSQL,openGauss">
- <input sql="SELECT a.account_id, a.password, a.amount AS a, a.status AS s FROM t_account_bak AS a WHERE a.amount in ('1000', '2000')" />
- <output sql="SELECT a.account_id, a.plain_password AS password, a.plain_amount AS a, a.status AS s FROM t_account_bak AS a WHERE a.plain_amount in ('1000', '2000')" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_where_with_predicate_with_in_expr_for_parameters" db-types="PostgreSQL,openGauss">
- <input sql="SELECT a.account_id, a.password, a.amount AS a, a.status AS s FROM t_account_bak AS a WHERE a.amount in (?, ?)" parameters="1000, 2000" />
- <output sql="SELECT a.account_id, a.plain_password AS password, a.plain_amount AS a, a.status AS s FROM t_account_bak AS a WHERE a.plain_amount in (?, ?)" parameters="1000, 2000" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_plain_with_table_level_query_with_cipher_column_for_literals" db-types="MySQL">
- <input sql="SELECT a.account_id, a.password, a.amount AS a, a.status AS s FROM t_account_detail AS a WHERE a.account_id = 1 AND a.password = 'aaa' AND a.password like 'aaa' AND a.amount = '1000' AND a.status = 'OK'" />
- <output sql="SELECT a.account_id, a.cipher_password AS password, a.cipher_amount AS a, a.status AS s FROM t_account_detail AS a WHERE a.account_id = 1 AND a.assisted_query_password = 'assisted_query_aaa' AND a.like_query_password like 'like_query_aaa' AND a.cipher_amount = 'encrypt_1000' AND a.status = 'OK'" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_plain_for_parameters" db-types="MySQL">
- <input sql="SELECT a.account_id, a.password, a.amount AS a, a.status AS s FROM t_account_bak AS a WHERE a.account_id = ? AND a.password = ? AND a.password like ? AND a.amount = ? AND a.status = ?" parameters="1, aaa, aaa, 1000, OK" />
- <output sql="SELECT a.account_id, a.plain_password AS password, a.plain_amount AS a, a.status AS s FROM t_account_bak AS a WHERE a.account_id = ? AND a.plain_password = ? AND a.plain_password like ? AND a.plain_amount = ? AND a.status = ?" parameters="1, aaa, aaa, 1000, OK" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_plain_for_literals" db-types="MySQL">
- <input sql="SELECT a.account_id, a.password, a.amount AS a, a.status AS s FROM t_account_bak AS a WHERE a.account_id = 1 AND a.password = 'aaa' AND a.password like 'aaa' AND a.amount = 1000 AND a.status = 'OK'" />
- <output sql="SELECT a.account_id, a.plain_password AS password, a.plain_amount AS a, a.status AS s FROM t_account_bak AS a WHERE a.account_id = 1 AND a.plain_password = 'aaa' AND a.plain_password like 'aaa' AND a.plain_amount = 1000 AND a.status = 'OK'" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_cipher_with_table_level_query_with_cipher_column_for_parameters" db-types="MySQL">
- <input sql="SELECT a.account_id, a.password, a.amount AS a, a.status AS s FROM t_account_detail AS a WHERE a.account_id = ? AND a.password = ? AND a.password like ? AND a.amount = ? AND a.status = ?" parameters="1, aaa, aaa, 1000, OK" />
- <output sql="SELECT a.account_id, a.cipher_password AS password, a.cipher_amount AS a, a.status AS s FROM t_account_detail AS a WHERE a.account_id = ? AND a.assisted_query_password = ? AND a.like_query_password like ? AND a.cipher_amount = ? AND a.status = ?" parameters="1, assisted_query_aaa, like_query_aaa, encrypt_1000, OK" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_cipher_with_table_level_query_with_cipher_column_for_literals" db-types="MySQL">
- <input sql="SELECT a.account_id, a.password, a.amount AS a, a.status AS s FROM t_account_detail AS a WHERE a.account_id = 1 AND a.password = 'aaa' AND a.password like 'aaa' AND a.amount = 1000 AND a.status = 'OK'" />
- <output sql="SELECT a.account_id, a.cipher_password AS password, a.cipher_amount AS a, a.status AS s FROM t_account_detail AS a WHERE a.account_id = 1 AND a.assisted_query_password = 'assisted_query_aaa' AND a.like_query_password like 'like_query_aaa' AND a.cipher_amount = 'encrypt_1000' AND a.status = 'OK'" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_where_with_plain_column_like_concat_for_literals" db-types="PostgreSQL,openGauss">
- <input sql="SELECT a.account_id, a.password, a.amount AS a, a.status AS s FROM t_account_bak AS a WHERE a.account_id = 1 AND a.certificate_number like concat('%','abc','%')" />
- <output sql="SELECT a.account_id, a.plain_password AS password, a.plain_amount AS a, a.status AS s FROM t_account_bak AS a WHERE a.account_id = 1 AND a.plain_certificate_number like concat ('%', 'abc', '%')" />
- </rewrite-assertion>
-</rewrite-assertions>
diff --git a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/update/update.xml b/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/update/update.xml
deleted file mode 100644
index c2ac558712f..00000000000
--- a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-plain/dml/update/update.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<rewrite-assertions yaml-rule="scenario/encrypt/config/query-with-plain.yaml">
- <rewrite-assertion id="update_plain_for_parameters" db-types="MySQL">
- <input sql="UPDATE t_account_bak SET account_id = ?, password = ?, amount = ?, status = ? WHERE account_id = ? AND password = ? AND password like ? AND amount = ? AND status = ?" parameters="1, aaa, 1000, OK, 1, aaa, aaa, 1000, OK" />
- <output sql="UPDATE t_account_bak SET account_id = ?, cipher_password = ?, assisted_query_password = ?, like_query_password = ?, plain_password = ?, cipher_amount = ?, plain_amount = ?, status = ? WHERE account_id = ? AND plain_password = ? AND plain_password like ? AND plain_amount = ? AND status = ?" parameters="1, encrypt_aaa, assisted_query_aaa, like_query_aaa, aaa, encrypt_1000, 1000, OK, 1, aaa, aaa, 1000, OK" />
- </rewrite-assertion>
-
- <rewrite-assertion id="update_plain_for_literals" db-types="MySQL">
- <input sql="UPDATE t_account_bak SET account_id = 1, password = 'aaa', amount = 1000, status = 'OK' WHERE account_id = 1 AND password = 'aaa' AND password like 'aaa' AND amount = 1000 AND status = 'OK'" />
- <output sql="UPDATE t_account_bak SET account_id = 1, cipher_password = 'encrypt_aaa', assisted_query_password = 'assisted_query_aaa', like_query_password = 'like_query_aaa', plain_password = 'aaa', cipher_amount = 'encrypt_1000', plain_amount = 1000, status = 'OK' WHERE account_id = 1 AND plain_password = 'aaa' AND plain_password like 'aaa' AND plain_amount = 1000 AND status = 'OK'" />
- </rewrite-assertion>
-
-<!-- TODO FIX ME-->
-<!-- <rewrite-assertion id="update_for_parameters" db-types="MySQL">-->
-<!-- <input sql="UPDATE t_account SET account_id = ?, certificate_number = ?, password = ?, amount = ?, status = ? WHERE account_id = ? AND certificate_number = ? AND password = ? AND password like ? AND amount = ? AND status = ?" parameters="1, 111X, aaa, 1000, OK, 1, 111X, aaa, aaa, 1000, OK" />-->
-<!-- <output sql="UPDATE t_account SET account_id = ?, cipher_certificate_number = ?, assisted_query_certificate_number = ?, like_query_certificate_number = ?, cipher_password = ?, assisted_query_password = ?, like_query_password = ?, cipher_amount = ?, status = ? WHERE account_id = ? AND assisted_query_certificate_number = ? AND assisted_query_password = ? AND like_query_password like ? AND cipher_amount = ? AND status = ?" parameters="1, encrypt_111X, assisted_query_111X, like_q [...]
-<!-- </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 password like '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', like_query_certificate_number = 'like_query_111X', cipher_password = 'encrypt_aaa', assisted_query_password = 'assisted_query_aaa', like_query_password = 'like_query_aaa', cipher_amount = 'encrypt_1000', status = 'OK' WHERE account_id = 1 AND assisted_query_certificate_number = 'assisted_query_111X' AND assisted_query_password = [...]
- </rewrite-assertion>
-
-<!-- TODO FIX ME-->
-<!-- <rewrite-assertion id="update_multi_for_parameters" db-types="MySQL">-->
-<!-- <input sql="UPDATE t_account_bak 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_bak SET account_id = ?, cipher_certificate_number = ?, assisted_query_certificate_number = ?, plain_certificate_number = ?, cipher_password = ?, assisted_query_password = ?, plain_password = ?, cipher_amount = ?, plain_amount = ?, status = ? WHERE account_id = ? AND plain_certificate_number = ? AND plain_password = ? AND plain_amount = ? AND status = ?" parameters="1, encrypt_111X, assisted_query_111X, 111X, encrypt_aaa, assisted_query_aaa, aaa, [...]
-<!-- </rewrite-assertion>-->
-
- <rewrite-assertion id="update_plain_for_literals" db-types="MySQL">
- <input sql="UPDATE t_account_bak 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 password like 'aaa' AND amount = 1000 AND status = 'OK'" />
- <output sql="UPDATE t_account_bak SET account_id = 1, cipher_certificate_number = 'encrypt_111X', assisted_query_certificate_number = 'assisted_query_111X', like_query_certificate_number = 'like_query_111X', plain_certificate_number = '111X', cipher_password = 'encrypt_aaa', assisted_query_password = 'assisted_query_aaa', like_query_password = 'like_query_aaa', plain_password = 'aaa', cipher_amount = 'encrypt_1000', plain_amount = 1000, status = 'OK' WHERE account_id = 1 AND plai [...]
- </rewrite-assertion>
-
- <rewrite-assertion id="update_plain_null_to_clear_plain" db-types="MySQL">
- <input sql="UPDATE t_account_bak SET certificate_number = NULL" />
- <output sql="UPDATE t_account_bak SET cipher_certificate_number = NULL, assisted_query_certificate_number = NULL, like_query_certificate_number = NULL, plain_certificate_number = NULL" />
- </rewrite-assertion>
-
- <rewrite-assertion id="update_plain_null_to_clear_plain_with_multi" db-types="MySQL">
- <input sql="UPDATE t_account_bak SET certificate_number = NULL, certificate_number = ''" />
- <output sql="UPDATE t_account_bak SET cipher_certificate_number = NULL, assisted_query_certificate_number = NULL, like_query_certificate_number = NULL, plain_certificate_number = NULL, cipher_certificate_number = 'encrypt_', assisted_query_certificate_number = 'assisted_query_', like_query_certificate_number = 'like_query_', plain_certificate_number = ''" />
- </rewrite-assertion>
-
- <rewrite-assertion id="update_plain_null_to_clear_plain_where_is_null" db-types="MySQL">
- <input sql="UPDATE t_account_bak SET certificate_number = NULL WHERE certificate_number IS NULL" />
- <output sql="UPDATE t_account_bak SET cipher_certificate_number = NULL, assisted_query_certificate_number = NULL, like_query_certificate_number = NULL, plain_certificate_number = NULL WHERE plain_certificate_number IS NULL" />
- </rewrite-assertion>
-
- <rewrite-assertion id="update_plain_null_to_clear_plain_where_is_null_with_multi" db-types="MySQL">
- <input sql="UPDATE t_account_bak SET certificate_number = NULL WHERE certificate_number IS NULL AND status = 'OK' AND certificate_number = '111X' AND certificate_number like '111X'" />
- <output sql="UPDATE t_account_bak SET cipher_certificate_number = NULL, assisted_query_certificate_number = NULL, like_query_certificate_number = NULL, plain_certificate_number = NULL WHERE plain_certificate_number IS NULL AND status = 'OK' AND plain_certificate_number = '111X' AND plain_certificate_number like '111X'" />
- </rewrite-assertion>
-
- <rewrite-assertion id="update_plain_null_to_clear_plain_where_is_not_null" db-types="MySQL">
- <input sql="UPDATE t_account_bak SET certificate_number = NULL WHERE certificate_number IS NOT NULL" />
- <output sql="UPDATE t_account_bak SET cipher_certificate_number = NULL, assisted_query_certificate_number = NULL, like_query_certificate_number = NULL, plain_certificate_number = NULL WHERE plain_certificate_number IS NOT NULL" />
- </rewrite-assertion>
-
- <rewrite-assertion id="update_plain_null_to_clear_plain_where_is_not_null_with_multi" db-types="MySQL">
- <input sql="UPDATE t_account_bak SET certificate_number = NULL WHERE certificate_number IS NOT NULL AND status = 'OK' AND certificate_number = '111X' AND certificate_number like '111X'" />
- <output sql="UPDATE t_account_bak SET cipher_certificate_number = NULL, assisted_query_certificate_number = NULL, like_query_certificate_number = NULL, plain_certificate_number = NULL WHERE plain_certificate_number IS NOT NULL AND status = 'OK' AND plain_certificate_number = '111X' AND plain_certificate_number like '111X'" />
- </rewrite-assertion>
-</rewrite-assertions>
diff --git a/test/it/rewriter/src/test/resources/scenario/encrypt/config/query-with-cipher.yaml b/test/it/rewriter/src/test/resources/scenario/encrypt/config/query-with-cipher.yaml
index f11dd7f5ddc..74779bfc19a 100644
--- a/test/it/rewriter/src/test/resources/scenario/encrypt/config/query-with-cipher.yaml
+++ b/test/it/rewriter/src/test/resources/scenario/encrypt/config/query-with-cipher.yaml
@@ -96,7 +96,6 @@ rules:
cipherColumn: cipher_amount
plainColumn: plain_amount
encryptorName: rewrite_normal_fixture
- queryWithCipherColumn: false
encryptors:
rewrite_normal_fixture:
type: REWRITE.NORMAL.FIXTURE
diff --git a/test/it/rewriter/src/test/resources/scenario/encrypt/config/query-with-plain.yaml b/test/it/rewriter/src/test/resources/scenario/encrypt/config/query-with-plain.yaml
deleted file mode 100644
index 6861300a829..00000000000
--- a/test/it/rewriter/src/test/resources/scenario/encrypt/config/query-with-plain.yaml
+++ /dev/null
@@ -1,108 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-dataSources:
- encrypt_ds:
- dataSourceClassName: org.apache.shardingsphere.test.fixture.jdbc.MockedDataSource
-
-rules:
-- !ENCRYPT
- tables:
- t_account:
- columns:
- certificate_number:
- cipherColumn: cipher_certificate_number
- assistedQueryColumn: assisted_query_certificate_number
- likeQueryColumn: like_query_certificate_number
- encryptorName: rewrite_normal_fixture
- assistedQueryEncryptorName: rewrite_assisted_query_fixture
- likeQueryEncryptorName: rewrite_like_query_fixture
- password:
- cipherColumn: cipher_password
- assistedQueryColumn: assisted_query_password
- likeQueryColumn: like_query_password
- encryptorName: rewrite_normal_fixture
- assistedQueryEncryptorName: rewrite_assisted_query_fixture
- likeQueryEncryptorName: rewrite_like_query_fixture
- amount:
- cipherColumn: cipher_amount
- encryptorName: rewrite_normal_fixture
- amount_new:
- cipherColumn: amount_new_cipher
- encryptorName: rewrite_normal_fixture
- t_account_bak:
- columns:
- certificate_number:
- cipherColumn: cipher_certificate_number
- assistedQueryColumn: assisted_query_certificate_number
- likeQueryColumn: like_query_certificate_number
- plainColumn: plain_certificate_number
- encryptorName: rewrite_normal_fixture
- assistedQueryEncryptorName: rewrite_assisted_query_fixture
- likeQueryEncryptorName: rewrite_like_query_fixture
- password:
- cipherColumn: cipher_password
- assistedQueryColumn: assisted_query_password
- likeQueryColumn: like_query_password
- plainColumn: plain_password
- encryptorName: rewrite_normal_fixture
- assistedQueryEncryptorName: rewrite_assisted_query_fixture
- likeQueryEncryptorName: rewrite_like_query_fixture
- password_new:
- cipherColumn: password_new_cipher
- assistedQueryColumn: password_new_assisted
- likeQueryColumn: password_new_like
- plainColumn: password_new_plain
- encryptorName: rewrite_normal_fixture
- assistedQueryEncryptorName: rewrite_assisted_query_fixture
- likeQueryEncryptorName: rewrite_like_query_fixture
- amount:
- cipherColumn: cipher_amount
- plainColumn: plain_amount
- encryptorName: rewrite_normal_fixture
- t_account_detail:
- columns:
- certificate_number:
- cipherColumn: cipher_certificate_number
- assistedQueryColumn: assisted_query_certificate_number
- likeQueryColumn: like_query_certificate_number
- plainColumn: plain_certificate_number
- encryptorName: rewrite_normal_fixture
- assistedQueryEncryptorName: rewrite_assisted_query_fixture
- likeQueryEncryptorName: rewrite_like_query_fixture
- password:
- cipherColumn: cipher_password
- assistedQueryColumn: assisted_query_password
- likeQueryColumn: like_query_password
- plainColumn: plain_password
- encryptorName: rewrite_normal_fixture
- assistedQueryEncryptorName: rewrite_assisted_query_fixture
- likeQueryEncryptorName: rewrite_like_query_fixture
- amount:
- cipherColumn: cipher_amount
- plainColumn: plain_amount
- encryptorName: rewrite_normal_fixture
- queryWithCipherColumn: true
- encryptors:
- rewrite_normal_fixture:
- type: REWRITE.NORMAL.FIXTURE
- rewrite_assisted_query_fixture:
- type: REWRITE.ASSISTED_QUERY.FIXTURE
- likeEncryptors:
- rewrite_like_query_fixture:
- type: REWRITE.LIKE_QUERY.FIXTURE
- queryWithCipherColumn: false
diff --git a/test/it/rewriter/src/test/resources/scenario/mix/case/query-with-plain/dml/delete/delete.xml b/test/it/rewriter/src/test/resources/scenario/mix/case/query-with-plain/dml/delete/delete.xml
deleted file mode 100644
index 029bba9960f..00000000000
--- a/test/it/rewriter/src/test/resources/scenario/mix/case/query-with-plain/dml/delete/delete.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<rewrite-assertions yaml-rule="scenario/mix/config/query-with-plain.yaml">
- <rewrite-assertion id="delete_plain_for_parameters" db-types="MySQL">
- <input sql="DELETE FROM t_account_bak WHERE account_id = ? AND password = ? AND amount = ? AND status = ?" parameters="1, aaa, 1000, OK" />
- <output sql="DELETE FROM t_account_bak_1 WHERE account_id = ? AND plain_password = ? AND plain_amount = ? AND status = ?" parameters="1, aaa, 1000, OK" />
- </rewrite-assertion>
-
- <rewrite-assertion id="delete_for_literals" db-types="MySQL">
- <input sql="DELETE FROM t_account_bak WHERE account_id = 1 AND password = 'aaa' AND amount = 1000 AND status = 'OK'" />
- <output sql="DELETE FROM t_account_bak_1 WHERE account_id = 1 AND plain_password = 'aaa' AND plain_amount = 1000 AND status = 'OK'" />
- </rewrite-assertion>
-</rewrite-assertions>
diff --git a/test/it/rewriter/src/test/resources/scenario/mix/case/query-with-plain/dml/select/select-projection.xml b/test/it/rewriter/src/test/resources/scenario/mix/case/query-with-plain/dml/select/select-projection.xml
deleted file mode 100644
index ccf4d470b82..00000000000
--- a/test/it/rewriter/src/test/resources/scenario/mix/case/query-with-plain/dml/select/select-projection.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<rewrite-assertions yaml-rule="scenario/mix/config/query-with-plain.yaml">
- <rewrite-assertion id="select_with_unqualified_shorthand" db-types="MySQL">
- <input sql="SELECT * FROM t_account_bak" />
- <output sql="SELECT `t_account_bak_0`.`account_id`, `t_account_bak_0`.`plain_password` AS `password`, `t_account_bak_0`.`plain_amount` AS `amount` FROM t_account_bak_0 UNION ALL SELECT `t_account_bak_1`.`account_id`, `t_account_bak_1`.`plain_password` AS `password`, `t_account_bak_1`.`plain_amount` AS `amount` FROM t_account_bak_1" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_with_qualified_shorthand" db-types="MySQL">
- <input sql="SELECT a.* FROM t_account_bak a" />
- <output sql="SELECT `a`.`account_id`, `a`.`plain_password` AS `password`, `a`.`plain_amount` AS `amount` FROM t_account_bak_0 a UNION ALL SELECT `a`.`account_id`, `a`.`plain_password` AS `password`, `a`.`plain_amount` AS `amount` FROM t_account_bak_1 a" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_with_mix_qualified_shorthand_and_other_projection" db-types="MySQL">
- <input sql="SELECT a.*, account_id, 1+1 FROM t_account_bak a" />
- <output sql="SELECT `a`.`account_id`, `a`.`plain_password` AS `password`, `a`.`plain_amount` AS `amount`, account_id, 1+1 FROM t_account_bak_0 a UNION ALL SELECT `a`.`account_id`, `a`.`plain_password` AS `password`, `a`.`plain_amount` AS `amount`, account_id, 1+1 FROM t_account_bak_1 a" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_with_table_qualified_shorthand" db-types="MySQL">
- <input sql="SELECT t_account_bak.* FROM t_account_bak" />
- <output sql="SELECT `t_account_bak_0`.`account_id`, `t_account_bak_0`.`plain_password` AS `password`, `t_account_bak_0`.`plain_amount` AS `amount` FROM t_account_bak_0 UNION ALL SELECT `t_account_bak_1`.`account_id`, `t_account_bak_1`.`plain_password` AS `password`, `t_account_bak_1`.`plain_amount` AS `amount` FROM t_account_bak_1" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_with_schema_name_in_shorthand_projection" db-types="MySQL">
- <input sql="SELECT logic_db.t_account.* FROM t_account WHERE account_id = ?" parameters="100" />
- <output sql="SELECT `t_account_0`.`account_id`, `t_account_0`.`cipher_password` AS `password`, `t_account_0`.`cipher_amount` AS `amount` FROM t_account_0 WHERE account_id = ?" parameters="100" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_with_schema_name_in_column_projection" db-types="MySQL">
- <input sql="SELECT logic_db.t_account.account_id FROM t_account WHERE account_id = ?" parameters="100" />
- <output sql="SELECT t_account_0.account_id FROM t_account_0 WHERE account_id = ?" parameters="100" />
- </rewrite-assertion>
-</rewrite-assertions>
diff --git a/test/it/rewriter/src/test/resources/scenario/mix/case/query-with-plain/dml/select/select-where.xml b/test/it/rewriter/src/test/resources/scenario/mix/case/query-with-plain/dml/select/select-where.xml
deleted file mode 100644
index 85d44486984..00000000000
--- a/test/it/rewriter/src/test/resources/scenario/mix/case/query-with-plain/dml/select/select-where.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<rewrite-assertions yaml-rule="scenario/mix/config/query-with-plain.yaml">
- <rewrite-assertion id="select_plain_for_parameters" db-types="MySQL">
- <input sql="SELECT a.account_id, a.password, a.amount AS a, a.status AS s FROM t_account_bak AS a WHERE a.account_id = ? AND a.password = ? AND a.amount = ? AND a.status = ?" parameters="1, aaa, 1000, OK" />
- <output sql="SELECT a.account_id, a.plain_password AS password, a.plain_amount AS a, a.status AS s FROM t_account_bak_1 AS a WHERE a.account_id = ? AND a.plain_password = ? AND a.plain_amount = ? AND a.status = ?" parameters="1, aaa, 1000, OK" />
- </rewrite-assertion>
-
- <rewrite-assertion id="select_plain_for_literals" db-types="MySQL">
- <input sql="SELECT a.account_id, a.password, a.amount AS a, a.status AS s FROM t_account_bak AS a WHERE a.account_id = 1 AND a.password = 'aaa' AND a.amount = 1000 AND a.status = 'OK'" />
- <output sql="SELECT a.account_id, a.plain_password AS password, a.plain_amount AS a, a.status AS s FROM t_account_bak_1 AS a WHERE a.account_id = 1 AND a.plain_password = 'aaa' AND a.plain_amount = 1000 AND a.status = 'OK'" />
- </rewrite-assertion>
-</rewrite-assertions>
diff --git a/test/it/rewriter/src/test/resources/scenario/mix/case/query-with-plain/dml/update/update.xml b/test/it/rewriter/src/test/resources/scenario/mix/case/query-with-plain/dml/update/update.xml
deleted file mode 100644
index 1a188c0ff7f..00000000000
--- a/test/it/rewriter/src/test/resources/scenario/mix/case/query-with-plain/dml/update/update.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<rewrite-assertions yaml-rule="scenario/mix/config/query-with-plain.yaml">
- <rewrite-assertion id="update_plain_for_parameters" db-types="MySQL">
- <input sql="UPDATE t_account_bak SET account_id = ?, password = ?, amount = ?, status = ? WHERE account_id = ? AND password = ? AND amount = ? AND status = ?" parameters="1, aaa, 1000, OK, 1, aaa, 1000, OK" />
- <output sql="UPDATE t_account_bak_1 SET account_id = ?, cipher_password = ?, assisted_query_password = ?, plain_password = ?, cipher_amount = ?, plain_amount = ?, status = ? WHERE account_id = ? AND plain_password = ? AND plain_amount = ? AND status = ?" parameters="1, encrypt_aaa, assisted_query_aaa, aaa, encrypt_1000, 1000, OK, 1, aaa, 1000, OK" />
- </rewrite-assertion>
-
- <rewrite-assertion id="update_plain_for_literals" db-types="MySQL">
- <input sql="UPDATE t_account_bak SET account_id = 1, password = 'aaa', amount = 1000, status = 'OK' WHERE account_id = 1 AND password = 'aaa' AND amount = 1000 AND status = 'OK'" />
- <output sql="UPDATE t_account_bak_1 SET account_id = 1, cipher_password = 'encrypt_aaa', assisted_query_password = 'assisted_query_aaa', plain_password = 'aaa', cipher_amount = 'encrypt_1000', plain_amount = 1000, status = 'OK' WHERE account_id = 1 AND plain_password = 'aaa' AND plain_amount = 1000 AND status = 'OK'" />
- </rewrite-assertion>
-</rewrite-assertions>
diff --git a/test/it/rewriter/src/test/resources/scenario/mix/config/query-with-plain.yaml b/test/it/rewriter/src/test/resources/scenario/mix/config/query-with-plain.yaml
deleted file mode 100644
index 252cdfdebb0..00000000000
--- a/test/it/rewriter/src/test/resources/scenario/mix/config/query-with-plain.yaml
+++ /dev/null
@@ -1,99 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-dataSources:
- db:
- dataSourceClassName: org.apache.shardingsphere.test.fixture.jdbc.MockedDataSource
-
-rules:
-- !SHARDING
- tables:
- t_account:
- actualDataNodes: db.t_account_${0..1}
- tableStrategy:
- standard:
- shardingColumn: account_id
- shardingAlgorithmName: t_account_inline
- keyGenerateStrategy:
- column: account_id
- keyGeneratorName: rewrite_keygen_fixture
- t_account_bak:
- actualDataNodes: db.t_account_bak_${0..1}
- tableStrategy:
- standard:
- shardingColumn: account_id
- shardingAlgorithmName: t_account_bak_inline
- keyGenerateStrategy:
- column: account_id
- keyGeneratorName: rewrite_keygen_fixture
- t_account_detail:
- actualDataNodes: db.t_account_detail_${0..1}
- tableStrategy:
- standard:
- shardingColumn: account_id
- shardingAlgorithmName: t_account_detail_inline
- bindingTables:
- - t_account, t_account_detail
-
- shardingAlgorithms:
- t_account_inline:
- type: INLINE
- props:
- algorithm-expression: t_account_${account_id % 2}
- t_account_bak_inline:
- type: INLINE
- props:
- algorithm-expression: t_account_bak_${account_id % 2}
- t_account_detail_inline:
- type: INLINE
- props:
- algorithm-expression: t_account_detail_${account_id % 2}
-
- keyGenerators:
- rewrite_keygen_fixture:
- type: REWRITE.FIXTURE
-
-- !ENCRYPT
- tables:
- t_account:
- columns:
- password:
- cipherColumn: cipher_password
- assistedQueryColumn: assisted_query_password
- encryptorName: rewrite_normal_fixture
- assistedQueryEncryptorName: rewrite_assisted_query_fixture
- amount:
- cipherColumn: cipher_amount
- encryptorName: rewrite_normal_fixture
- t_account_bak:
- columns:
- password:
- cipherColumn: cipher_password
- assistedQueryColumn: assisted_query_password
- plainColumn: plain_password
- encryptorName: rewrite_normal_fixture
- assistedQueryEncryptorName: rewrite_assisted_query_fixture
- amount:
- cipherColumn: cipher_amount
- plainColumn: plain_amount
- encryptorName: rewrite_normal_fixture
- encryptors:
- rewrite_normal_fixture:
- type: REWRITE.NORMAL.FIXTURE
- rewrite_assisted_query_fixture:
- type: REWRITE.ASSISTED_QUERY.FIXTURE
- queryWithCipherColumn: false