JOOQ - support for UPDATE ... SET ... query with arbitrary degree

I have two functions: one returns a list of fields, the other returns a select query (which selects the appropriate field values).

private List<Field<?>> fields() {
    ....
}

private Select<?> select() {
    ...
}

Note that the degree is determined at runtime, it depends on user input. Therefore, List<Field<?>>and Select<?>.

You can insert into the table:

context.insertInto(table, fields()).select(select()))

Unable to update table:

context.update(table).set(DSL.row(fields()), select())

Can this functionality be added in jOOQ 3.7?

What workaround can you use now?

+1
source share
1 answer

, UpdateSetFirstStep DSL API, RowN , , DSL.row(Collection). jOOQ 3.7: https://github.com/jOOQ/jOOQ/issues/4475

, , :

context.update(table).set((Row1) DSL.row(fields()), (Select) select())

DSL.row(fields()) Row1, , DSL.row(fields()), Row[N].

+2

Source: https://habr.com/ru/post/1618500/


All Articles