diff --git a/jOOQ/src/main/java/org/jooq/conf/Settings.java b/jOOQ/src/main/java/org/jooq/conf/Settings.java index 9c599d19c1..0efb7305d2 100644 --- a/jOOQ/src/main/java/org/jooq/conf/Settings.java +++ b/jOOQ/src/main/java/org/jooq/conf/Settings.java @@ -163,6 +163,8 @@ public class Settings @XmlElement(defaultValue = "true") protected Boolean transformPatternsNormaliseFieldCompareValue = true; @XmlElement(defaultValue = "true") + protected Boolean transformPatternsNormaliseCoalesceToNvl = true; + @XmlElement(defaultValue = "true") protected Boolean transformPatternsOrEqToIn = true; @XmlElement(defaultValue = "true") protected Boolean transformPatternsAndNeToNotIn = true; @@ -1945,6 +1947,34 @@ public class Settings this.transformPatternsNormaliseFieldCompareValue = value; } + /** + * Transform 2 argument COALESCE(a, b) to NVL(a, b). + *

+ * 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 isTransformPatternsNormaliseCoalesceToNvl() { + return transformPatternsNormaliseCoalesceToNvl; + } + + /** + * Sets the value of the transformPatternsNormaliseCoalesceToNvl property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setTransformPatternsNormaliseCoalesceToNvl(Boolean value) { + this.transformPatternsNormaliseCoalesceToNvl = value; + } + /** * Transform x = c1 OR x = c2 to x IN (c1, c2). *

@@ -5344,6 +5374,11 @@ public class Settings return this; } + public Settings withTransformPatternsNormaliseCoalesceToNvl(Boolean value) { + setTransformPatternsNormaliseCoalesceToNvl(value); + return this; + } + public Settings withTransformPatternsOrEqToIn(Boolean value) { setTransformPatternsOrEqToIn(value); return this; @@ -6386,6 +6421,7 @@ public class Settings builder.append("transformPatternsNormaliseAssociativeOps", transformPatternsNormaliseAssociativeOps); builder.append("transformPatternsNormaliseInListSingleElementToComparison", transformPatternsNormaliseInListSingleElementToComparison); builder.append("transformPatternsNormaliseFieldCompareValue", transformPatternsNormaliseFieldCompareValue); + builder.append("transformPatternsNormaliseCoalesceToNvl", transformPatternsNormaliseCoalesceToNvl); builder.append("transformPatternsOrEqToIn", transformPatternsOrEqToIn); builder.append("transformPatternsAndNeToNotIn", transformPatternsAndNeToNotIn); builder.append("transformPatternsMergeOrComparison", transformPatternsMergeOrComparison); @@ -7041,6 +7077,15 @@ public class Settings return false; } } + if (transformPatternsNormaliseCoalesceToNvl == null) { + if (other.transformPatternsNormaliseCoalesceToNvl!= null) { + return false; + } + } else { + if (!transformPatternsNormaliseCoalesceToNvl.equals(other.transformPatternsNormaliseCoalesceToNvl)) { + return false; + } + } if (transformPatternsOrEqToIn == null) { if (other.transformPatternsOrEqToIn!= null) { return false; @@ -8274,6 +8319,7 @@ public class Settings result = ((prime*result)+((transformPatternsNormaliseAssociativeOps == null)? 0 :transformPatternsNormaliseAssociativeOps.hashCode())); result = ((prime*result)+((transformPatternsNormaliseInListSingleElementToComparison == null)? 0 :transformPatternsNormaliseInListSingleElementToComparison.hashCode())); result = ((prime*result)+((transformPatternsNormaliseFieldCompareValue == null)? 0 :transformPatternsNormaliseFieldCompareValue.hashCode())); + result = ((prime*result)+((transformPatternsNormaliseCoalesceToNvl == null)? 0 :transformPatternsNormaliseCoalesceToNvl.hashCode())); result = ((prime*result)+((transformPatternsOrEqToIn == null)? 0 :transformPatternsOrEqToIn.hashCode())); result = ((prime*result)+((transformPatternsAndNeToNotIn == null)? 0 :transformPatternsAndNeToNotIn.hashCode())); result = ((prime*result)+((transformPatternsMergeOrComparison == null)? 0 :transformPatternsMergeOrComparison.hashCode())); diff --git a/jOOQ/src/main/java/org/jooq/impl/Patterns.java b/jOOQ/src/main/java/org/jooq/impl/Patterns.java index 1d65c50d62..9d7f612184 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Patterns.java +++ b/jOOQ/src/main/java/org/jooq/impl/Patterns.java @@ -1871,6 +1871,14 @@ package org.jooq.impl; + + + + + + + + diff --git a/jOOQ/src/main/resources/org/jooq/xsd/jooq-runtime-3.18.0.xsd b/jOOQ/src/main/resources/org/jooq/xsd/jooq-runtime-3.18.0.xsd index 9b5811577b..0ba54198b1 100644 --- a/jOOQ/src/main/resources/org/jooq/xsd/jooq-runtime-3.18.0.xsd +++ b/jOOQ/src/main/resources/org/jooq/xsd/jooq-runtime-3.18.0.xsd @@ -492,6 +492,14 @@ To enable this feature, {@link #transformPatterns} must be enabled as well. This feature is available in the commercial distribution only.]]> + + COALESCE(a, b) to NVL(a, b). +

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

+This feature is available in the commercial distribution only.]]> + + x = c1 OR x = c2 to x IN (c1, c2).