Skip to content

Commit

Permalink
[#7405] Fixed regression
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaseder committed Jun 7, 2018
1 parent 940877c commit 14896c0
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions jOOQ/src/main/java/org/jooq/impl/UDTConstant.java
Expand Up @@ -69,8 +69,12 @@ public void accept(Context<?> ctx) {
bind0((BindContext) ctx); bind0((BindContext) ctx);
} }


final void toSQL0(RenderContext context) { final void toSQL0(RenderContext ctx) {
switch (context.family()) { ParamType paramType = ctx.paramType();
if (isInline())
ctx.paramType(INLINED);

switch (ctx.family()) {






Expand Down Expand Up @@ -108,21 +112,21 @@ final void toSQL0(RenderContext context) {
// Due to lack of UDT support in the Postgres JDBC drivers, all UDT's // Due to lack of UDT support in the Postgres JDBC drivers, all UDT's
// have to be inlined // have to be inlined
case POSTGRES: { case POSTGRES: {
toSQLInline(context); toSQLInline(ctx);
return; break;
} }


// Assume default behaviour if dialect is not available // Assume default behaviour if dialect is not available
default: default:
toSQLInline(context); toSQLInline(ctx);
return; break;
} }

if (isInline())
ctx.paramType(paramType);
} }


private final void toSQLInline(RenderContext ctx) { private final void toSQLInline(RenderContext ctx) {
ParamType previous = ctx.paramType();
ctx.paramType(ParamType.INLINED);

switch (ctx.family()) { switch (ctx.family()) {




Expand Down Expand Up @@ -152,13 +156,12 @@ private final void toSQLInline(RenderContext ctx) {
separator = ", "; separator = ", ";
} }


ctx.sql(')') ctx.sql(')');
.paramType(previous);
} }


@Deprecated @Deprecated
private final String getInlineConstructor(RenderContext context) { private final String getInlineConstructor(RenderContext ctx) {
switch (context.family()) { switch (ctx.family()) {






Expand All @@ -172,12 +175,12 @@ private final String getInlineConstructor(RenderContext context) {


// Assume default behaviour if dialect is not available // Assume default behaviour if dialect is not available
default: default:
return Tools.getMappedUDTName(context.configuration(), value); return Tools.getMappedUDTName(ctx.configuration(), value);
} }
} }


final void bind0(BindContext context) { final void bind0(BindContext ctx) {
switch (context.family()) { switch (ctx.family()) {






Expand All @@ -195,13 +198,13 @@ final void bind0(BindContext context) {
// inlined instead: ROW(.., .., ..) // inlined instead: ROW(.., .., ..)
case POSTGRES: { case POSTGRES: {
for (Field<?> field : value.fields()) for (Field<?> field : value.fields())
context.visit(val(value.get(field))); ctx.visit(val(value.get(field)));


break; break;
} }


default: default:
throw new SQLDialectNotSupportedException("UDTs not supported in dialect " + context.dialect()); throw new SQLDialectNotSupportedException("UDTs not supported in dialect " + ctx.dialect());
} }
} }
} }

0 comments on commit 14896c0

Please sign in to comment.