This is an automated email from the ASF dual-hosted git repository.
panjuan 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 d49b231 Add note docs for shadow (#14402)
d49b231 is described below
commit d49b23185e04345804e7f0a2762daa8be09ecbc1
Author: gin <[email protected]>
AuthorDate: Wed Dec 29 14:02:18 2021 +0800
Add note docs for shadow (#14402)
---
.../document/content/reference/shadow/_index.cn.md | 24 +++++++++++++++++++++-
.../document/content/reference/shadow/_index.en.md | 24 +++++++++++++++++++++-
2 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/docs/document/content/reference/shadow/_index.cn.md
b/docs/document/content/reference/shadow/_index.cn.md
index 704c02e..b4dd837 100644
--- a/docs/document/content/reference/shadow/_index.cn.md
+++ b/docs/document/content/reference/shadow/_index.cn.md
@@ -87,7 +87,7 @@ sql-parser:
```
**注意**: 如果使用注解影子算法,需要开启解析 SQL 注释配置项 `sql-comment-parse-enabled: true`。默认关闭。
-请参考 [配置项说明](
https://shardingsphere.apache.org/document/current/cn/user-manual/shardingsphere-jdbc/configuration/props/)
+请参考 [SQL
解析配置](https://shardingsphere.apache.org/document/current/cn/user-manual/shardingsphere-jdbc/yaml-config/rules/sql-parser/)
### 影子库环境
@@ -101,6 +101,28 @@ CREATE TABLE t_order (order_id INT(11) primary key,
user_id int(11) not null, ..
执行到影子库。
+**注意**:如果使用 MySQL 客户端进行测试,链接需要使用参数:`-c` 例如:
+
+```sql
+mysql> mysql -u root -h127.0.0.1 -P3306 -proot -c
+```
+
+参数说明:保留注释,发送注释到服务端。
+
+执行包含注解 SQL 例如:
+
+```sql
+SELECT * FROM table_name /*shadow:true,foo:bar*/;
+```
+
+不使用参数 `-c` 会被 MySQL 客户端截取注释语句变为:
+
+```sql
+SELECT * FROM table_name;
+```
+
+影响测试结果。
+
### 影子算法使用
1. 列影子算法使用
diff --git a/docs/document/content/reference/shadow/_index.en.md
b/docs/document/content/reference/shadow/_index.en.md
index 403ff1b..abb79e5 100644
--- a/docs/document/content/reference/shadow/_index.en.md
+++ b/docs/document/content/reference/shadow/_index.en.md
@@ -106,7 +106,7 @@ sql-parser:
```
**Note**: If you use the Hint shadow algorithm, the parse SQL comment
configuration item `sql-comment-parse-enabled: true` need to be turned on.
turned off by default.
-please refer to [Configuration Props](
https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-jdbc/configuration/props/)
+please refer to [SQL-PARSER
Configuration](https://shardingsphere.apache.org/document/current/cn/user-manual/shardingsphere-jdbc/yaml-config/rules/sql-parser/)
### Shadow DB environment
@@ -120,6 +120,28 @@ CREATE TABLE t_order (order_id INT(11) primary key,
user_id int(11) not null, ..
```
Execute to the shadow DB.
+**Note**: If use the MySQL client for testing, the link needs to use the
parameter `-c`, for example:
+
+```sql
+mysql> mysql -u root -h127.0.0.1 -P3306 -proot -c
+```
+
+Parameter description: keep the comment, send the comment to the server
+
+Execute SQL containing annotations, for example:
+
+```sql
+SELECT * FROM table_name /*shadow:true,foo:bar*/;
+```
+
+Comment statement will be intercepted by the MySQL client if parameter `-c`
not be used, for example:
+
+```sql
+SELECT * FROM table_name;
+```
+
+Affect test results.
+
### Shadow algorithm example
1. Column shadow algorithm example