TestListReportTypes.golden 3.1 KB
Newer Older
martianzhang's avatar
martianzhang 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
# 支持的报告类型

[toc]

## lint
* **Description**:参考sqlint格式,以插件形式集成到代码编辑器,显示输出更加友好

* **Example**:

```bash
soar -report-type lint -query test.sql
```
## markdown
* **Description**:该格式为默认输出格式,以markdown格式展现,可以用网页浏览器插件直接打开,也可以用markdown编辑器打开

* **Example**:

```bash
echo "select * from film" | soar
```
## rewrite
* **Description**:SQL重写功能,配合-rewrite-rules参数一起使用,可以通过-list-rewrite-rules查看所有支持的SQL重写规则

* **Example**:

```bash
echo "select * from film" | soar -rewrite-rules star2columns,delimiter -report-type rewrite
```
## ast
* **Description**:输出SQL的抽象语法树,主要用于测试

* **Example**:

```bash
echo "select * from film" | soar -report-type ast
```
## tiast
* **Description**:输出SQL的TiDB抽象语法树,主要用于测试

* **Example**:

```bash
echo "select * from film" | soar -report-type tiast
```
## fingerprint
* **Description**:输出SQL的指纹

* **Example**:

```bash
echo "select * from film where language_id=1" | soar -report-type fingerprint
```
## md2html
* **Description**:markdown格式转html格式小工具

* **Example**:

```bash
soar -list-heuristic-rules | soar -report-type md2html > heuristic_rules.html
```
## explain-digest
* **Description**:输入为EXPLAIN的表格,JSON或Vertical格式,对其进行分析,给出分析结果

* **Example**:

```bash
soar -report-type explain-digest << EOF
+----+-------------+-------+------+---------------+------+---------+------+------+-------+
| id | select_type | table | type | possible_keys | key  | key_len | ref  | rows | Extra |
+----+-------------+-------+------+---------------+------+---------+------+------+-------+
|  1 | SIMPLE      | film  | ALL  | NULL          | NULL | NULL    | NULL | 1131 |       |
+----+-------------+-------+------+---------------+------+---------+------+------+-------+
EOF
```
## duplicate-key-checker
* **Description**:对OnlineDsn中指定的DB进行索引重复检查

* **Example**:

```bash
soar -report-type duplicate-key-checker -online-dsn user:passwd@127.0.0.1:3306/db
```
## html
* **Description**:以HTML格式输出报表

* **Example**:

```bash
echo "select * from film" | soar -report-type html
```
## json
* **Description**:输出JSON格式报表,方便应用程序处理

* **Example**:

```bash
echo "select * from film" | soar -report-type json
```
## tokenize
* **Description**:对SQL进行切词,主要用于测试

* **Example**:

```bash
echo "select * from film" | soar -report-type tokenize
```
## compress
* **Description**:SQL压缩小工具,使用内置SQL压缩逻辑,测试中的功能

* **Example**:

```bash
echo "select
*
from
  film" | soar -report-type compress
```
## pretty
* **Description**:使用kr/pretty打印报告,主要用于测试

* **Example**:

```bash
echo "select * from film" | soar -report-type pretty
```
## remove-comment
* **Description**:去除SQL语句中的注释,支持单行多行注释的去除

* **Example**:

```bash
echo "select/*comment*/ * from film" | soar -report-type remove-comment
```