From 1bf64769b4a0b6fe57b9e0c1f2a8c9a869c19ff7 Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Tue, 14 Feb 2023 10:01:15 +0100 Subject: [PATCH] [jOOQ/jOOQ#14634] Deprecate transformInConditionSubqueryWithLimitToDerivedTable configuration and offer transformation in the jOOQ Open Source Edition --- .../src/main/java/org/jooq/conf/Settings.java | 12 +++++++++ jOOQ/src/main/java/org/jooq/impl/Eq.java | 6 ++--- .../main/java/org/jooq/impl/EqQuantified.java | 12 ++++----- .../org/jooq/impl/RowSubqueryCondition.java | 26 ++++++++----------- .../org/jooq/xsd/jooq-runtime-3.18.0.xsd | 15 +++++++++-- 5 files changed, 43 insertions(+), 28 deletions(-) diff --git a/jOOQ/src/main/java/org/jooq/conf/Settings.java b/jOOQ/src/main/java/org/jooq/conf/Settings.java index 81304d47c5..721552371e 100644 --- a/jOOQ/src/main/java/org/jooq/conf/Settings.java +++ b/jOOQ/src/main/java/org/jooq/conf/Settings.java @@ -3702,8 +3702,12 @@ public class Settings * This transformation works around a known MySQL limitation "ERROR 1235 (42000): This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'" *

* This feature is available in the commercial distribution only. + *

+ * @deprecated - 3.18.0 - [#14634] - The configuration of this transformation is deprecated. It will no longer be commercially available only, but apply also to the jOOQ Open Source Edition, when required. + * * */ + @Deprecated public Transformation getTransformInConditionSubqueryWithLimitToDerivedTable() { return transformInConditionSubqueryWithLimitToDerivedTable; } @@ -3714,8 +3718,12 @@ public class Settings * This transformation works around a known MySQL limitation "ERROR 1235 (42000): This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'" *

* This feature is available in the commercial distribution only. + *

+ * @deprecated - 3.18.0 - [#14634] - The configuration of this transformation is deprecated. It will no longer be commercially available only, but apply also to the jOOQ Open Source Edition, when required. + * * */ + @Deprecated public void setTransformInConditionSubqueryWithLimitToDerivedTable(Transformation value) { this.transformInConditionSubqueryWithLimitToDerivedTable = value; } @@ -6473,8 +6481,12 @@ public class Settings * This transformation works around a known MySQL limitation "ERROR 1235 (42000): This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'" *

* This feature is available in the commercial distribution only. + *

+ * @deprecated - 3.18.0 - [#14634] - The configuration of this transformation is deprecated. It will no longer be commercially available only, but apply also to the jOOQ Open Source Edition, when required. + * * */ + @Deprecated public Settings withTransformInConditionSubqueryWithLimitToDerivedTable(Transformation value) { setTransformInConditionSubqueryWithLimitToDerivedTable(value); return this; diff --git a/jOOQ/src/main/java/org/jooq/impl/Eq.java b/jOOQ/src/main/java/org/jooq/impl/Eq.java index 42b4919119..abc775b6e6 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Eq.java +++ b/jOOQ/src/main/java/org/jooq/impl/Eq.java @@ -132,10 +132,8 @@ implements ctx.visit(compareRowRow.apply(row(embeddedFields(arg1)), row(embeddedFields(arg2)))); else if ((op == org.jooq.Comparator.IN || op == org.jooq.Comparator.NOT_IN) && (s = Transformations.subqueryWithLimit(arg2)) != null - && Transformations.transformInConditionSubqueryWithLimitToDerivedTable(ctx.configuration())) { - - - + && Transformations.NO_SUPPORT_IN_LIMIT.contains(ctx.dialect())) { + ctx.visit(arg1.compare(op, (Select) select(asterisk()).from(s.asTable("t")))); } else if (arg1.getDataType().isMultiset() && arg2.getDataType().isMultiset() diff --git a/jOOQ/src/main/java/org/jooq/impl/EqQuantified.java b/jOOQ/src/main/java/org/jooq/impl/EqQuantified.java index c6fd0e86ba..f3b6b3cd99 100644 --- a/jOOQ/src/main/java/org/jooq/impl/EqQuantified.java +++ b/jOOQ/src/main/java/org/jooq/impl/EqQuantified.java @@ -140,13 +140,11 @@ implements else if ((op == org.jooq.Comparator.EQUALS || op == org.jooq.Comparator.NOT_EQUALS) && (arg2 instanceof QOM.QuantifiedSelect) && (s = Transformations.subqueryWithLimit(((QOM.QuantifiedSelect) arg2).$query())) != null - && Transformations.transformInConditionSubqueryWithLimitToDerivedTable(ctx.configuration())) { - - - - - - + && Transformations.NO_SUPPORT_IN_LIMIT.contains(ctx.dialect())) { + ctx.visit(arg1.compare(op, quantify( + ((QOM.QuantifiedSelect) arg2).$quantifier(), + (Select) select(asterisk()).from(s.asTable("t")) + ))); } diff --git a/jOOQ/src/main/java/org/jooq/impl/RowSubqueryCondition.java b/jOOQ/src/main/java/org/jooq/impl/RowSubqueryCondition.java index 4eb7d62df0..e3f54bb333 100644 --- a/jOOQ/src/main/java/org/jooq/impl/RowSubqueryCondition.java +++ b/jOOQ/src/main/java/org/jooq/impl/RowSubqueryCondition.java @@ -208,25 +208,21 @@ final class RowSubqueryCondition extends AbstractCondition implements UNotYetImp if ((comparator == IN || comparator == NOT_IN) && right != null && (s = subqueryWithLimit(right)) != null - && transformInConditionSubqueryWithLimitToDerivedTable(ctx.configuration())) { - - - + && Transformations.NO_SUPPORT_IN_LIMIT.contains(ctx.dialect())) { + ctx.visit(new RowSubqueryCondition(left, select(asterisk()).from(s.asTable("t")), comparator)); } else if ((comparator == EQUALS || comparator == NOT_EQUALS) && rightQuantified != null && (s = subqueryWithLimit(rightQuantified)) != null - && transformInConditionSubqueryWithLimitToDerivedTable(ctx.configuration())) { - - - - - - - - - - + && Transformations.NO_SUPPORT_IN_LIMIT.contains(ctx.dialect())) { + ctx.visit(new RowSubqueryCondition( + left, + quantify( + ((QuantifiedSelectImpl) rightQuantified).quantifier, + select(asterisk()).from(s.asTable("t")) + ), + comparator + )); } else accept0(ctx); 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 a6742653b7..e33a60f9b7 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 @@ -1066,11 +1066,22 @@ This feature is available in the commercial distribution only.]]>< - + + + This transformation works around a known MySQL limitation "ERROR 1235 (42000): This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'"

-This feature is available in the commercial distribution only.]]> +This feature is available in the commercial distribution only. +

+@deprecated - 3.18.0 - [#14634] - The configuration of this transformation is deprecated. It will no longer be commercially available only, but apply also to the jOOQ Open Source Edition, when required.]]> + + + @java.lang.Deprecated + @java.lang.Deprecated + +