[jOOQ/jOOQ#14775] Add Settings to turn off client side computed column including audit columns

This commit is contained in:
Lukas Eder 2024-06-06 11:26:06 +02:00
parent 1abb2a19fd
commit 0185a3f314
3 changed files with 107 additions and 3 deletions

View File

@ -447,6 +447,10 @@ public class Settings
protected NestedCollectionEmulation emulateMultiset = NestedCollectionEmulation.DEFAULT;
@XmlElement(defaultValue = "false")
protected Boolean emulateComputedColumns = false;
@XmlElement(defaultValue = "true")
protected Boolean computedOnClientVirtual = true;
@XmlElement(defaultValue = "true")
protected Boolean computedOnClientStored = true;
@XmlElement(defaultValue = "LOG_DEBUG")
@XmlSchemaType(name = "string")
protected ExecuteWithoutWhere executeUpdateWithoutWhere = ExecuteWithoutWhere.LOG_DEBUG;
@ -5887,6 +5891,54 @@ public class Settings
this.emulateComputedColumns = value;
}
/**
* Whether <code>VIRTUAL</code> client side computed columns should be applied to queries. This feature is available only in commercial distributions.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isComputedOnClientVirtual() {
return computedOnClientVirtual;
}
/**
* Whether <code>VIRTUAL</code> client side computed columns should be applied to queries. This feature is available only in commercial distributions.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setComputedOnClientVirtual(Boolean value) {
this.computedOnClientVirtual = value;
}
/**
* Whether <code>STORED</code> client side computed columns should be applied to queries (including audit columns). This feature is available only in commercial distributions.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isComputedOnClientStored() {
return computedOnClientStored;
}
/**
* Whether <code>STORED</code> client side computed columns should be applied to queries (including audit columns). This feature is available only in commercial distributions.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setComputedOnClientStored(Boolean value) {
this.computedOnClientStored = value;
}
/**
* [#6771] Specifies whether UPDATE statements are allowed to be executed lacking a WHERE clause. This has no effect on rendering the statements SQL string.
*
@ -9122,6 +9174,24 @@ public class Settings
return this;
}
/**
* Whether <code>VIRTUAL</code> client side computed columns should be applied to queries. This feature is available only in commercial distributions.
*
*/
public Settings withComputedOnClientVirtual(Boolean value) {
setComputedOnClientVirtual(value);
return this;
}
/**
* Whether <code>STORED</code> client side computed columns should be applied to queries (including audit columns). This feature is available only in commercial distributions.
*
*/
public Settings withComputedOnClientStored(Boolean value) {
setComputedOnClientStored(value);
return this;
}
/**
* [#6771] Specifies whether UPDATE statements are allowed to be executed lacking a WHERE clause. This has no effect on rendering the statements SQL string.
*
@ -9770,6 +9840,8 @@ public class Settings
builder.append("emulateOnDuplicateKeyUpdateOnPrimaryKeyOnly", emulateOnDuplicateKeyUpdateOnPrimaryKeyOnly);
builder.append("emulateMultiset", emulateMultiset);
builder.append("emulateComputedColumns", emulateComputedColumns);
builder.append("computedOnClientVirtual", computedOnClientVirtual);
builder.append("computedOnClientStored", computedOnClientStored);
builder.append("executeUpdateWithoutWhere", executeUpdateWithoutWhere);
builder.append("executeDeleteWithoutWhere", executeDeleteWithoutWhere);
builder.append("interpreterDialect", interpreterDialect);
@ -11492,6 +11564,24 @@ public class Settings
return false;
}
}
if (computedOnClientVirtual == null) {
if (other.computedOnClientVirtual!= null) {
return false;
}
} else {
if (!computedOnClientVirtual.equals(other.computedOnClientVirtual)) {
return false;
}
}
if (computedOnClientStored == null) {
if (other.computedOnClientStored!= null) {
return false;
}
} else {
if (!computedOnClientStored.equals(other.computedOnClientStored)) {
return false;
}
}
if (executeUpdateWithoutWhere == null) {
if (other.executeUpdateWithoutWhere!= null) {
return false;
@ -12088,6 +12178,8 @@ public class Settings
result = ((prime*result)+((emulateOnDuplicateKeyUpdateOnPrimaryKeyOnly == null)? 0 :emulateOnDuplicateKeyUpdateOnPrimaryKeyOnly.hashCode()));
result = ((prime*result)+((emulateMultiset == null)? 0 :emulateMultiset.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()));
result = ((prime*result)+((executeUpdateWithoutWhere == null)? 0 :executeUpdateWithoutWhere.hashCode()));
result = ((prime*result)+((executeDeleteWithoutWhere == null)? 0 :executeDeleteWithoutWhere.hashCode()));
result = ((prime*result)+((interpreterDialect == null)? 0 :interpreterDialect.hashCode()));

View File

@ -37,6 +37,7 @@
*/
package org.jooq.impl;
import static java.lang.Boolean.FALSE;
import static java.lang.Boolean.TRUE;
// ...
// ...
@ -245,7 +246,8 @@ implements
return computedOnClient(configuration)
&& generationOption(configuration) != GenerationOption.VIRTUAL
&& (generatedAlwaysAsGenerator().supports(GeneratorStatementType.INSERT) ||
generatedAlwaysAsGenerator().supports(GeneratorStatementType.UPDATE));
generatedAlwaysAsGenerator().supports(GeneratorStatementType.UPDATE))
&& !FALSE.equals(configuration.settings().isComputedOnClientStored());
}
@Override
@ -257,7 +259,8 @@ implements
public final boolean computedOnClientStoredOn(GeneratorStatementType statementType, Configuration configuration) {
return computedOnClient(configuration)
&& generationOption(configuration) != GenerationOption.VIRTUAL
&& generatedAlwaysAsGenerator().supports(statementType);
&& generatedAlwaysAsGenerator().supports(statementType)
&& !FALSE.equals(configuration.settings().isComputedOnClientStored());
}
@Override
@ -269,7 +272,8 @@ implements
public final boolean computedOnClientVirtual(Configuration configuration) {
return computedOnClient(configuration)
&& generationOption(configuration) == GenerationOption.VIRTUAL
&& generatedAlwaysAsGenerator().supports(GeneratorStatementType.SELECT);
&& generatedAlwaysAsGenerator().supports(GeneratorStatementType.SELECT)
&& !FALSE.equals(configuration.settings().isComputedOnClientVirtual());
}
@Override

View File

@ -1475,6 +1475,14 @@ This can be useful if a schema was generated using a dialect that supports compu
deployed on an RDBMS that does not.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="computedOnClientVirtual" type="boolean" minOccurs="0" maxOccurs="1" default="true">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Whether <code>VIRTUAL</code> client side computed columns should be applied to queries. This feature is available only in commercial distributions.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="computedOnClientStored" type="boolean" minOccurs="0" maxOccurs="1" default="true">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Whether <code>STORED</code> client side computed columns should be applied to queries (including audit columns). This feature is available only in commercial distributions.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="executeUpdateWithoutWhere" type="jooq-runtime:ExecuteWithoutWhere" minOccurs="0" maxOccurs="1" default="LOG_DEBUG">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[[#6771] Specifies whether UPDATE statements are allowed to be executed lacking a WHERE clause. This has no effect on rendering the statements SQL string.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>