[jOOQ/jOOQ#14634] Deprecate transformInConditionSubqueryWithLimitToDerivedTable configuration and offer transformation in the jOOQ Open Source Edition

This commit is contained in:
Lukas Eder 2023-02-14 10:01:15 +01:00
parent ddb6529159
commit 1bf64769b4
5 changed files with 43 additions and 28 deletions

View File

@ -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'"
* <p>
* This feature is available in the commercial distribution only.
* <p>
* @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'"
* <p>
* This feature is available in the commercial distribution only.
* <p>
* @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'"
* <p>
* This feature is available in the commercial distribution only.
* <p>
* @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;

View File

@ -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()

View File

@ -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"))
)));
}

View File

@ -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);

View File

@ -1066,11 +1066,22 @@ This feature is available in the commercial distribution only.]]></jxb:javadoc><
</element>
<element name="transformInConditionSubqueryWithLimitToDerivedTable" type="jooq-runtime:Transformation" minOccurs="0" maxOccurs="1" default="WHEN_NEEDED">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Transform a subquery from an IN condition with LIMIT to an equivalent derived table.
<annotation>
<appinfo>
<jxb:property>
<jxb:javadoc><![CDATA[Transform a subquery from an IN condition with LIMIT to an equivalent derived table.
<p>
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'"
<p>
This feature is available in the commercial distribution only.]]></jxb:javadoc></jxb:property></appinfo></annotation>
This feature is available in the commercial distribution only.
<p>
@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.]]>
</jxb:javadoc>
</jxb:property>
<annox:annotate target="getter">@java.lang.Deprecated</annox:annotate>
<annox:annotate target="setter">@java.lang.Deprecated</annox:annotate>
</appinfo>
</annotation>
</element>
<element name="transformQualify" type="jooq-runtime:Transformation" minOccurs="0" maxOccurs="1" default="WHEN_NEEDED">