From 1b4dc05ef78b98f9508b9ebbd27288c12585366c Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Fri, 18 Mar 2022 11:17:44 +0100 Subject: [PATCH] [jOOQ/jOQO#7284] Replace common patterns in query object model - Some LOG, LN, and EXP transformations --- .../src/main/java/org/jooq/conf/Settings.java | 48 +++++++++++++++++++ .../src/main/java/org/jooq/impl/Patterns.java | 32 +++++++++++++ .../org/jooq/xsd/jooq-runtime-3.17.0.xsd | 10 ++++ 3 files changed, 90 insertions(+) diff --git a/jOOQ/src/main/java/org/jooq/conf/Settings.java b/jOOQ/src/main/java/org/jooq/conf/Settings.java index b30fba1c53..a7dc60602e 100644 --- a/jOOQ/src/main/java/org/jooq/conf/Settings.java +++ b/jOOQ/src/main/java/org/jooq/conf/Settings.java @@ -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 LN(value) / LN(base) to LOG(base, value), and other transformations. + *

+ * This transformation turns expanded logarithmic function definitions into their shorter equivalents. + *

+ * To enable this feature, {@link #transformPatterns} must be enabled as well. + *

+ * 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 (EXP(x) - EXP(-x)) / 2 to SINH(x), and other transformations. *

@@ -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())); diff --git a/jOOQ/src/main/java/org/jooq/impl/Patterns.java b/jOOQ/src/main/java/org/jooq/impl/Patterns.java index 0b4bd83f69..d7d73dfc76 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Patterns.java +++ b/jOOQ/src/main/java/org/jooq/impl/Patterns.java @@ -1343,6 +1343,38 @@ package org.jooq.impl; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jOOQ/src/main/resources/org/jooq/xsd/jooq-runtime-3.17.0.xsd b/jOOQ/src/main/resources/org/jooq/xsd/jooq-runtime-3.17.0.xsd index bbc8e4dfa8..ff929031e9 100644 --- a/jOOQ/src/main/resources/org/jooq/xsd/jooq-runtime-3.17.0.xsd +++ b/jOOQ/src/main/resources/org/jooq/xsd/jooq-runtime-3.17.0.xsd @@ -510,6 +510,16 @@ To enable this feature, {@link #transformPatterns} must be enabled as well. This feature is available in the commercial distribution only.]]> + + LN(value) / LN(base) to LOG(base, value), and other transformations. +

+This transformation turns expanded logarithmic function definitions into their shorter equivalents. +

+To enable this feature, {@link #transformPatterns} must be enabled as well. +

+This feature is available in the commercial distribution only.]]> + + (EXP(x) - EXP(-x)) / 2 to SINH(x), and other transformations.