-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add doc of keep_user_target_list_in_result (#1067)
- Loading branch information
Showing
2 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
82 changes: 82 additions & 0 deletions
82
...atrixOne/Reference/Variable/system-variables/keep_user_target_list_in_result.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# keep_user_target_list_in_result 保持查询结果集列名与用户指定大小写一致 | ||
|
||
在 MatrixOne 查询中,保持结果集列名与用户指定的名称大小一致,除了可以通过使用别名(alias)来实现,还可以通过设置参数来实现。 | ||
|
||
`keep_user_target_list_in_result` 是 MatrixOne 设置查询结果集列名与用户指定的名称大小写是否一致的一个全局参数。 | ||
|
||
## 查看 keep_user_target_list_in_result | ||
|
||
在 MatrixOne 中使用以下命令查看 `keep_user_target_list_in_result`: | ||
|
||
```sql | ||
show variables like "keep_user_target_list_in_result";--默认为 0 | ||
``` | ||
|
||
## 设置 keep_user_target_list_in_result | ||
|
||
在 MatrixOne 中使用以下命令设置 `keep_user_target_list_in_result`: | ||
|
||
```sql | ||
set global keep_user_target_list_in_result = 0;--默认为 0,重新连接数据库生效 | ||
``` | ||
|
||
## 配置 | ||
|
||
在命令行执行以下语句: | ||
|
||
```sql | ||
set global keep_user_target_list_in_result = 1;// 默认为 0,重新连接数据库生效 | ||
``` | ||
|
||
## 示例 | ||
|
||
```sql | ||
create table t1(aa int, bb int, cc int, AbC varchar(25), A_BC_d double); | ||
insert into t1 values (1,2,3,'A',10.9); | ||
|
||
mysql> select * from t1; | ||
+------+------+------+------+--------+ | ||
| aa | bb | cc | abc | a_bc_d | | ||
+------+------+------+------+--------+ | ||
| 1 | 2 | 3 | A | 10.9 | | ||
+------+------+------+------+--------+ | ||
1 row in set (0.00 sec) | ||
|
||
mysql> select @@keep_user_target_list_in_result;--查询参数值,默认关闭 | ||
+-----------------------------------+ | ||
| @@keep_user_target_list_in_result | | ||
+-----------------------------------+ | ||
| 0 | | ||
+-----------------------------------+ | ||
1 row in set (0.01 sec) | ||
|
||
mysql> select aA, bB, CC, abc, a_Bc_D from t1;--在设置关闭情况下,查询结果集列名与用户指定的名称大小写不一致 | ||
+------+------+------+------+--------+ | ||
| aa | bb | cc | abc | a_bc_d | | ||
+------+------+------+------+--------+ | ||
| 1 | 2 | 3 | A | 10.9 | | ||
+------+------+------+------+--------+ | ||
1 row in set (0.00 sec) | ||
|
||
mysql> set global keep_user_target_list_in_result =1;--开启查询结果集列名与用户指定的名称大小一致设置 | ||
Query OK, 0 rows affected (0.01 sec) | ||
|
||
mysql> exit;--退出数据库重新连接后参数生效 | ||
|
||
mysql> select @@keep_user_target_list_in_result;--查询参数值,开启成功 | ||
+-----------------------------------+ | ||
| @@keep_user_target_list_in_result | | ||
+-----------------------------------+ | ||
| 1 | | ||
+-----------------------------------+ | ||
1 row in set (0.00 sec) | ||
|
||
mysql> select aA, bB, CC, abc, a_Bc_D from t1;--在设置开启情况下,查询结果集列名与用户指定的名称大小写一致 | ||
+------+------+------+------+--------+ | ||
| aA | bB | CC | abc | a_Bc_D | | ||
+------+------+------+------+--------+ | ||
| 1 | 2 | 3 | A | 10.9 | | ||
+------+------+------+------+--------+ | ||
1 row in set (0.00 sec) | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters