支持的报告类型

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

    • Example:

    markdown

    • Description:该格式为默认输出格式,以markdown格式展现,可以用网页浏览器插件直接打开,也可以用markdown编辑器打开

    • Example:

    rewrite

    • Description:SQL重写功能,配合-rewrite-rules参数一起使用,可以通过-list-rewrite-rules查看所有支持的SQL重写规则

    1. echo "select * from film" | soar -rewrite-rules star2columns,delimiter -report-type rewrite

    ast

    • Description:输出SQL的抽象语法树,主要用于测试

    • Example:

    1. echo "select * from film" | soar -report-type ast

    tiast

    • Description:输出SQL的TiDB抽象语法树,主要用于测试

    1. echo "select * from film" | soar -report-type tiast
    • Description:输出SQL的指纹

    • Example:

    md2html

    • Description:markdown格式转html格式小工具

    • Example:

    1. soar -list-heuristic-rules | soar -report-type md2html > heuristic_rules.html

    explain-digest

    • Description:输入为EXPLAIN的表格,JSON或Vertical格式,对其进行分析,给出分析结果

    • Example:

    1. soar -report-type explain-digest << EOF
    2. +----+-------------+-------+------+---------------+------+---------+------+------+-------+
    3. +----+-------------+-------+------+---------------+------+---------+------+------+-------+
    4. | 1 | SIMPLE | film | ALL | NULL | NULL | NULL | NULL | 1131 | |
    5. +----+-------------+-------+------+---------------+------+---------+------+------+-------+
    6. EOF

    duplicate-key-checker

    • Example:

    1. soar -report-type duplicate-key-checker -online-dsn user:passwd@127.0.0.1:3306/db

    html

    • Description:以HTML格式输出报表

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

    • Example:

    tokenize

    • Description:对SQL进行切词,主要用于测试

    • Example:

    compress

    • Description:SQL压缩小工具,使用内置SQL压缩逻辑,测试中的功能

    • Example:

    1. echo "select
    2. *
    3. from
    4. film" | soar -report-type compress

    pretty

    • Description:使用kr/pretty打印报告,主要用于测试

    • Example:

    1. echo "select * from film" | soar -report-type pretty

    remove-comment

    • Description:去除SQL语句中的注释,支持单行多行注释的去除