sql - jOOQ - support for UPDATE ... SET ... query with arbitrary degree -
i have 2 functions: 1 returns list of fields, other returns select query (which selects corresponding values of fields).
private list<field<?>> fields() { .... } private select<?> select() { ... }
note degree determined @ runtime, depends on user input. hence list<field<?>>
, select<?>
.
it possible insert table:
context.insertinto(table, fields()).select(select()))
it not possible update table:
context.update(table).set(dsl.row(fields()), select())
could functionality added jooq 3.7?
which workaround can use now?
nice catch, there's missing method on updatesetfirststep
dsl api, accepts rown
first argument, type returned dsl.row(collection)
. should fixed jooq 3.7: https://github.com/jooq/jooq/issues/4475
as workaround, , if can live guilt of hack, cast raw types:
context.update(table).set((row1) dsl.row(fields()), (select) select())
you can cast dsl.row(fields())
row1
, because internal implementation type returned dsl.row(fields())
implements row[n]
types.
Comments
Post a Comment