use of org.jooq.impl.Tools.BooleanDataKey.DATA_MULTISET_CONTENT in project jOOQ by jOOQ.
the class AbstractRowAsField method acceptMultisetContent.
static final void acceptMultisetContent(Context<?> ctx, Row row, Field<?> field, Consumer<? super Context<?>> acceptDefault) {
Object previous = ctx.data(DATA_MULTISET_CONTENT);
try {
ctx.data(DATA_MULTISET_CONTENT, true);
Name alias = field.getUnqualifiedName();
switch(emulateMultiset(ctx.configuration())) {
case JSON:
switch(ctx.family()) {
default:
ctx.visit(alias(ctx, alias, returningClob(ctx, jsonArray(row.fields()).nullOnNull())));
break;
}
break;
case JSONB:
switch(ctx.family()) {
default:
ctx.visit(alias(ctx, alias, returningClob(ctx, jsonbArray(row.fields()).nullOnNull())));
break;
}
break;
case XML:
switch(ctx.family()) {
default:
ctx.visit(alias(ctx, alias, xmlelement(N_RECORD, map(row.fields(), (f, i) -> xmlelement(fieldNameString(i), f)))));
break;
}
break;
// case ARRAY:
case NATIVE:
default:
acceptDefault.accept(ctx);
break;
}
} finally {
ctx.data(DATA_MULTISET_CONTENT, previous);
}
}
Aggregations