From de4f7fad125d00752cc576a1146ee47f80a8f434 Mon Sep 17 00:00:00 2001 From: lukaseder Date: Sat, 6 Jun 2015 12:39:54 +0200 Subject: [PATCH] [#4372] UDTRecord is not "attached" when fetched from standalone stored function call --- .../java/org/jooq/impl/ArrayRecordImpl.java | 2 +- .../java/org/jooq/impl/DefaultBinding.java | 26 +++++++++++++---- pom.xml | 29 ++++++++++--------- 3 files changed, 37 insertions(+), 20 deletions(-) diff --git a/jOOQ/src/main/java/org/jooq/impl/ArrayRecordImpl.java b/jOOQ/src/main/java/org/jooq/impl/ArrayRecordImpl.java index 37569fe4da..af979d3b3e 100644 --- a/jOOQ/src/main/java/org/jooq/impl/ArrayRecordImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/ArrayRecordImpl.java @@ -224,7 +224,7 @@ xxxxxx xxxxx xxxxxxxxxxxxxxxxxx xxxxxxx xxxxxxxxxxxxx xxxxxxxxxx xxxxxxxxxxxxxx xxxxxxxxx xxxxxxxxxxx xxxxxx xxxxx xxxx xxxxxxxxxxxxxxxxxx xxxxxx xxxxxx xxxxxxxxxxxx x - xxxxxxxxxxxxxxxxxxxxxxxx xxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx xxxxxxx x xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx diff --git a/jOOQ/src/main/java/org/jooq/impl/DefaultBinding.java b/jOOQ/src/main/java/org/jooq/impl/DefaultBinding.java index d280b7bb7e..dbfd049a1d 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DefaultBinding.java +++ b/jOOQ/src/main/java/org/jooq/impl/DefaultBinding.java @@ -67,6 +67,7 @@ import static org.jooq.impl.DSL.inline; import static org.jooq.impl.DSL.name; import static org.jooq.impl.DSL.using; import static org.jooq.impl.DefaultExecuteContext.localTargetConnection; +import static org.jooq.impl.Utils.attachRecords; import static org.jooq.impl.Utils.needsBackslashEscaping; import static org.jooq.tools.jdbc.JDBCUtils.safeClose; import static org.jooq.tools.jdbc.JDBCUtils.safeFree; @@ -95,6 +96,7 @@ import java.util.List; import java.util.UUID; // ... +import org.jooq.Attachable; import org.jooq.Binding; import org.jooq.BindingGetResultSetContext; import org.jooq.BindingGetSQLInputContext; @@ -1375,7 +1377,7 @@ public class DefaultBinding implements Binding { } /* [pro] xx xxxx xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx x - xxxxxx x xxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx xxxxxxx xxxxxxxxxxxxxxxx xxxxxx + xxxxxx x xxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx xxxxxxx xxxxxxxxxxxxxxxx xxxxxx x xx [/pro] */ else if (EnumType.class.isAssignableFrom(type)) { @@ -1400,6 +1402,10 @@ public class DefaultBinding implements Binding { result = (T) unlob(ctx.resultSet().getObject(ctx.index())); } + // [#4372] Attach records if possible / required + if (result instanceof Attachable && attachRecords(ctx.configuration())) + ((Attachable) result).attach(ctx.configuration()); + ctx.value(converter.from(result)); } @@ -1526,7 +1532,7 @@ public class DefaultBinding implements Binding { } /* [pro] xx xxxx xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx x - xxxxxx x xxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx xxxxxxx xxxxxxxxxxxxxxxx xxxxxx + xxxxxx x xxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx xxxxxxx xxxxxxxxxxxxxxxx xxxxxx x xx [/pro] */ else if (EnumType.class.isAssignableFrom(type)) { @@ -1551,6 +1557,10 @@ public class DefaultBinding implements Binding { result = (T) ctx.statement().getObject(ctx.index()); } + // [#4372] Attach records if possible / required + if (result instanceof Attachable && attachRecords(ctx.configuration())) + ((Attachable) result).attach(ctx.configuration()); + ctx.value(converter.from(result)); } @@ -1657,7 +1667,7 @@ public class DefaultBinding implements Binding { } /* [pro] xx xxxx xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx x - xxxxxx x xxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx xxxxxxx xxxxxxxxxxxxxxxx xxxxxx + xxxxxx x xxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx xxxxxxx xxxxxxxxxxxxxxxx xxxxxx x xx [/pro] */ else if (EnumType.class.isAssignableFrom(type)) { @@ -1677,7 +1687,7 @@ public class DefaultBinding implements Binding { /* [pro] xx - xxxxxxx xxxxxx xxxxx xxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx xxxxxx xxxxxxx xxxxxxx xxxxxxxxxxxxxxx xxxxx xxxxxx xxxxxxxxxxxx x + xxxxxxx xxxxxx xxxxx xxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxx xxxxx xxxxxx xxxxxxx xxxxxxx xxxxxxxxxxxxxxx xxxxx xxxxxx xxxxxxxxxxxx x xx xxxxxx xx xxxxx x xxxxxx xxxxx x @@ -1685,11 +1695,11 @@ public class DefaultBinding implements Binding { xx xxxxx xxxxxx xxx xxxxx xxxxxx xxxx xxxx xxxxxxx xx xxx xxxxxxx xxxx xxxxxxxxx xx xxxx x xxx xxxxxxxx xxxxxxxxx xx xx xxx xxxx xxx xxx - xxxxxx xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxx + xxxxxx xxxxxxxxxxxxxxxxxx xxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxx x x - xxxxxx xxxxx xxx xxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxx xxxxxxx xxxxx xxxxxxx xxxxxx xxxxxxxxxxxx x + xxxxxx xxxxx xxx xxxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxx xxxxxxxxxxxxxx xxxxxxx xxxxx xxxxxxx xxxxxx xxxxxxxxxxxx x xx xxxxxxx xx xxxxx x xxxxxxxxxxxxxxxx xxxxxx x @@ -1707,6 +1717,10 @@ public class DefaultBinding implements Binding { xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx x + xx xxxxxxx xxxxxx xxxxxxx xx xxxxxxxx x xxxxxxxx + xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxx xxxxxxx x diff --git a/pom.xml b/pom.xml index e554257cdd..e32c4e0375 100644 --- a/pom.xml +++ b/pom.xml @@ -144,7 +144,7 @@ truesaint@gmail.com firebird-support - + @@ -237,7 +237,7 @@ UTF-8 - + org.apache.maven.plugins maven-jar-plugin @@ -288,7 +288,7 @@ true - + release-oss @@ -330,7 +330,7 @@ true - + true org.apache.maven.plugins @@ -350,7 +350,7 @@ UTF-8 protected true - + -Xdoclint:none @@ -358,7 +358,7 @@ - +