From 25e86d05bf4e2ec786a2ce90776ced9c5f288866 Mon Sep 17 00:00:00 2001 From: lukaseder Date: Fri, 14 Dec 2018 10:00:53 +0100 Subject: [PATCH] Revert [#6282] Emulate MySQL's STRAIGHT_JOIN in Oracle using /*+LEADING*/ hint --- jOOQ/src/main/java/org/jooq/JoinType.java | 1 - .../main/java/org/jooq/SelectJoinStep.java | 18 ---------- jOOQ/src/main/java/org/jooq/Table.java | 18 ---------- .../main/java/org/jooq/impl/JoinTable.java | 12 +------ .../java/org/jooq/impl/SelectQueryImpl.java | 33 ------------------- 5 files changed, 1 insertion(+), 81 deletions(-) diff --git a/jOOQ/src/main/java/org/jooq/JoinType.java b/jOOQ/src/main/java/org/jooq/JoinType.java index bb6c21a96d..922f314440 100644 --- a/jOOQ/src/main/java/org/jooq/JoinType.java +++ b/jOOQ/src/main/java/org/jooq/JoinType.java @@ -42,7 +42,6 @@ import static org.jooq.SQLDialect.MYSQL; // ... // ... // ... -// ... import org.jooq.impl.DSL; diff --git a/jOOQ/src/main/java/org/jooq/SelectJoinStep.java b/jOOQ/src/main/java/org/jooq/SelectJoinStep.java index da6eddde40..bbbd9e3264 100644 --- a/jOOQ/src/main/java/org/jooq/SelectJoinStep.java +++ b/jOOQ/src/main/java/org/jooq/SelectJoinStep.java @@ -1671,9 +1671,6 @@ public interface SelectJoinStep extends SelectWhereStep { /** * STRAIGHT_JOIN a table to this table. - *

- * MySQL natively supports this clause. Oracle can emulate it using a - * +LEADING(a b) hint. * * @see Table#straightJoin(TableLike) */ @@ -1683,9 +1680,6 @@ public interface SelectJoinStep extends SelectWhereStep { /** * STRAIGHT_JOIN a table to this table. *

- * MySQL natively supports this clause. Oracle can emulate it using a - * +LEADING(a b) hint. - *

* NOTE: When inserting plain SQL into jOOQ objects, you must * guarantee syntax integrity. You may also create the possibility of * malicious SQL injection. Be sure to properly use bind variables and/or @@ -1701,9 +1695,6 @@ public interface SelectJoinStep extends SelectWhereStep { /** * STRAIGHT_JOIN a table to this table. *

- * MySQL natively supports this clause. Oracle can emulate it using a - * +LEADING(a b) hint. - *

* NOTE: When inserting plain SQL into jOOQ objects, you must * guarantee syntax integrity. You may also create the possibility of * malicious SQL injection. Be sure to properly use bind variables and/or @@ -1719,9 +1710,6 @@ public interface SelectJoinStep extends SelectWhereStep { /** * STRAIGHT_JOIN a table to this table. *

- * MySQL natively supports this clause. Oracle can emulate it using a - * +LEADING(a b) hint. - *

* NOTE: When inserting plain SQL into jOOQ objects, you must * guarantee syntax integrity. You may also create the possibility of * malicious SQL injection. Be sure to properly use bind variables and/or @@ -1738,9 +1726,6 @@ public interface SelectJoinStep extends SelectWhereStep { /** * STRAIGHT_JOIN a table to this table. *

- * MySQL natively supports this clause. Oracle can emulate it using a - * +LEADING(a b) hint. - *

* NOTE: When inserting plain SQL into jOOQ objects, you must * guarantee syntax integrity. You may also create the possibility of * malicious SQL injection. Be sure to properly use bind variables and/or @@ -1756,9 +1741,6 @@ public interface SelectJoinStep extends SelectWhereStep { /** * STRAIGHT_JOIN a table to this table. - *

- * MySQL natively supports this clause. Oracle can emulate it using a - * +LEADING(a b) hint. * * @see DSL#table(Name) * @see Table#straightJoin(Name) diff --git a/jOOQ/src/main/java/org/jooq/Table.java b/jOOQ/src/main/java/org/jooq/Table.java index 8df394d3d6..abea8e118a 100644 --- a/jOOQ/src/main/java/org/jooq/Table.java +++ b/jOOQ/src/main/java/org/jooq/Table.java @@ -2043,9 +2043,6 @@ public interface Table extends TableLike, Named { /** * STRAIGHT_JOIN a table to this table. - *

- * MySQL natively supports this clause. Oracle can emulate it using a - * +LEADING(a b) hint. */ @Support({ MYSQL }) TableOnStep straightJoin(TableLike table); @@ -2053,9 +2050,6 @@ public interface Table extends TableLike, Named { /** * STRAIGHT_JOIN a table to this table. *

- * MySQL natively supports this clause. Oracle can emulate it using a - * +LEADING(a b) hint. - *

* NOTE: When inserting plain SQL into jOOQ objects, you must * guarantee syntax integrity. You may also create the possibility of * malicious SQL injection. Be sure to properly use bind variables and/or @@ -2071,9 +2065,6 @@ public interface Table extends TableLike, Named { /** * STRAIGHT_JOIN a table to this table. *

- * MySQL natively supports this clause. Oracle can emulate it using a - * +LEADING(a b) hint. - *

* NOTE: When inserting plain SQL into jOOQ objects, you must * guarantee syntax integrity. You may also create the possibility of * malicious SQL injection. Be sure to properly use bind variables and/or @@ -2089,9 +2080,6 @@ public interface Table extends TableLike, Named { /** * STRAIGHT_JOIN a table to this table. *

- * MySQL natively supports this clause. Oracle can emulate it using a - * +LEADING(a b) hint. - *

* NOTE: When inserting plain SQL into jOOQ objects, you must * guarantee syntax integrity. You may also create the possibility of * malicious SQL injection. Be sure to properly use bind variables and/or @@ -2108,9 +2096,6 @@ public interface Table extends TableLike, Named { /** * STRAIGHT_JOIN a table to this table. *

- * MySQL natively supports this clause. Oracle can emulate it using a - * +LEADING(a b) hint. - *

* NOTE: When inserting plain SQL into jOOQ objects, you must * guarantee syntax integrity. You may also create the possibility of * malicious SQL injection. Be sure to properly use bind variables and/or @@ -2126,9 +2111,6 @@ public interface Table extends TableLike, Named { /** * STRAIGHT_JOIN a table to this table. - *

- * MySQL natively supports this clause. Oracle can emulate it using a - * +LEADING(a b) hint. * * @see DSL#table(Name) */ diff --git a/jOOQ/src/main/java/org/jooq/impl/JoinTable.java b/jOOQ/src/main/java/org/jooq/impl/JoinTable.java index 1936676c75..499d3749bf 100755 --- a/jOOQ/src/main/java/org/jooq/impl/JoinTable.java +++ b/jOOQ/src/main/java/org/jooq/impl/JoinTable.java @@ -67,7 +67,6 @@ import static org.jooq.JoinType.NATURAL_LEFT_OUTER_JOIN; import static org.jooq.JoinType.NATURAL_RIGHT_OUTER_JOIN; import static org.jooq.JoinType.OUTER_APPLY; import static org.jooq.JoinType.RIGHT_OUTER_JOIN; -import static org.jooq.JoinType.STRAIGHT_JOIN; // ... // ... // ... @@ -77,8 +76,6 @@ import static org.jooq.SQLDialect.H2; // ... // ... // ... -import static org.jooq.SQLDialect.MARIADB; -import static org.jooq.SQLDialect.MYSQL; import static org.jooq.SQLDialect.POSTGRES; // ... // ... @@ -144,7 +141,6 @@ implements */ private static final long serialVersionUID = 8377996833996498178L; private static final Clause[] CLAUSES = { TABLE, TABLE_JOIN }; - private static final EnumSet SUPPORTS_STRAIGHT_JOIN = EnumSet.of(MARIADB, MYSQL); private static final EnumSet EMULATE_NATURAL_JOIN = EnumSet.of(CUBRID); private static final EnumSet EMULATE_NATURAL_OUTER_JOIN = EnumSet.of(CUBRID, H2); private static final EnumSet EMULATE_JOIN_USING = EnumSet.of(CUBRID, H2); @@ -157,7 +153,7 @@ implements - final JoinType type; + private final JoinType type; private final ConditionProviderImpl condition; private final QueryPartList> using; @@ -362,8 +358,6 @@ implements return LEFT_OUTER_JOIN; else if (emulateNaturalRightOuterJoin(context)) return RIGHT_OUTER_JOIN; - else if (emulateStraightJoin(context)) - return JOIN; else return type; } @@ -388,10 +382,6 @@ implements return type == NATURAL_RIGHT_OUTER_JOIN && EMULATE_NATURAL_OUTER_JOIN.contains(context.family()); } - private final boolean emulateStraightJoin(Context context) { - return type == STRAIGHT_JOIN && !SUPPORTS_STRAIGHT_JOIN.contains(context.family()); - } - private final void toSQLJoinCondition(Context context) { if (!using.isEmpty()) { diff --git a/jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java b/jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java index d98bcf15be..0ba95717d2 100644 --- a/jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java @@ -1189,10 +1189,6 @@ final class SelectQueryImpl extends AbstractResultQuery imp - - - - if (Tools.isNotEmpty(distinctOn)) context.visit(K_DISTINCT_ON).sql(" (").visit(distinctOn).sql(") "); else if (distinct) @@ -1522,35 +1518,6 @@ final class SelectQueryImpl extends AbstractResultQuery imp } } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - private final void toSQLOrderBy( Context ctx, Field[] originalFields, Field[] alternativeFields,