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 2022/10/15 16:03:42 UTC

[shardingsphere] branch master updated: refactored alter and drop encrypt rules (#21396)

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

zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 58bfe9c90ab refactored alter and drop encrypt rules (#21396)
58bfe9c90ab is described below

commit 58bfe9c90ab0bc0c305e36790d5ad0fb16df6227
Author: Kavya Bhat <43...@users.noreply.github.com>
AuthorDate: Sat Oct 15 21:33:35 2022 +0530

    refactored alter and drop encrypt rules (#21396)
---
 .../encrypt/alter-encrypt-rule.en.md               | 62 ++++++++++++++++++++++
 .../encrypt/drop-encrypt-rule.en.md                | 34 ++++++++++++
 2 files changed, 96 insertions(+)

diff --git a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/encrypt/alter-encrypt-rule.en.md b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/encrypt/alter-encrypt-rule.en.md
new file mode 100644
index 00000000000..08615cfddef
--- /dev/null
+++ b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/encrypt/alter-encrypt-rule.en.md
@@ -0,0 +1,62 @@
++++
+title = "ALTER ENCRYPT RULE"
+weight = 2
++++
+
+## Description
+
+The `ALTER ENCRYPT RULE` syntax is used to alter an encryption rule.
+
+### Syntax
+
+```sql
+AlterEncryptRule ::=
+  'ALTER' 'ENCRYPT' 'RULE' encryptDefinition ( ',' encryptDefinition )*
+
+encryptDefinition ::=
+  tableName '(' 'COLUMNS' '(' columnDefinition ( ',' columnDefinition )*  ')' ',' 'QUERY_WITH_CIPHER_COLUMN' '=' ( 'TRUE' | 'FALSE' ) ')'
+
+columnDefinition ::=
+    'NAME' '=' columnName ',' ( 'PLAIN' '=' plainColumnName )? 'CIPHER' '=' cipherColumnName ','  'TYPE' '(' 'NAME' '=' encryptAlgorithmType ( ',' 'PROPERTIES' '(' 'key' '=' 'value' ( ',' 'key' '=' 'value' )* ')' )? ')'
+    
+tableName ::=
+  identifier
+
+columnName ::=
+  identifier
+
+plainColumnName ::=
+  identifier
+
+cipherColumnName ::=
+  identifier
+
+encryptAlgorithmType ::=
+  string
+```
+
+### Supplement
+
+- `PLAIN` specifies the plain column, `CIPHER` specifies the cipher column 
+- `encryptAlgorithmType` specifies the encryption algorithm type, please refer to Encryption Algorithm 
+- `queryWithCipherColumn` support uppercase or lowercase true or false
+
+### Example
+
+#### Alter an encrypt rule
+
+```sql
+ALTER ENCRYPT RULE t_encrypt (
+COLUMNS(
+(NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc'))),
+(NAME=order_id,CIPHER=order_cipher,TYPE(NAME='MD5'))
+), QUERY_WITH_CIPHER_COLUMN=TRUE);
+```
+
+### Reserved words
+
+`ALTER`, `ENCRYPT`, `RULE`, `COLUMNS`, `NAME`, `CIPHER`, `PLAIN`, `QUERY_WITH_CIPHER_COLUMN`, `TYPE`, `TRUE`, `FALSE`
+
+### Related links
+
+- [Reserved word](/en/reference/distsql/syntax/reserved-word/)
diff --git a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/encrypt/drop-encrypt-rule.en.md b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/encrypt/drop-encrypt-rule.en.md
new file mode 100644
index 00000000000..a66f1c3f6ca
--- /dev/null
+++ b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/encrypt/drop-encrypt-rule.en.md
@@ -0,0 +1,34 @@
++++
+title = "DROP ENCRYPT RULE"
+weight = 2
++++
+
+## Description
+
+The `DROP ENCRYPT RULE` syntax is used to drop an existing encryption rule.
+
+### Syntax
+
+```sql
+DropEncryptRule ::=
+  'DROP' 'ENCRYPT' 'RULE' tableName ( ',' tableName )*
+    
+tableName ::=
+  identifier
+```
+
+### Example
+
+#### Drop an encrypt rule
+
+```sql
+DROP ENCRYPT RULE t_encrypt, t_encrypt_2;
+```
+
+### Reserved words
+
+`DROP`, `ENCRYPT`, `RULE`
+
+### Related links
+
+- [Reserved word](/en/reference/distsql/syntax/reserved-word/)