SQL解析器CLI
适用于 ✅ 开源版 ✅ 专业版 ✅ 企业版
正如我们在关于解析器 API 的上一节中看到的那样,解析器 API 可以用作源和目标方言之间的编程翻译器。如下所示,此功能也可以在命令行上方便地访问
$ java -cp jooq-3.20.5.jar:reactive-streams-1.0.3.jar:r2dbc-spi-1.0.0.RELEASE.jar org.jooq.ParserCLI -h
Usage:
-f / --formatted Format output SQL
-h / --help Display this help
-k / --keyword <RenderKeywordCase> Specify the output keyword case (org.jooq.conf.RenderKeywordCase)
-i / --identifier <RenderNameCase> Specify the output identifier case (org.jooq.conf.RenderNameCase)
-Q / --quoted <RenderQuotedNames> Specify the output identifier quoting (org.jooq.conf.RenderQuotedNames)
-F / --from-dialect <SQLDialect> Specify the input dialect (org.jooq.SQLDialect)
-T / --to-dialect <SQLDialect> Specify the output dialect (org.jooq.SQLDialect)
-s / --sql <String> Specify the input SQL string
-S / --schema <String> Specify the input schema
Commercial distribution only features:
--render-coalesce-to-empty-string-in-concat <boolean>
--render-optional-inner-keyword <RenderOptionalKeyword>
--render-optional-outer-keyword <RenderOptionalKeyword>
--render-optional-as-keyword-for-field-aliases <RenderOptionalKeyword>
--render-optional-as-keyword-for-table-aliases <RenderOptionalKeyword>
--transform-ansi-join-to-table-lists <boolean>
--transform-qualify <Transformation>
--transform-rownum <Transformation>
--transform-group-by-column-index <Transformation>
--transform-inline-cte <Transformation>
--transform-table-lists-to-ansi-join <boolean>
--transform-unneeded-arithmetic <TransformUnneededArithmeticExpressions>
-I / --interactive Start interactive mode"
$ java -cp jooq-3.20.5.jar:reactive-streams-1.0.3.jar:r2dbc-spi-1.0.0.RELEASE.jar org.jooq.ParserCLI -T ORACLE -s "SELECT substring('abcde', 2, 3)"
select substr('abcde', 2, 3) from dual;
Windows 用户:请在上面的示例中将 : 替换为 ;。
使用此 API 的另一种方法是 https://jooq.org.cn/translate 网站。
反馈
您对此页面有任何反馈吗? 我们很乐意听取您的意见!