你好,我正在方法中执行此操作
public void update(Table table, String tableName){
ArrayList 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:
- update New_tab1 set 'id' = '0', 'name' = 'John' where (id=1);
- update New_tab1 set 'id' = '1', 'name' = 'Pierce' where (id=2);
我知道这个主题已经创建,但我认为有点不同。
Tôi là một lập trình viên xuất sắc, rất giỏi!