Merge pull request #24696 from taosdata/mark/3.0-doc

docs:add description for \x
This commit is contained in:
dapan1121 2024-01-31 18:29:25 +08:00 committed by GitHub
commit 41f0beb7b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 21 deletions

View File

@ -7,14 +7,14 @@ description: This document describes the usage of escape characters in TDengine.
| Escape Character | **Actual Meaning** | | Escape Character | **Actual Meaning** |
| :--------------: | ------------------------ | | :--------------: | ------------------------ |
| `\'` | Single quote ' | | `\'` | Single quote `'` |
| `\"` | Double quote " | | `\"` | Double quote `"` |
| \n | Line Break | | `\n` | Line Break |
| \r | Carriage Return | | `\r` | Carriage Return |
| \t | tab | | `\t` | tab |
| `\\` | Back Slash \ | | `\\` | Back Slash `\ ` |
| `\%` | % see below for details | | `\%` | `%` see below for details |
| `\_` | \_ see below for details | | `\_` | `_` see below for details |
## Restrictions ## Restrictions
@ -22,5 +22,5 @@ description: This document describes the usage of escape characters in TDengine.
- Identifier without ``: Error will be returned because identifier must be constituted of digits, ASCII characters or underscore and can't be started with digits - Identifier without ``: Error will be returned because identifier must be constituted of digits, ASCII characters or underscore and can't be started with digits
- Identifier quoted with ``: Original content is kept, no escaping - Identifier quoted with ``: Original content is kept, no escaping
2. If there are escape characters in values 2. If there are escape characters in values
- The escape characters will be escaped as the above table. If the escape character doesn't match any supported one, the escape character "\" will be ignored. - The escape characters will be escaped as the above table. If the escape character doesn't match any supported one, the escape character `\ ` will be ignored(`\x` remaining).
- "%" and "\_" are used as wildcards in `like`. `\%` and `\_` should be used to represent literal "%" and "\_" in `like`,. If `\%` and `\_` are used out of `like` context, the evaluation result is "`\%`"and "`\_`", instead of "%" and "\_". - `%` and `_` are used as wildcards in `like`. `\%` and `\_` should be used to represent literal `%` and `_` in `like`. If `\%` and `\_` are used out of `like` context, the evaluation result is `\%` and `\_`, instead of `%` and `_`.

View File

@ -8,16 +8,15 @@ description: TDengine 中使用转义字符的详细规则
| 字符序列 | **代表的字符** | | 字符序列 | **代表的字符** |
| :------: | -------------- | | :------: | -------------- |
| `\'` | 单引号' | | `\'` | 单引号`'` |
| `\"` | 双引号" | | `\"` | 双引号`"` |
| \n | 换行符 | | `\n` | 换行符 |
| \r | 回车符 | | `\r` | 回车符 |
| \t | tab 符 | | `\t` | tab 符 |
| `\\` | 斜杠\ | | `\\` | 斜杠 `\ ` |
| `\%` | % 规则见下 | | `\%` | `%` 规则见下 |
| `\_` | \_ 规则见下 | | `\_` | `_` 规则见下 |
:::
## 转义字符使用规则 ## 转义字符使用规则
@ -25,5 +24,5 @@ description: TDengine 中使用转义字符的详细规则
1. 普通标识符: 直接提示错误的标识符,因为标识符规定必须是数字、字母和下划线,并且不能以数字开头。 1. 普通标识符: 直接提示错误的标识符,因为标识符规定必须是数字、字母和下划线,并且不能以数字开头。
2. 反引号``标识符: 保持原样,不转义 2. 反引号``标识符: 保持原样,不转义
2. 数据里有转义字符 2. 数据里有转义字符
1. 遇到上面定义的转义字符会转义(%和\_见下面说明),如果没有匹配的转义字符会忽略掉转义符\。 1. 遇到上面定义的转义字符会转义(`%`和`_`见下面说明),如果没有匹配的转义字符会忽略掉转义符`\ ``\x`保持原样)
2. 对于%和\_因为在 like 里这两个字符是通配符,所以在模式匹配 like 里用`\%`%和`\_`表示字符里本身的%和\_如果在 like 模式匹配上下文之外使用`\%`或`\_`,则它们的计算结果为字符串`\%`和`\_`,而不是%和\_ 2. 对于`%`和`_`,因为在`like`里这两个字符是通配符,所以在模式匹配`like`里用`\%`和`\_`表示字符里本身的`%`和`_`,如果在`like`模式匹配上下文之外使用`\%`或`\_`,则它们的计算结果为字符串`\%`和`\_`,而不是`%`和`_`