From 14896c0ab76c8a9561706b51a344e5877e59f868 Mon Sep 17 00:00:00 2001 From: lukaseder Date: Thu, 7 Jun 2018 11:28:59 +0200 Subject: [PATCH] [#7405] Fixed regression --- .../main/java/org/jooq/impl/UDTConstant.java | 39 ++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/jOOQ/src/main/java/org/jooq/impl/UDTConstant.java b/jOOQ/src/main/java/org/jooq/impl/UDTConstant.java index fb2ebd54e3..3fbb4f0623 100644 --- a/jOOQ/src/main/java/org/jooq/impl/UDTConstant.java +++ b/jOOQ/src/main/java/org/jooq/impl/UDTConstant.java @@ -69,8 +69,12 @@ public void accept(Context ctx) { bind0((BindContext) ctx); } - final void toSQL0(RenderContext context) { - switch (context.family()) { + final void toSQL0(RenderContext ctx) { + ParamType paramType = ctx.paramType(); + if (isInline()) + ctx.paramType(INLINED); + + switch (ctx.family()) { @@ -108,21 +112,21 @@ final void toSQL0(RenderContext context) { // Due to lack of UDT support in the Postgres JDBC drivers, all UDT's // have to be inlined case POSTGRES: { - toSQLInline(context); - return; + toSQLInline(ctx); + break; } // Assume default behaviour if dialect is not available default: - toSQLInline(context); - return; + toSQLInline(ctx); + break; } + + if (isInline()) + ctx.paramType(paramType); } private final void toSQLInline(RenderContext ctx) { - ParamType previous = ctx.paramType(); - ctx.paramType(ParamType.INLINED); - switch (ctx.family()) { @@ -152,13 +156,12 @@ private final void toSQLInline(RenderContext ctx) { separator = ", "; } - ctx.sql(')') - .paramType(previous); + ctx.sql(')'); } @Deprecated - private final String getInlineConstructor(RenderContext context) { - switch (context.family()) { + private final String getInlineConstructor(RenderContext ctx) { + switch (ctx.family()) { @@ -172,12 +175,12 @@ private final String getInlineConstructor(RenderContext context) { // Assume default behaviour if dialect is not available default: - return Tools.getMappedUDTName(context.configuration(), value); + return Tools.getMappedUDTName(ctx.configuration(), value); } } - final void bind0(BindContext context) { - switch (context.family()) { + final void bind0(BindContext ctx) { + switch (ctx.family()) { @@ -195,13 +198,13 @@ final void bind0(BindContext context) { // inlined instead: ROW(.., .., ..) case POSTGRES: { for (Field field : value.fields()) - context.visit(val(value.get(field))); + ctx.visit(val(value.get(field))); break; } default: - throw new SQLDialectNotSupportedException("UDTs not supported in dialect " + context.dialect()); + throw new SQLDialectNotSupportedException("UDTs not supported in dialect " + ctx.dialect()); } } }