gpt4 book ai didi

java - Jooq (java) - 方言 DEFAULT 不支持类型类 org.jooq.impl.UnqualifiedName

转载 作者:行者123 更新时间:2023-11-30 01:52:43 26 4
gpt4 key购买 nike

你好,我正在方法中执行此操作

public void update(Table table, String tableName){
ArrayList<Name> firstRowInDslFormat = new ArrayList<>();
for (Object value : table.getTableDataInRowFormat(false).get(0))
firstRowInDslFormat.add(DSL.name(value.toString()));

for (int rowId = 1; rowId < table.getTableDataInRowFormat(false).size(); rowId++) {
stringBuilder.append("\n" + ctx
.update(DSL.table(DSL.name(tableName)))
.set(
DSL.row(firstRowInDslFormat),
DSL.row(table.getTableDataInRowFormat(false).get(rowId))
)
.where(...).getSQL(ParamType.INLINED) + ";");
}
}

getTableDataInRowFormat() returns Map(Integer,ArrayList) -> Map(rowId, row column values in string)

我不知道如何解决它。正如您在启动方法中看到的那样,我尝试将类型从字符串更改为名称,但它引发了错误:引起原因:org.jooq.exception.SQLDialectNotSupportedException:方言 DEFAULT 中不支持类型类 org.jooq.impl.UnqualifiedName

当我只使用这样的字符串时:

 DSL.row(table.getTableDataInRowFormat(false).get(0)), 
DSL.row(table.getTableDataInRowFormat(false).get(rowId))).where()...

它可以工作...但它会返回带有“”的列名称,正如您在下面的输出中看到的那样...当我运行它时,它会因语法而抛出错误,其中不需要“”。

Output when I use only strings:

  1. update New_tab1 set 'id' = '0', 'name' = 'John' where (id=1);
  2. update New_tab1 set 'id' = '1', 'name' = 'Pierce' where (id=2);

我知道这个主题已经创建,但我认为有点不同。

最佳答案

这绝对是 jOOQ API 的一个限制。您应该能够传递一组 org.jooq.Name 实例(或 org.jooq.Select 实例)到 DSL.row(Collection<?>) 。我为此创建了一个问题:https://github.com/jOOQ/jOOQ/issues/8492

作为解决方法,请使用 Field<?>实例,而不是 Name实例:

ArrayList<Field<?>> firstRowInDslFormat = new ArrayList<>();
for (Object value : table.getTableDataInRowFormat(false).get(0))
firstRowInDslFormat.add(DSL.field(DSL.name(value.toString()), value.getClass()));

关于java - Jooq (java) - 方言 DEFAULT 不支持类型类 org.jooq.impl.UnqualifiedName,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55520420/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com