Settings.emulateNestedRecordProjectionsUsingMultisetEmulation to replace
flattening emulation by MULTISET emulation for top level nested record
projections
This commit is contained in:
Lukas Eder 2025-03-12 15:13:57 +01:00
parent 82c32edc34
commit 7823344021
19 changed files with 81 additions and 21 deletions

View File

@ -79,7 +79,7 @@ public final class Constants {
/**
* The current jooq-runtime XSD file name.
*/
public static final String XSD_RUNTIME = "jooq-runtime-3.20.0.xsd";
public static final String XSD_RUNTIME = "jooq-runtime-3.20.3.xsd";
/**
* The current jooq-runtime XML namespace.

View File

@ -79,7 +79,7 @@ public final class Constants {
/**
* The current jooq-runtime XSD file name.
*/
public static final String XSD_RUNTIME = "jooq-runtime-3.20.0.xsd";
public static final String XSD_RUNTIME = "jooq-runtime-3.20.3.xsd";
/**
* The current jooq-runtime XML namespace.

View File

@ -79,7 +79,7 @@ public final class Constants {
/**
* The current jooq-runtime XSD file name.
*/
public static final String XSD_RUNTIME = "jooq-runtime-3.20.0.xsd";
public static final String XSD_RUNTIME = "jooq-runtime-3.20.3.xsd";
/**
* The current jooq-runtime XML namespace.

View File

@ -28,7 +28,7 @@ public class InterpreterSearchSchema
implements Serializable, Cloneable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 32003L;
protected String catalog;
@XmlElement(required = true)
protected String schema;

View File

@ -34,7 +34,7 @@ public class MappedCatalog
implements Serializable, Cloneable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 32003L;
protected String input;
@XmlElement(type = String.class)
@XmlJavaTypeAdapter(RegexAdapter.class)

View File

@ -34,7 +34,7 @@ public class MappedSchema
implements Serializable, Cloneable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 32003L;
protected String input;
@XmlElement(type = String.class)
@XmlJavaTypeAdapter(RegexAdapter.class)

View File

@ -30,7 +30,7 @@ public class MappedTable
implements Serializable, Cloneable, MappedSchemaObject, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 32003L;
protected String input;
@XmlElement(type = String.class)
@XmlJavaTypeAdapter(RegexAdapter.class)

View File

@ -30,7 +30,7 @@ public class MappedUDT
implements Serializable, Cloneable, MappedSchemaObject, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 32003L;
protected String input;
@XmlElement(type = String.class)
@XmlJavaTypeAdapter(RegexAdapter.class)

View File

@ -28,7 +28,7 @@ public class MigrationSchema
implements Serializable, Cloneable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 32003L;
protected String catalog;
@XmlElement(required = true)
protected String schema;

View File

@ -24,7 +24,7 @@ import javax.xml.namespace.QName;
@XmlRegistry
public class ObjectFactory {
private final static QName _Settings_QNAME = new QName("http://www.jooq.org/xsd/jooq-runtime-3.20.0.xsd", "settings");
private final static QName _Settings_QNAME = new QName("http://www.jooq.org/xsd/jooq-runtime-3.20.3.xsd", "settings");
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.jooq.conf
@ -121,7 +121,7 @@ public class ObjectFactory {
* @return
* the new instance of {@link JAXBElement }{@code <}{@link Settings }{@code >}
*/
@XmlElementDecl(namespace = "http://www.jooq.org/xsd/jooq-runtime-3.20.0.xsd", name = "settings")
@XmlElementDecl(namespace = "http://www.jooq.org/xsd/jooq-runtime-3.20.3.xsd", name = "settings")
public JAXBElement<Settings> createSettings(Settings value) {
return new JAXBElement<Settings>(_Settings_QNAME, Settings.class, null, value);
}

View File

@ -28,7 +28,7 @@ public class ParseSearchSchema
implements Serializable, Cloneable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 32003L;
protected String catalog;
@XmlElement(required = true)
protected String schema;

View File

@ -28,7 +28,7 @@ public class RenderFormatting
implements Serializable, Cloneable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 32003L;
@XmlElement(defaultValue = "\n")
protected String newline = "\n";
@XmlElement(defaultValue = " ")

View File

@ -32,7 +32,7 @@ public class RenderMapping
implements Serializable, Cloneable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 32003L;
protected String defaultCatalog;
protected String defaultSchema;
@XmlElementWrapper(name = "catalogs")

View File

@ -36,7 +36,7 @@ public class Settings
implements Serializable, Cloneable, XMLAppendable
{
private final static long serialVersionUID = 31900L;
private final static long serialVersionUID = 32003L;
@XmlElement(defaultValue = "true")
protected Boolean forceIntegerTypesOnZeroScaleDecimals = true;
@XmlElement(defaultValue = "true")
@ -449,6 +449,8 @@ public class Settings
@XmlSchemaType(name = "string")
protected NestedCollectionEmulation emulateMultiset = NestedCollectionEmulation.DEFAULT;
@XmlElement(defaultValue = "false")
protected Boolean emulateNestedRecordProjectionsUsingMultisetEmulation = false;
@XmlElement(defaultValue = "false")
protected Boolean emulateComputedColumns = false;
@XmlElement(defaultValue = "true")
protected Boolean computedOnClientVirtual = true;
@ -5893,6 +5895,30 @@ public class Settings
this.emulateMultiset = value;
}
/**
* [#13598] Whether nested record projections at the top level should be emulated using the <code>MULTISET</code> emulation rather than the flattening emulation, if supported by the dialect.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isEmulateNestedRecordProjectionsUsingMultisetEmulation() {
return emulateNestedRecordProjectionsUsingMultisetEmulation;
}
/**
* [#13598] Whether nested record projections at the top level should be emulated using the <code>MULTISET</code> emulation rather than the flattening emulation, if supported by the dialect.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setEmulateNestedRecordProjectionsUsingMultisetEmulation(Boolean value) {
this.emulateNestedRecordProjectionsUsingMultisetEmulation = value;
}
/**
* [#13418] Whether computed columns should be emulated in the client.
* <p>
@ -9293,6 +9319,15 @@ public class Settings
return this;
}
/**
* [#13598] Whether nested record projections at the top level should be emulated using the <code>MULTISET</code> emulation rather than the flattening emulation, if supported by the dialect.
*
*/
public Settings withEmulateNestedRecordProjectionsUsingMultisetEmulation(Boolean value) {
setEmulateNestedRecordProjectionsUsingMultisetEmulation(value);
return this;
}
/**
* [#13418] Whether computed columns should be emulated in the client.
* <p>
@ -10007,6 +10042,7 @@ public class Settings
builder.append("delimiter", delimiter);
builder.append("emulateOnDuplicateKeyUpdateOnPrimaryKeyOnly", emulateOnDuplicateKeyUpdateOnPrimaryKeyOnly);
builder.append("emulateMultiset", emulateMultiset);
builder.append("emulateNestedRecordProjectionsUsingMultisetEmulation", emulateNestedRecordProjectionsUsingMultisetEmulation);
builder.append("emulateComputedColumns", emulateComputedColumns);
builder.append("computedOnClientVirtual", computedOnClientVirtual);
builder.append("computedOnClientStored", computedOnClientStored);
@ -11736,6 +11772,15 @@ public class Settings
return false;
}
}
if (emulateNestedRecordProjectionsUsingMultisetEmulation == null) {
if (other.emulateNestedRecordProjectionsUsingMultisetEmulation!= null) {
return false;
}
} else {
if (!emulateNestedRecordProjectionsUsingMultisetEmulation.equals(other.emulateNestedRecordProjectionsUsingMultisetEmulation)) {
return false;
}
}
if (emulateComputedColumns == null) {
if (other.emulateComputedColumns!= null) {
return false;
@ -12395,6 +12440,7 @@ public class Settings
result = ((prime*result)+((delimiter == null)? 0 :delimiter.hashCode()));
result = ((prime*result)+((emulateOnDuplicateKeyUpdateOnPrimaryKeyOnly == null)? 0 :emulateOnDuplicateKeyUpdateOnPrimaryKeyOnly.hashCode()));
result = ((prime*result)+((emulateMultiset == null)? 0 :emulateMultiset.hashCode()));
result = ((prime*result)+((emulateNestedRecordProjectionsUsingMultisetEmulation == null)? 0 :emulateNestedRecordProjectionsUsingMultisetEmulation.hashCode()));
result = ((prime*result)+((emulateComputedColumns == null)? 0 :emulateComputedColumns.hashCode()));
result = ((prime*result)+((computedOnClientVirtual == null)? 0 :computedOnClientVirtual.hashCode()));
result = ((prime*result)+((computedOnClientStored == null)? 0 :computedOnClientStored.hashCode()));

View File

@ -1,2 +1,2 @@
@jakarta.xml.bind.annotation.XmlSchema(namespace = "http://www.jooq.org/xsd/jooq-runtime-3.20.0.xsd", elementFormDefault = jakarta.xml.bind.annotation.XmlNsForm.QUALIFIED)
@jakarta.xml.bind.annotation.XmlSchema(namespace = "http://www.jooq.org/xsd/jooq-runtime-3.20.3.xsd", elementFormDefault = jakarta.xml.bind.annotation.XmlNsForm.QUALIFIED)
package org.jooq.conf;

View File

@ -222,6 +222,13 @@ abstract class AbstractContext<C extends Context<C>> extends AbstractScope imple
else
return new DefaultScopeStackElement(k, v);
});
if (TRUE.equals(configuration.settings().isEmulateNestedRecordProjectionsUsingMultisetEmulation())) {
data(DATA_MULTISET_CONTENT, true);
if (ctx != null)
ctx.data(DATA_MULTISET_CONTENT, true);
}
}
// ------------------------------------------------------------------------

View File

@ -124,6 +124,7 @@ implements
// All types of row expressions must be emulated using MULTISET
// emulations if nested in some sort of MULTISET content
// [#13598] Users can also override the default behaviour
TRUE.equals(ctx.data(DATA_MULTISET_CONTENT))
// Row expressions of degree > 1 must also be emulated using MULTISET

View File

@ -4471,6 +4471,8 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
@Override
final Record get0(BindingGetResultSetContext<U> ctx) throws SQLException {
boolean skipDegree1 = !TRUE.equals(ctx.settings().isEmulateNestedRecordProjectionsUsingMultisetEmulation());
switch (ctx.family()) {
@ -4479,7 +4481,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
// [#17979] Native ROW support may be overridden for various reasons
if (TRUE.equals(ctx.executeContext().data(DATA_MULTISET_CONTENT)))
return readMultiset(ctx, dataType, true);
return readMultiset(ctx, dataType, skipDegree1);
else
return pgNewRecord(ctx,
dataType.getType(),
@ -4495,14 +4497,14 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
if (object == null)
return null;
return readMultiset(ctx, dataType, !(object instanceof Struct));
return readMultiset(ctx, dataType, skipDegree1 && !(object instanceof Struct));
}
default:
if (UDTRecord.class.isAssignableFrom(dataType.getType()))
return localExecuteContext(ctx.executeContext(), () -> (Record) ctx.resultSet().getObject(ctx.index(), typeMap(dataType.getType(), ctx)));
else
return readMultiset(ctx, dataType, true);
return readMultiset(ctx, dataType, skipDegree1);
}
}

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<schema
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:jooq-runtime="http://www.jooq.org/xsd/jooq-runtime-3.20.0.xsd"
xmlns:jooq-runtime="http://www.jooq.org/xsd/jooq-runtime-3.20.3.xsd"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:annox="http://annox.dev.java.net"
targetNamespace="http://www.jooq.org/xsd/jooq-runtime-3.20.0.xsd"
targetNamespace="http://www.jooq.org/xsd/jooq-runtime-3.20.3.xsd"
elementFormDefault="qualified"
jxb:extensionBindingPrefixes="annox"
jxb:version="2.1">
@ -1473,6 +1473,10 @@ jOOQ queries, for which no specific fetchSize value was specified.]]></jxb:javad
<element name="emulateMultiset" type="jooq-runtime:NestedCollectionEmulation" minOccurs="0" maxOccurs="1" default="DEFAULT">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[[#3884] How <code>MULTISET</code> support should be emulated.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="emulateNestedRecordProjectionsUsingMultisetEmulation" type="boolean" minOccurs="0" maxOccurs="1" default="false">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[[#13598] Whether nested record projections at the top level should be emulated using the <code>MULTISET</code> emulation rather than the flattening emulation, if supported by the dialect.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="emulateComputedColumns" type="boolean" minOccurs="0" maxOccurs="1" default="false">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[[#13418] Whether computed columns should be emulated in the client.