[jOOQ/jOQO#7284] Replace common patterns in query object model

- Some LOG, LN, and EXP transformations
This commit is contained in:
Lukas Eder 2022-03-18 11:17:44 +01:00
parent 660a16ce30
commit 1b4dc05ef7
3 changed files with 90 additions and 0 deletions

View File

@ -161,6 +161,8 @@ public class Settings
@XmlElement(defaultValue = "true")
protected Boolean transformPatternsTrigonometricFunctions = true;
@XmlElement(defaultValue = "true")
protected Boolean transformPatternsLogarithmicFunctions = true;
@XmlElement(defaultValue = "true")
protected Boolean transformPatternsHyperbolicFunctions = true;
@XmlElement(defaultValue = "true")
protected Boolean transformPatternsInverseHyperbolicFunctions = true;
@ -1875,6 +1877,36 @@ public class Settings
this.transformPatternsTrigonometricFunctions = value;
}
/**
* Transform <code>LN(value) / LN(base)</code> to <code>LOG(base, value)</code>, and other transformations.
* <p>
* This transformation turns expanded logarithmic function definitions into their shorter equivalents.
* <p>
* To enable this feature, {@link #transformPatterns} must be enabled as well.
* <p>
* This feature is available in the commercial distribution only.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isTransformPatternsLogarithmicFunctions() {
return transformPatternsLogarithmicFunctions;
}
/**
* Sets the value of the transformPatternsLogarithmicFunctions property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setTransformPatternsLogarithmicFunctions(Boolean value) {
this.transformPatternsLogarithmicFunctions = value;
}
/**
* Transform <code>(EXP(x) - EXP(-x)) / 2</code> to <code>SINH(x)</code>, and other transformations.
* <p>
@ -4319,6 +4351,11 @@ public class Settings
return this;
}
public Settings withTransformPatternsLogarithmicFunctions(Boolean value) {
setTransformPatternsLogarithmicFunctions(value);
return this;
}
public Settings withTransformPatternsHyperbolicFunctions(Boolean value) {
setTransformPatternsHyperbolicFunctions(value);
return this;
@ -5181,6 +5218,7 @@ public class Settings
builder.append("transformPatternsIdempotentFunctionRepetition", transformPatternsIdempotentFunctionRepetition);
builder.append("transformPatternsArithmeticExpressions", transformPatternsArithmeticExpressions);
builder.append("transformPatternsTrigonometricFunctions", transformPatternsTrigonometricFunctions);
builder.append("transformPatternsLogarithmicFunctions", transformPatternsLogarithmicFunctions);
builder.append("transformPatternsHyperbolicFunctions", transformPatternsHyperbolicFunctions);
builder.append("transformPatternsInverseHyperbolicFunctions", transformPatternsInverseHyperbolicFunctions);
builder.append("transformAnsiJoinToTableLists", transformAnsiJoinToTableLists);
@ -5795,6 +5833,15 @@ public class Settings
return false;
}
}
if (transformPatternsLogarithmicFunctions == null) {
if (other.transformPatternsLogarithmicFunctions!= null) {
return false;
}
} else {
if (!transformPatternsLogarithmicFunctions.equals(other.transformPatternsLogarithmicFunctions)) {
return false;
}
}
if (transformPatternsHyperbolicFunctions == null) {
if (other.transformPatternsHyperbolicFunctions!= null) {
return false;
@ -6739,6 +6786,7 @@ public class Settings
result = ((prime*result)+((transformPatternsIdempotentFunctionRepetition == null)? 0 :transformPatternsIdempotentFunctionRepetition.hashCode()));
result = ((prime*result)+((transformPatternsArithmeticExpressions == null)? 0 :transformPatternsArithmeticExpressions.hashCode()));
result = ((prime*result)+((transformPatternsTrigonometricFunctions == null)? 0 :transformPatternsTrigonometricFunctions.hashCode()));
result = ((prime*result)+((transformPatternsLogarithmicFunctions == null)? 0 :transformPatternsLogarithmicFunctions.hashCode()));
result = ((prime*result)+((transformPatternsHyperbolicFunctions == null)? 0 :transformPatternsHyperbolicFunctions.hashCode()));
result = ((prime*result)+((transformPatternsInverseHyperbolicFunctions == null)? 0 :transformPatternsInverseHyperbolicFunctions.hashCode()));
result = ((prime*result)+((transformAnsiJoinToTableLists == null)? 0 :transformAnsiJoinToTableLists.hashCode()));

View File

@ -1343,6 +1343,38 @@ package org.jooq.impl;

View File

@ -510,6 +510,16 @@ To enable this feature, {@link #transformPatterns} must be enabled as well.
This feature is available in the commercial distribution only.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="transformPatternsLogarithmicFunctions" type="boolean" minOccurs="0" maxOccurs="1" default="true">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Transform <code>LN(value) / LN(base)</code> to <code>LOG(base, value)</code>, and other transformations.
<p>
This transformation turns expanded logarithmic function definitions into their shorter equivalents.
<p>
To enable this feature, {@link #transformPatterns} must be enabled as well.
<p>
This feature is available in the commercial distribution only.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="transformPatternsHyperbolicFunctions" type="boolean" minOccurs="0" maxOccurs="1" default="true">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Transform <code>(EXP(x) - EXP(-x)) / 2</code> to <code>SINH(x)</code>, and other transformations.
<p>