[英]jOOQ - parse plain sql with QueryPart placeholders
I have a fields, that was created from from plain Sql string in MSSQL Dialect and that can't be feed to a parser due to a complex syntax.我有一个字段,它是从 MSSQL 方言中的普通 Sql 字符串创建的,由于语法复杂,它不能提供给解析器。 And i have a Plain sql string with query parts placeholders in PostgreSQL dialect, like so:
我有一个普通的 sql 字符串,其中查询部件占位符在 PostgreSQL 方言中,如下所示:
String myComplexSqlString = "({0} + sum({1}::integer)::text || {3}"
Is there any ways i can parse this SQL and insert all the query parts i need after the parsing step and render the whole field to MSSQL Dialect?有什么方法可以解析这个 SQL 并在解析步骤之后插入我需要的所有查询部分并将整个字段呈现为 MSSQL 方言? Any suggestions?
有什么建议么?
That's not currently possible but it does sound interesting.这目前是不可能的,但听起来确实很有趣。 I've created a feature request for this: https://github.com/jOOQ/jOOQ/issues/9447
我为此创建了一个功能请求: https://github.com/jOOQ/jOOQ/issues/9447
For the time being, in your example, there's nothing preventing you from using jOOQ's API to construct this "complex SQL":目前,在您的示例中,没有什么可以阻止您使用 jOOQ 的 API 来构造这个“复杂的 SQL”:
Field<String> complexSQL(Field<? extends Number> arg0, Field<?> arg1, Field<?> arg3) {
return cast(arg0.add(sum(cast(arg1, INTEGER))), CLOB).concat(arg3);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.