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 8763551dcd7 Add `ALTER RESOURCES` ch doc and adjust other doc formats.
(#19740)
8763551dcd7 is described below
commit 8763551dcd7b02ab2c85039bcae2aed1cd4b4364
Author: Jieker <[email protected]>
AuthorDate: Tue Aug 2 11:19:44 2022 +0800
Add `ALTER RESOURCES` ch doc and adjust other doc formats. (#19740)
* add alter resource ch doc.
* Remove extra spaces
* Unified formatting.
* Keep consist with SQL and sql.
* Prefect sql formate.
---
.../rdl/resource-definition/add-resource.cn.md | 40 +++++++------
.../rdl/resource-definition/add-resource.en.md | 35 ++++++-----
.../{add-resource.cn.md => alter-resource.cn.md} | 67 ++++++++++++----------
.../rdl/resource-definition/alter-resource.en.md | 38 +++++++-----
.../rdl/resource-definition/drop-resource.cn.md | 33 ++++++-----
.../rdl/resource-definition/drop-resource.en.md | 29 +++++++---
6 files changed, 143 insertions(+), 99 deletions(-)
diff --git
a/docs/document/content/reference/distsql/syntax/rdl/resource-definition/add-resource.cn.md
b/docs/document/content/reference/distsql/syntax/rdl/resource-definition/add-resource.cn.md
index 48922f790e1..eaa6a5cc7bc 100644
---
a/docs/document/content/reference/distsql/syntax/rdl/resource-definition/add-resource.cn.md
+++
b/docs/document/content/reference/distsql/syntax/rdl/resource-definition/add-resource.cn.md
@@ -3,15 +3,13 @@ title = "ADD RESOURCE"
weight = 2
+++
-
### 描述
`ADD RESOURCE` 语法用于为当前所选逻辑库(DATABASE)添加资源。
-
-
### 语法
-```SQL
+
+```sql
AddResource ::=
'ADD' 'RESOURCE' dataSource (',' dataSource)*
@@ -41,18 +39,21 @@ url ::=
```
- ### 特别说明
-- 添加资源前请确认已经在 Proxy 中创建逻辑数据库,并执行 `use` 命令成功选择一个逻辑数据库
-- 确认添加的资源是可以正常连接的, 否则将不能添加成功
-- `dataSourceName` 区分大小写
-- `dataSourceName` 在当前逻辑库中需要唯一
-- `dataSourceName` 命名只允许使用字母、数字以及 `_` ,且必须以字母开头
-- `poolProperty` 用于自定义连接池参数,`key` 必须和连接池参数名一致,`value` 支持 int 和 String 类型
-- 当 `password` 包含特殊字符时,建议使用 string 形式;例如 `password@123`的 string 形式为
`"password@123"`
+### 特别说明
+
+- 添加资源前请确认已经在 Proxy 中创建逻辑数据库,并执行 `use` 命令成功选择一个逻辑数据库;
+- 确认添加的资源是可以正常连接的, 否则将不能添加成功;
+- `dataSourceName` 区分大小写;
+- `dataSourceName` 在当前逻辑库中需要唯一;
+- `dataSourceName` 命名只允许使用字母、数字以及 `_` ,且必须以字母开头;
+- `poolProperty` 用于自定义连接池参数,`key` 必须和连接池参数名一致,`value` 支持 int 和 String 类型;
+- 当 `password` 包含特殊字符时,建议使用 string 形式;例如 `password@123`的 string 形式为
`"password@123"`。
+
+### 示例
- ### 示例
- 使用标准模式添加资源
-```SQL
+
+```sql
ADD RESOURCE ds_0 (
HOST=127.0.0.1,
PORT=3306,
@@ -63,7 +64,8 @@ ADD RESOURCE ds_0 (
```
- 使用标准模式添加资源并设置连接池参数
-```SQL
+
+```sql
ADD RESOURCE ds_1 (
HOST=127.0.0.1,
PORT=3306,
@@ -75,7 +77,8 @@ ADD RESOURCE ds_1 (
```
- 使用 URL 模式添加资源并设置连接池参数
-```SQL
+
+```sql
ADD RESOURCE ds_2 (
URL="jdbc:mysql://127.0.0.1:3306/db_2?serverTimezone=UTC&useSSL=false",
USER=root,
@@ -86,7 +89,8 @@ ADD RESOURCE ds_2 (
### 保留字
- ADD、RESOURCE、HOST、PORT、DB、USER、PASSWORD、PROPERTIES、URL
+`ADD`、`RESOURCE`、`HOST`、`PORT`、`DB`、`USER`、`PASSWORD`、`PROPERTIES`、`URL`
+
+### 相关链接
- ### 相关链接
- [保留字](/cn/reference/distsql/syntax/reserved-word/)
\ No newline at end of file
diff --git
a/docs/document/content/reference/distsql/syntax/rdl/resource-definition/add-resource.en.md
b/docs/document/content/reference/distsql/syntax/rdl/resource-definition/add-resource.en.md
index f8f25076b31..65e0873a00d 100644
---
a/docs/document/content/reference/distsql/syntax/rdl/resource-definition/add-resource.en.md
+++
b/docs/document/content/reference/distsql/syntax/rdl/resource-definition/add-resource.en.md
@@ -3,15 +3,13 @@ title = "ADD RESOURCE"
weight = 2
+++
-
### Description
The `ADD RESOURCE` syntax is used to add resources for the currently selected
database.
-
-
### Syntax
-```SQL
+
+```sql
AddResource ::=
'ADD' 'RESOURCE' dataSource (',' dataSource)*
@@ -41,18 +39,24 @@ url ::=
```
- ### Supplement
-- Before adding resources, please confirm that a database has been created in
Proxy, and execute the `use` command to successfully select a database
+### Supplement
+
+- Before adding resources, please confirm that a database has been created in
Proxy, and execute the `use` command to
+ successfully select a database
- Confirm that the added resource can be connected normally, otherwise it will
not be added successfully
- `dataSourceName` is case-sensitive
- `dataSourceName` needs to be unique within the current database
- `dataSourceName` name only allows letters, numbers and `_`, and must start
with a letter
-- `poolProperty` is used to customize connection pool parameters, `key` must
be the same as the connection pool parameter name, `value` supports int and
String types
-- When `password` contains special characters, it is recommended to use the
string form; for example, the string form of `password@123` is `"password@123"`
+- `poolProperty` is used to customize connection pool parameters, `key` must
be the same as the connection pool
+ parameter name, `value` supports int and String types
+- When `password` contains special characters, it is recommended to use the
string form; for example, the string form
+ of `password@123` is `"password@123"`
+
+### Example
- ### Example
- Add resource using standard mode
-```SQL
+
+```sql
ADD RESOURCE ds_0 (
HOST=127.0.0.1,
PORT=3306,
@@ -63,7 +67,8 @@ ADD RESOURCE ds_0 (
```
- Add resource and set connection pool parameters using standard mode
-```SQL
+
+```sql
ADD RESOURCE ds_1 (
HOST=127.0.0.1,
PORT=3306,
@@ -75,7 +80,8 @@ ADD RESOURCE ds_1 (
```
- Add resource and set connection pool parameters using URL patterns
-```SQL
+
+```sql
ADD RESOURCE ds_2 (
URL="jdbc:mysql://127.0.0.1:3306/db_2?serverTimezone=UTC&useSSL=false",
USER=root,
@@ -86,7 +92,8 @@ ADD RESOURCE ds_2 (
### Reserved word
- ADD, RESOURCE, HOST, PORT, DB, USER, PASSWORD, PROPERTIES, URL
+`ADD`、`RESOURCE`、`HOST`、`PORT`、`DB`、`USER`、`PASSWORD`、`PROPERTIES`、`URL`
+
+### Related links
- ### Related links
- [Reserved word](/en/reference/distsql/syntax/reserved-word/)
diff --git
a/docs/document/content/reference/distsql/syntax/rdl/resource-definition/add-resource.cn.md
b/docs/document/content/reference/distsql/syntax/rdl/resource-definition/alter-resource.cn.md
similarity index 54%
copy from
docs/document/content/reference/distsql/syntax/rdl/resource-definition/add-resource.cn.md
copy to
docs/document/content/reference/distsql/syntax/rdl/resource-definition/alter-resource.cn.md
index 48922f790e1..b1ab70c95cb 100644
---
a/docs/document/content/reference/distsql/syntax/rdl/resource-definition/add-resource.cn.md
+++
b/docs/document/content/reference/distsql/syntax/rdl/resource-definition/alter-resource.cn.md
@@ -1,19 +1,17 @@
+++
-title = "ADD RESOURCE"
-weight = 2
+title = "ALTER RESOURCE"
+weight = 4
+++
-
### 描述
-`ADD RESOURCE` 语法用于为当前所选逻辑库(DATABASE)添加资源。
-
-
+`ALTER RESOURCE` 语法用于修改当前所选逻辑库(DATABASE)的资源。
### 语法
-```SQL
-AddResource ::=
- 'ADD' 'RESOURCE' dataSource (',' dataSource)*
+
+```sql
+AlterResource ::=
+ 'ALTER' 'RESOURCE' dataSource (',' dataSource)*
dataSource ::=
dataSourceName '(' ( 'HOST' '=' hostName ',' 'PORT' '=' port ',' 'DB' '='
dbName | 'URL' '=' url ) ',' 'USER' '=' user (',' 'PASSWORD' '=' password )?
(',' 'PROPERTIES' '(' ( key '=' value ) ( ',' key '=' value )* ')' )?')'
@@ -38,22 +36,26 @@ user ::=
url ::=
identifier | string
-
```
- ### 特别说明
-- 添加资源前请确认已经在 Proxy 中创建逻辑数据库,并执行 `use` 命令成功选择一个逻辑数据库
-- 确认添加的资源是可以正常连接的, 否则将不能添加成功
-- `dataSourceName` 区分大小写
-- `dataSourceName` 在当前逻辑库中需要唯一
-- `dataSourceName` 命名只允许使用字母、数字以及 `_` ,且必须以字母开头
-- `poolProperty` 用于自定义连接池参数,`key` 必须和连接池参数名一致,`value` 支持 int 和 String 类型
-- 当 `password` 包含特殊字符时,建议使用 string 形式;例如 `password@123`的 string 形式为
`"password@123"`
-
- ### 示例
-- 使用标准模式添加资源
-```SQL
-ADD RESOURCE ds_0 (
+### 补充说明
+
+- 修改资源前请确认已经在 Proxy 中创建逻辑数据库,并执行 `use` 命令成功选择一个逻辑数据库;
+- `ALTER RESOURCE`不允许改变该资源关联的真实数据源;
+- `ALTER RESOURCE`会发生连接池的切换,这个操作可能对进行中的业务造成影响,请谨慎使用;
+- 确认添加的资源是可以正常连接的, 否则将不能添加成功;
+- `dataSourceName` 区分大小写;
+- `dataSourceName` 在当前逻辑库中需要唯一;
+- `dataSourceName` 命名只允许使用字母、数字以及 `_` ,且必须以字母开头;
+- `poolProperty` 用于自定义连接池参数,`key` 必须和连接池参数名一致,`value` 支持 int 和 String 类型;
+- 当 `password` 包含特殊字符时,建议使用 string 形式;例如 `password@123`的 string 形式为
`"password@123"`。
+
+### 示例
+
+- 使用标准模式修改资源
+
+```sql
+ALTER RESOURCE ds_0 (
HOST=127.0.0.1,
PORT=3306,
DB=db_0,
@@ -62,9 +64,10 @@ ADD RESOURCE ds_0 (
);
```
-- 使用标准模式添加资源并设置连接池参数
-```SQL
-ADD RESOURCE ds_1 (
+- 使用标准模式修改资源并设置连接池参数
+
+```sql
+ALTER RESOURCE ds_1 (
HOST=127.0.0.1,
PORT=3306,
DB=db_1,
@@ -74,9 +77,10 @@ ADD RESOURCE ds_1 (
);
```
-- 使用 URL 模式添加资源并设置连接池参数
-```SQL
-ADD RESOURCE ds_2 (
+- 使用 URL 模式修改资源并设置连接池参数
+
+```sql
+ALTER RESOURCE ds_2 (
URL="jdbc:mysql://127.0.0.1:3306/db_2?serverTimezone=UTC&useSSL=false",
USER=root,
PASSWORD=root,
@@ -86,7 +90,8 @@ ADD RESOURCE ds_2 (
### 保留字
- ADD、RESOURCE、HOST、PORT、DB、USER、PASSWORD、PROPERTIES、URL
+`ALTER`、`RESOURCE`、`HOST`、`PORT`、`DB`、`USER`、`PASSWORD`、`PROPERTIES`、`URL`
+
+### 相关链接
- ### 相关链接
- [保留字](/cn/reference/distsql/syntax/reserved-word/)
\ No newline at end of file
diff --git
a/docs/document/content/reference/distsql/syntax/rdl/resource-definition/alter-resource.en.md
b/docs/document/content/reference/distsql/syntax/rdl/resource-definition/alter-resource.en.md
index f96281392c4..3fcd6cde14f 100644
---
a/docs/document/content/reference/distsql/syntax/rdl/resource-definition/alter-resource.en.md
+++
b/docs/document/content/reference/distsql/syntax/rdl/resource-definition/alter-resource.en.md
@@ -3,15 +3,13 @@ title = "ALTER RESOURCE"
weight = 3
+++
-
### Description
The `ALTER RESOURCE` syntax is used to alter resources for the currently
selected database.
-
-
### Syntax
-```SQL
+
+```sql
AlterResource ::=
'ALTER' 'RESOURCE' dataSource (',' dataSource)*
@@ -41,17 +39,26 @@ url ::=
```
- ### Supplement
-- Before altering the resources, please confirm that a database exists in
Proxy, and execute the `use` command to successfully select a database
+### Supplement
+
+- Before altering the resources, please confirm that a database exists in
Proxy, and execute the `use` command to
+ successfully select a database
+- `ALTER RESOURCE` is not allowed to change the real data source associated
with this resource
+- `ALTER RESOURCE` will switch the connection pool. This operation may affect
the ongoing business, please use it with
+ caution
- `dataSourceName` is case-sensitive
- `dataSourceName` needs to be unique within the current database
- `dataSourceName` name only allows letters, numbers and `_`, and must start
with a letter
-- `poolProperty` is used to customize connection pool parameters, `key` must
be the same as the connection pool parameter name, `value` supports int and
String types
-- When `password` contains special characters, it is recommended to use the
string form; for example, the string form of `password@123` is `"password@123"`
+- `poolProperty` is used to customize connection pool parameters, `key` must
be the same as the connection pool
+ parameter name, `value` supports int and String types
+- When `password` contains special characters, it is recommended to use the
string form; for example, the string form
+ of `password@123` is `"password@123"`
+
+### Example
- ### Example
- Alter resource using standard mode
-```SQL
+
+```sql
ALTER RESOURCE ds_0 (
HOST=127.0.0.1,
PORT=3306,
@@ -62,7 +69,8 @@ ALTER RESOURCE ds_0 (
```
- Alter resource and set connection pool parameters using standard mode
-```SQL
+
+```sql
ALTER RESOURCE ds_1 (
HOST=127.0.0.1,
PORT=3306,
@@ -74,7 +82,8 @@ ALTER RESOURCE ds_1 (
```
- Alter resource and set connection pool parameters using URL patterns
-```SQL
+
+```sql
ALTER RESOURCE ds_2 (
URL="jdbc:mysql://127.0.0.1:3306/db_2?serverTimezone=UTC&useSSL=false",
USER=root,
@@ -85,7 +94,8 @@ ALTER RESOURCE ds_2 (
### Reserved word
- ALTER, RESOURCE, HOST, PORT, DB, USER, PASSWORD, PROPERTIES, URL
+`ALTER`、`RESOURCE`、`HOST`、`PORT`、`DB`、`USER`、`PASSWORD`、`PROPERTIES`、`URL`
+
+### Related links
- ### Related links
- [Reserved word](/en/reference/distsql/syntax/reserved-word/)
diff --git
a/docs/document/content/reference/distsql/syntax/rdl/resource-definition/drop-resource.cn.md
b/docs/document/content/reference/distsql/syntax/rdl/resource-definition/drop-resource.cn.md
index f09d923a612..0783fd3135e 100644
---
a/docs/document/content/reference/distsql/syntax/rdl/resource-definition/drop-resource.cn.md
+++
b/docs/document/content/reference/distsql/syntax/rdl/resource-definition/drop-resource.cn.md
@@ -5,44 +5,51 @@ weight = 4
### 描述
-`DROP RESOURCE` 语法用于从当前逻辑库中移除资源。
+`DROP RESOURCE` 语法用于从当前逻辑库中移除资源。
### 语法
-```SQL
+
+```sql
DropResource ::=
'DROP' 'RESOURCE' ( 'IF' 'EXISTS' )? dataSourceName ( ',' dataSourceName )*
( 'IGNORE' 'SINGLE' 'TABLES' )?
```
- ### 补充说明
+### 补充说明
+
+- `DROP RESOURCE` 只会移除 Proxy 中的资源,不会删除与资源对应的真实数据源;
+- 无法移除已经被规则使用的资源。移除被规则使用的资源时会提示 `Resources are still in used.`;
+- 将要移除的资源中仅包含 `SINGLE TABLE RULE`,且用户确认可以忽略该限制时,可添加 `IGNORE SINGLE TABLES`
关键字移除资源。
-- `DROP RESOURCE` 只会移除 Proxy 中的资源,不会删除与资源对应的真实数据源
-- 无法移除已经被规则使用的资源。移除被规则使用的资源时会提示 `Resources are still in used.`
-- 将要移除的资源中仅包含 `SINGLE TABLE RULE`,且用户确认可以忽略该限制时,可添加 `IGNORE SINGLE TABLES`
关键字移除资源
+### 示例
- ### 示例
- 移除资源
-```SQL
+
+```sql
DROP RESOURCE ds_0;
```
- 移除多个资源
-```SQL
+
+```sql
DROP RESOURCE ds_1, ds_2;
```
- 忽略单表移除资源
-```SQL
+
+```sql
DROP RESOURCE ds_3 IGNORE SINGLE TABLES;
```
- 如果资源存在则移除
-```SQL
+
+```sql
DROP RESOURCE IF EXISTS ds_4;
```
### 保留字
- DROP、 RESOURCE、 IF、 EXISTS、 IGNORE、 SINGLE、 TABLES
+`DROP`、 `RESOURCE`、 `IF`、 `EXISTS`、 `IGNORE`、 `SINGLE`、 `TABLES`
+
+### 相关链接
- ### 相关链接
- [保留字](/cn/reference/distsql/syntax/reserved-word/)
\ No newline at end of file
diff --git
a/docs/document/content/reference/distsql/syntax/rdl/resource-definition/drop-resource.en.md
b/docs/document/content/reference/distsql/syntax/rdl/resource-definition/drop-resource.en.md
index c0354f8ee80..2050676f5fa 100644
---
a/docs/document/content/reference/distsql/syntax/rdl/resource-definition/drop-resource.en.md
+++
b/docs/document/content/reference/distsql/syntax/rdl/resource-definition/drop-resource.en.md
@@ -8,40 +8,51 @@ weight = 4
The `DROP RESOURCE` syntax is used to drop resources from the current database
### Syntax
-```SQL
+
+```sql
DropResource ::=
'DROP' 'RESOURCE' ( 'IF' 'EXISTS' )? dataSourceName ( ',' dataSourceName )*
( 'IGNORE' 'SINGLE' 'TABLES' )?
```
### Supplement
-- `DROP RESOURCE` will only drop resources in Proxy, the real data source
corresponding to the resource will not be dropped
-- Unable to drop resources already used by rules. `Resources are still in
used.` will be prompted when removing resources used by rules
-- The resource need to be removed only contains `SINGLE TABLE RULE`, and when
the user confirms that this restriction can be ignored, the `IGNORE SINGLE
TABLES` keyword can be added to remove the resource
+- `DROP RESOURCE` will only drop resources in Proxy, the real data source
corresponding to the resource will not be
+ dropped
+- Unable to drop resources already used by rules. `Resources are still in
used.` will be prompted when removing
+ resources used by rules
+- The resource need to be removed only contains `SINGLE TABLE RULE`, and when
the user confirms that this restriction
+ can be ignored, the `IGNORE SINGLE TABLES` keyword can be added to remove
the resource
+
### Example
+
- Drop a resource
-```SQL
+
+```sql
DROP RESOURCE ds_0;
```
- Drop multiple resources
-```SQL
+
+```sql
DROP RESOURCE ds_1, ds_2;
```
- Ignore single table rule remove resource
-```SQL
+
+```sql
DROP RESOURCE ds_1 IGNORE SINGLE TABLES;
```
- Drop the resource if it exists
-```SQL
+
+```sql
DROP RESOURCE IF EXISTS ds_2;
```
### Reserved word
- DROP, RESOURCE, IF, EXISTS, IGNORE, SINGLE, TABLES
+`DROP`、 `RESOURCE`、 `IF`、 `EXISTS`、 `IGNORE`、 `SINGLE`、 `TABLES`
### Related links
+
- [Reserved word](/en/reference/distsql/syntax/reserved-word/)