From 656e211d42a01b4c201df06e2ab088b100942414 Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Tue, 2 May 2023 13:12:39 +0200 Subject: [PATCH] [jOOQ/jOOQ#15005] Add org.jooq.Path, a type to model join paths This includes: - New org.jooq.Path type - New JOIN method overloads - Code generation implementation and configuration --- .../org/jooq/codegen/AbstractGenerator.java | 11 + .../java/org/jooq/codegen/GenerationTool.java | 2 + .../main/java/org/jooq/codegen/Generator.java | 13 ++ .../java/org/jooq/codegen/JavaGenerator.java | 49 ++++- .../java/org/jooq/meta/jaxb/Generate.java | 42 ++++ .../org/jooq/meta/xsd/jooq-codegen-3.19.0.xsd | 4 + jOOQ/src/main/java/org/jooq/Path.java | 51 +++++ .../main/java/org/jooq/SelectJoinStep.java | 202 ++++++++++++++---- jOOQ/src/main/java/org/jooq/Table.java | 169 +++++++++++---- jOOQ/src/main/java/org/jooq/TableLike.java | 3 +- .../java/org/jooq/impl/AbstractQuery.java | 43 ++-- .../java/org/jooq/impl/AbstractTable.java | 67 +++++- .../main/java/org/jooq/impl/SelectImpl.java | 58 ++++- 13 files changed, 605 insertions(+), 109 deletions(-) create mode 100644 jOOQ/src/main/java/org/jooq/Path.java diff --git a/jOOQ-codegen/src/main/java/org/jooq/codegen/AbstractGenerator.java b/jOOQ-codegen/src/main/java/org/jooq/codegen/AbstractGenerator.java index 5c7eac0fec..1f13251aab 100644 --- a/jOOQ-codegen/src/main/java/org/jooq/codegen/AbstractGenerator.java +++ b/jOOQ-codegen/src/main/java/org/jooq/codegen/AbstractGenerator.java @@ -71,6 +71,7 @@ abstract class AbstractGenerator implements Generator { boolean generateRelations = true; boolean generateImplicitJoinPathsToOne = true; boolean generateImplicitJoinPathsToMany = true; + boolean generateImplicitJoinPathTableSubtypes = true; boolean generateImplicitJoinPathUnusedConstructors = true; boolean generateImplicitJoinPathsAsKotlinProperties = true; boolean generateInstanceFields = true; @@ -312,6 +313,16 @@ abstract class AbstractGenerator implements Generator { this.generateImplicitJoinPathsToMany = generateImplicitJoinPathsToMany; } + @Override + public boolean generateImplicitJoinPathTableSubtypes() { + return generateImplicitJoinPathTableSubtypes && generateRelations(); + } + + @Override + public void setGenerateImplicitJoinPathTableSubtypes(boolean generateImplicitJoinPathTableSubtypes) { + this.generateImplicitJoinPathTableSubtypes = generateImplicitJoinPathTableSubtypes; + } + @Override public boolean generateImplicitJoinPathUnusedConstructors() { return generateImplicitJoinPathUnusedConstructors && generateRelations(); diff --git a/jOOQ-codegen/src/main/java/org/jooq/codegen/GenerationTool.java b/jOOQ-codegen/src/main/java/org/jooq/codegen/GenerationTool.java index 9f228430da..30325f67e7 100644 --- a/jOOQ-codegen/src/main/java/org/jooq/codegen/GenerationTool.java +++ b/jOOQ-codegen/src/main/java/org/jooq/codegen/GenerationTool.java @@ -722,6 +722,8 @@ public class GenerationTool { generator.setGenerateImplicitJoinPathsToOne(g.getGenerate().isImplicitJoinPathsToOne()); if (g.getGenerate().isImplicitJoinPathsToOne() != null) generator.setGenerateImplicitJoinPathsToMany(g.getGenerate().isImplicitJoinPathsToMany()); + if (g.getGenerate().isImplicitJoinPathTableSubtypes() != null) + generator.setGenerateImplicitJoinPathTableSubtypes(g.getGenerate().isImplicitJoinPathTableSubtypes()); if (g.getGenerate().isImplicitJoinPathUnusedConstructors() != null) generator.setGenerateImplicitJoinPathUnusedConstructors(g.getGenerate().isImplicitJoinPathUnusedConstructors()); if (g.getGenerate().isImplicitJoinPathsAsKotlinProperties() != null) diff --git a/jOOQ-codegen/src/main/java/org/jooq/codegen/Generator.java b/jOOQ-codegen/src/main/java/org/jooq/codegen/Generator.java index bec6cc01c9..430699db70 100644 --- a/jOOQ-codegen/src/main/java/org/jooq/codegen/Generator.java +++ b/jOOQ-codegen/src/main/java/org/jooq/codegen/Generator.java @@ -44,6 +44,7 @@ import java.util.Locale; import org.jooq.Constants; import org.jooq.JSON; import org.jooq.JSONB; +import org.jooq.Path; import org.jooq.Spatial; import org.jooq.XML; import org.jooq.impl.DAOImpl; @@ -143,6 +144,18 @@ public interface Generator { */ void setGenerateImplicitJoinPathsToMany(boolean generateImplicitJoinPathsToMany); + /** + * Whether to generate implicit join path table subtypes implementing + * {@link Path} for increased JOIN convenience. + */ + boolean generateImplicitJoinPathTableSubtypes(); + + /** + * Whether to generate implicit join path table subtypes implementing + * {@link Path} for increased JOIN convenience. + */ + void setGenerateImplicitJoinPathTableSubtypes(boolean generateImplicitJoinPathTableSubtypes); + /** * Whether implicit join path constructors should also be generated if there * isn't any outgoing or incoming foreign key relationship. diff --git a/jOOQ-codegen/src/main/java/org/jooq/codegen/JavaGenerator.java b/jOOQ-codegen/src/main/java/org/jooq/codegen/JavaGenerator.java index 1313b1c4d1..46c9b0d37e 100644 --- a/jOOQ-codegen/src/main/java/org/jooq/codegen/JavaGenerator.java +++ b/jOOQ-codegen/src/main/java/org/jooq/codegen/JavaGenerator.java @@ -115,6 +115,7 @@ import org.jooq.OrderField; import org.jooq.Param; import org.jooq.Parameter; import org.jooq.Parser; +import org.jooq.Path; // ... import org.jooq.Query; import org.jooq.Record; @@ -6360,9 +6361,13 @@ public class JavaGenerator extends AbstractGenerator { } if (generateGlobalKeyReferences() && !table.isTableValuedFunction()) { + boolean supportsPathsToOne = false; + boolean supportsPathsToMany = false; + if (generateImplicitJoinPathsToOne() && (generateImplicitJoinPathUnusedConstructors() || !table.getInverseForeignKeys().isEmpty()) ) { + supportsPathsToOne = true; out.println(); if (scala) { @@ -6383,6 +6388,7 @@ public class JavaGenerator extends AbstractGenerator { if (generateImplicitJoinPathsToMany() && (generateImplicitJoinPathUnusedConstructors() || !table.getForeignKeys().isEmpty()) ) { + supportsPathsToMany = true; out.println(); if (scala) { @@ -6399,6 +6405,34 @@ public class JavaGenerator extends AbstractGenerator { out.println("}"); } } + + if (generateImplicitJoinPathTableSubtypes() && (supportsPathsToOne || supportsPathsToMany)) { + out.println(); + + if (scala) { + // TODO: + } + else if (kotlin) { + // TODO: + } + else { + out.println("public static class %sPath extends %s implements %s<%s> {", className, className, Path.class, recordType); + + if (supportsPathsToOne) { + out.println("%s %sPath(%s child, %s key) {", visibility(), Record.class, className, Table.class, ForeignKey.class, recordType); + out.println("super(child, key);"); + out.println("}"); + } + + if (supportsPathsToMany) { + out.println("%s %sPath(%s parent, %s key) {", visibility(), Record.class, className, Table.class, InverseForeignKey.class, recordType); + out.println("super(parent, key);"); + out.println("}"); + } + + out.println("}"); + } + } } if (scala) { @@ -6661,7 +6695,10 @@ public class JavaGenerator extends AbstractGenerator { // [#8762] Cache these calls for much improved runtime performance! for (ForeignKeyDefinition foreignKey : outboundFKs) { final String keyMethodName = out.ref(getStrategy().getJavaMethodName(foreignKey)); - final String referencedTableClassName = out.ref(getStrategy().getFullJavaClassName(foreignKey.getReferencedTable())); + final String referencedTableClassName = out.ref( + getStrategy().getFullJavaClassName(foreignKey.getReferencedTable()) + + (generateImplicitJoinPathTableSubtypes() ? ("." + getStrategy().getJavaClassName(foreignKey.getReferencedTable()) + "Path") : "") + ); final String keyFullId = kotlin ? out.ref(getStrategy().getFullJavaIdentifier(foreignKey)) : out.ref(getStrategy().getFullJavaIdentifier(foreignKey), 2); @@ -6741,7 +6778,10 @@ public class JavaGenerator extends AbstractGenerator { final String keyFullId = kotlin ? out.ref(getStrategy().getFullJavaIdentifier(foreignKey)) : out.ref(getStrategy().getFullJavaIdentifier(foreignKey), 2); - final String referencingTableClassName = out.ref(getStrategy().getFullJavaClassName(foreignKey.getReferencingTable())); + final String referencingTableClassName = out.ref( + getStrategy().getFullJavaClassName(foreignKey.getReferencingTable()) + + (generateImplicitJoinPathTableSubtypes() ? ("." + getStrategy().getJavaClassName(foreignKey.getReferencingTable()) + "Path") : "") + ); // [#13008] Prevent conflicts with the below leading underscore final String unquotedKeyMethodName = keyMethodName.replace("`", ""); @@ -6810,7 +6850,10 @@ public class JavaGenerator extends AbstractGenerator { final String key1MethodName = out.ref(getStrategy().getJavaMethodName(manyToManyKey.getForeignKey1().getInverse())); final String key2MethodName = out.ref(getStrategy().getJavaMethodName(manyToManyKey.getForeignKey2())); final TableDefinition referencedTable = manyToManyKey.getForeignKey2().getReferencedTable(); - final String referencedTableClassName = out.ref(getStrategy().getFullJavaClassName(referencedTable)); + final String referencedTableClassName = out.ref( + getStrategy().getFullJavaClassName(referencedTable) + + (generateImplicitJoinPathTableSubtypes() ? ("." + getStrategy().getJavaClassName(referencedTable) + "Path") : "") + ); out.javadoc( "Get the implicit many-to-many join path to the " + referencedTable.getQualifiedName() + " table" diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/Generate.java b/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/Generate.java index ac4ba702dd..9fc73a5fff 100644 --- a/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/Generate.java +++ b/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/Generate.java @@ -40,6 +40,8 @@ public class Generate implements Serializable, XMLAppendable protected Boolean implicitJoinPathsToOne = true; @XmlElement(defaultValue = "true") protected Boolean implicitJoinPathsToMany = true; + @XmlElement(defaultValue = "true") + protected Boolean implicitJoinPathTableSubtypes = true; @XmlElement(defaultValue = "false") protected Boolean implicitJoinPathUnusedConstructors = false; @XmlElement(defaultValue = "true") @@ -364,6 +366,30 @@ public class Generate implements Serializable, XMLAppendable this.implicitJoinPathsToMany = value; } + /** + * Generate implicit join path table subtypes implementing {@link org.jooq.Path} for increased JOIN convenience. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isImplicitJoinPathTableSubtypes() { + return implicitJoinPathTableSubtypes; + } + + /** + * Sets the value of the implicitJoinPathTableSubtypes property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setImplicitJoinPathTableSubtypes(Boolean value) { + this.implicitJoinPathTableSubtypes = value; + } + /** * Generate implicit join path constructors also if there isn't any outgoing or incoming foreign key relationship. * @@ -2694,6 +2720,11 @@ public class Generate implements Serializable, XMLAppendable return this; } + public Generate withImplicitJoinPathTableSubtypes(Boolean value) { + setImplicitJoinPathTableSubtypes(value); + return this; + } + public Generate withImplicitJoinPathUnusedConstructors(Boolean value) { setImplicitJoinPathUnusedConstructors(value); return this; @@ -3244,6 +3275,7 @@ public class Generate implements Serializable, XMLAppendable builder.append("sequenceFlags", sequenceFlags); builder.append("implicitJoinPathsToOne", implicitJoinPathsToOne); builder.append("implicitJoinPathsToMany", implicitJoinPathsToMany); + builder.append("implicitJoinPathTableSubtypes", implicitJoinPathTableSubtypes); builder.append("implicitJoinPathUnusedConstructors", implicitJoinPathUnusedConstructors); builder.append("implicitJoinPathsUseTableNameForUnambiguousFKs", implicitJoinPathsUseTableNameForUnambiguousFKs); builder.append("implicitJoinPathsAsKotlinProperties", implicitJoinPathsAsKotlinProperties); @@ -3408,6 +3440,15 @@ public class Generate implements Serializable, XMLAppendable return false; } } + if (implicitJoinPathTableSubtypes == null) { + if (other.implicitJoinPathTableSubtypes!= null) { + return false; + } + } else { + if (!implicitJoinPathTableSubtypes.equals(other.implicitJoinPathTableSubtypes)) { + return false; + } + } if (implicitJoinPathUnusedConstructors == null) { if (other.implicitJoinPathUnusedConstructors!= null) { return false; @@ -4302,6 +4343,7 @@ public class Generate implements Serializable, XMLAppendable result = ((prime*result)+((sequenceFlags == null)? 0 :sequenceFlags.hashCode())); result = ((prime*result)+((implicitJoinPathsToOne == null)? 0 :implicitJoinPathsToOne.hashCode())); result = ((prime*result)+((implicitJoinPathsToMany == null)? 0 :implicitJoinPathsToMany.hashCode())); + result = ((prime*result)+((implicitJoinPathTableSubtypes == null)? 0 :implicitJoinPathTableSubtypes.hashCode())); result = ((prime*result)+((implicitJoinPathUnusedConstructors == null)? 0 :implicitJoinPathUnusedConstructors.hashCode())); result = ((prime*result)+((implicitJoinPathsUseTableNameForUnambiguousFKs == null)? 0 :implicitJoinPathsUseTableNameForUnambiguousFKs.hashCode())); result = ((prime*result)+((implicitJoinPathsAsKotlinProperties == null)? 0 :implicitJoinPathsAsKotlinProperties.hashCode())); diff --git a/jOOQ-meta/src/main/resources/org/jooq/meta/xsd/jooq-codegen-3.19.0.xsd b/jOOQ-meta/src/main/resources/org/jooq/meta/xsd/jooq-codegen-3.19.0.xsd index 3741e010bb..671e6a25c8 100644 --- a/jOOQ-meta/src/main/resources/org/jooq/meta/xsd/jooq-codegen-3.19.0.xsd +++ b/jOOQ-meta/src/main/resources/org/jooq/meta/xsd/jooq-codegen-3.19.0.xsd @@ -1987,6 +1987,10 @@ This is a prerequisite for various advanced features]]> + + + + diff --git a/jOOQ/src/main/java/org/jooq/Path.java b/jOOQ/src/main/java/org/jooq/Path.java new file mode 100644 index 0000000000..e68f2cfa93 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/Path.java @@ -0,0 +1,51 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: https://www.jooq.org/legal/licensing + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq; + +/** + * A relationship path. + *

+ * A {@link Path} is a set of {@link ForeignKey} or {@link InverseForeignKey} + * connected {@link Table} objects that describe a join path for use as path + * joins. + * + * @author Lukas Eder + */ +public non-sealed interface Path extends TableLike { + +} diff --git a/jOOQ/src/main/java/org/jooq/SelectJoinStep.java b/jOOQ/src/main/java/org/jooq/SelectJoinStep.java index a6bff880fd..664b3b411e 100644 --- a/jOOQ/src/main/java/org/jooq/SelectJoinStep.java +++ b/jOOQ/src/main/java/org/jooq/SelectJoinStep.java @@ -166,6 +166,19 @@ public interface SelectJoinStep extends SelectWhereStep { @Support SelectOnStep join(TableLike table); + /** + * Convenience method to INNER JOIN a path to the last table + * added to the FROM clause using {@link Table#join(Path)}. + *

+ * A synonym for {@link #innerJoin(Path)}. + * + * @see Table#join(Path) + * @see #innerJoin(Path) + */ + @NotNull @CheckReturnValue + @Support + SelectOptionalOnStep join(Path path); + /** * Convenience method to INNER JOIN a table to the last table * added to the FROM clause using {@link Table#join(String)}. @@ -280,6 +293,16 @@ public interface SelectJoinStep extends SelectWhereStep { @Support SelectOnStep innerJoin(TableLike table); + /** + * Convenience method to INNER JOIN a path to the last table + * added to the FROM clause using {@link Table#join(Path)}. + * + * @see Table#innerJoin(Path) + */ + @NotNull @CheckReturnValue + @Support + SelectOnStep innerJoin(Path path); + /** * Convenience method to INNER JOIN a table to the last table * added to the FROM clause using {@link Table#join(String)}. @@ -525,6 +548,20 @@ public interface SelectJoinStep extends SelectWhereStep { @Support SelectJoinPartitionByStep leftJoin(TableLike table); + /** + * Convenience method to LEFT OUTER JOIN a path to the last + * table added to the FROM clause using + * {@link Table#leftOuterJoin(Path)}. + *

+ * A synonym for {@link #leftOuterJoin(Path)}. + * + * @see Table#leftOuterJoin(Path) + * @see #leftOuterJoin(Path) + */ + @NotNull @CheckReturnValue + @Support + SelectOptionalOnStep leftJoin(Path table); + /** * Convenience method to LEFT OUTER JOIN a table to the last * table added to the FROM clause using @@ -641,6 +678,17 @@ public interface SelectJoinStep extends SelectWhereStep { @Support SelectJoinPartitionByStep leftOuterJoin(TableLike table); + /** + * Convenience method to LEFT OUTER JOIN a path to the last + * table added to the FROM clause using + * {@link Table#leftOuterJoin(Path)} + * + * @see Table#leftOuterJoin(Path) + */ + @NotNull @CheckReturnValue + @Support + SelectOptionalOnStep leftOuterJoin(Path path); + /** * Convenience method to LEFT OUTER JOIN a table to the last * table added to the FROM clause using @@ -737,8 +785,6 @@ public interface SelectJoinStep extends SelectWhereStep { * {@link Table#rightOuterJoin(TableLike)}. *

* A synonym for {@link #rightOuterJoin(TableLike)}. - *

- * This is only possible where the underlying RDBMS supports it * * @see Table#rightOuterJoin(TableLike) * @see #rightOuterJoin(TableLike) @@ -747,6 +793,20 @@ public interface SelectJoinStep extends SelectWhereStep { @Support SelectJoinPartitionByStep rightJoin(TableLike table); + /** + * Convenience method to RIGHT OUTER JOIN a path to the last + * table added to the FROM clause using + * {@link Table#rightOuterJoin(Path)}. + *

+ * A synonym for {@link #rightOuterJoin(Path)}. + * + * @see Table#rightOuterJoin(Path) + * @see #rightOuterJoin(Path) + */ + @NotNull @CheckReturnValue + @Support + SelectOptionalOnStep rightJoin(Path path); + /** * Convenience method to RIGHT OUTER JOIN a table to the last * table added to the FROM clause using @@ -754,8 +814,6 @@ public interface SelectJoinStep extends SelectWhereStep { *

* A synonym for {@link #rightOuterJoin(String)}. *

- * This is only possible where the underlying RDBMS supports it - *

* 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 @@ -778,8 +836,6 @@ public interface SelectJoinStep extends SelectWhereStep { *

* A synonym for {@link #rightOuterJoin(String)}. *

- * This is only possible where the underlying RDBMS supports it - *

* 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 @@ -802,8 +858,6 @@ public interface SelectJoinStep extends SelectWhereStep { *

* A synonym for {@link #rightOuterJoin(String, Object...)}. *

- * This is only possible where the underlying RDBMS supports it - *

* 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 @@ -827,8 +881,6 @@ public interface SelectJoinStep extends SelectWhereStep { *

* A synonym for {@link #rightOuterJoin(String, QueryPart...)}. *

- * This is only possible where the underlying RDBMS supports it - *

* 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 @@ -851,8 +903,6 @@ public interface SelectJoinStep extends SelectWhereStep { * {@link Table#rightOuterJoin(Name)}. *

* A synonym for {@link #rightOuterJoin(Name)}. - *

- * This is only possible where the underlying RDBMS supports it * * @see DSL#table(Name) * @see Table#rightOuterJoin(Name) @@ -866,8 +916,6 @@ public interface SelectJoinStep extends SelectWhereStep { * Convenience method to RIGHT OUTER JOIN a table to the last * table added to the FROM clause using * {@link Table#rightOuterJoin(TableLike)} - *

- * This is only possible where the underlying RDBMS supports it * * @see Table#rightOuterJoin(TableLike) */ @@ -875,13 +923,22 @@ public interface SelectJoinStep extends SelectWhereStep { @Support SelectJoinPartitionByStep rightOuterJoin(TableLike table); + /** + * Convenience method to RIGHT OUTER JOIN a path to the last + * table added to the FROM clause using + * {@link Table#rightOuterJoin(Path)} + * + * @see Table#rightOuterJoin(Path) + */ + @NotNull @CheckReturnValue + @Support + SelectOptionalOnStep rightOuterJoin(Path path); + /** * Convenience method to RIGHT OUTER JOIN a table to the last * table added to the FROM clause using * {@link Table#rightOuterJoin(String)} *

- * This is only possible where the underlying RDBMS supports it - *

* 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 @@ -901,8 +958,6 @@ public interface SelectJoinStep extends SelectWhereStep { * table added to the FROM clause using * {@link Table#rightOuterJoin(String)} *

- * This is only possible where the underlying RDBMS supports it - *

* 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 @@ -922,8 +977,6 @@ public interface SelectJoinStep extends SelectWhereStep { * table added to the FROM clause using * {@link Table#rightOuterJoin(String, Object...)} *

- * This is only possible where the underlying RDBMS supports it - *

* 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 @@ -944,8 +997,6 @@ public interface SelectJoinStep extends SelectWhereStep { * table added to the FROM clause using * {@link Table#rightOuterJoin(String, QueryPart...)} *

- * This is only possible where the underlying RDBMS supports it - *

* 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 @@ -965,8 +1016,6 @@ public interface SelectJoinStep extends SelectWhereStep { * Convenience method to RIGHT OUTER JOIN a table to the last * table added to the FROM clause using * {@link Table#rightOuterJoin(Name)} - *

- * This is only possible where the underlying RDBMS supports it * * @see DSL#table(Name) * @see Table#rightOuterJoin(Name) @@ -986,6 +1035,17 @@ public interface SelectJoinStep extends SelectWhereStep { @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) SelectOnStep fullJoin(TableLike table); + /** + * Convenience method to FULL OUTER JOIN a path to the last + * table added to the FROM clause using + * {@link Table#fullOuterJoin(Path)}. + *

+ * A synonym for {@link #fullOuterJoin(Path)}. + */ + @NotNull @CheckReturnValue + @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) + SelectOptionalOnStep fullJoin(Path table); + /** * Convenience method to FULL OUTER JOIN a table to the last * table added to the FROM clause using @@ -1069,8 +1129,6 @@ public interface SelectJoinStep extends SelectWhereStep { * Convenience method to FULL OUTER JOIN a table to the last * table added to the FROM clause using * {@link Table#fullOuterJoin(TableLike)} - *

- * This is only possible where the underlying RDBMS supports it * * @see Table#fullOuterJoin(TableLike) */ @@ -1078,13 +1136,22 @@ public interface SelectJoinStep extends SelectWhereStep { @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) SelectOnStep fullOuterJoin(TableLike table); + /** + * Convenience method to FULL OUTER JOIN a path to the last + * table added to the FROM clause using + * {@link Table#fullOuterJoin(Path)} + * + * @see Table#fullOuterJoin(Path) + */ + @NotNull @CheckReturnValue + @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) + SelectOptionalOnStep fullOuterJoin(Path table); + /** * Convenience method to FULL OUTER JOIN a table to the last * table added to the FROM clause using * {@link Table#fullOuterJoin(String)} *

- * This is only possible where the underlying RDBMS supports it - *

* 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 @@ -1104,8 +1171,6 @@ public interface SelectJoinStep extends SelectWhereStep { * table added to the FROM clause using * {@link Table#fullOuterJoin(String)} *

- * This is only possible where the underlying RDBMS supports it - *

* 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 @@ -1125,8 +1190,6 @@ public interface SelectJoinStep extends SelectWhereStep { * table added to the FROM clause using * {@link Table#fullOuterJoin(String, Object...)} *

- * This is only possible where the underlying RDBMS supports it - *

* 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 @@ -1147,8 +1210,6 @@ public interface SelectJoinStep extends SelectWhereStep { * table added to the FROM clause using * {@link Table#fullOuterJoin(String, QueryPart...)} *

- * This is only possible where the underlying RDBMS supports it - *

* 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 @@ -1168,8 +1229,6 @@ public interface SelectJoinStep extends SelectWhereStep { * Convenience method to FULL OUTER JOIN a tableto the last * table added to the FROM clause using * {@link Table#fullOuterJoin(Name)} - *

- * This is only possible where the underlying RDBMS supports it * * @see DSL#table(Name) * @see Table#fullOuterJoin(Name) @@ -1689,6 +1748,37 @@ public interface SelectJoinStep extends SelectWhereStep { @Support SelectOnStep leftSemiJoin(TableLike table); + /** + * A synthetic LEFT SEMI JOIN clause that translates to an + * equivalent EXISTS predicate. + *

+ * The following two SQL snippets are semantically equivalent: + *


+     * -- Using LEFT SEMI JOIN
+     * FROM A
+     *     LEFT SEMI JOIN B
+     *         ON A.ID = B.ID
+     *
+     * -- Using WHERE EXISTS
+     * FROM A
+     * WHERE EXISTS (
+     *     SELECT 1 FROM B WHERE A.ID = B.ID
+     * )
+     * 
+ *

+ * Notice that according to + * Relational + * algebra's understanding of left semi join, the right hand side of the + * left semi join operator is not projected, i.e. it cannot be accessed from + * WHERE or SELECT or any other clause than + * ON. + * + * @see Table#leftSemiJoin(Path) + */ + @NotNull @CheckReturnValue + @Support + SelectOptionalOnStep leftSemiJoin(Path path); + /** * A synthetic LEFT ANTI JOIN clause that translates to an * equivalent NOT EXISTS predicate. @@ -1720,6 +1810,37 @@ public interface SelectJoinStep extends SelectWhereStep { @Support SelectOnStep leftAntiJoin(TableLike table); + /** + * A synthetic LEFT ANTI JOIN clause that translates to an + * equivalent NOT EXISTS predicate. + *

+ * The following two SQL snippets are semantically equivalent: + *


+     * -- Using LEFT ANTI JOIN
+     * FROM A
+     *     LEFT ANTI JOIN B
+     *         ON A.ID = B.ID
+     *
+     * -- Using WHERE NOT EXISTS
+     * FROM A
+     * WHERE NOT EXISTS (
+     *     SELECT 1 FROM B WHERE A.ID = B.ID
+     * )
+     * 
+ *

+ * Notice that according to + * Relational + * algebra's understanding of left semi join, the right hand side of the + * left semi join operator is not projected, i.e. it cannot be accessed from + * WHERE or SELECT or any other clause than + * ON. + * + * @see Table#leftAntiJoin(Path) + */ + @NotNull @CheckReturnValue + @Support + SelectOptionalOnStep leftAntiJoin(Path path); + // ------------------------------------------------------------------------- // XXX: APPLY clauses on tables // ------------------------------------------------------------------------- @@ -1911,6 +2032,15 @@ public interface SelectJoinStep extends SelectWhereStep { @Support({ MARIADB, MYSQL }) SelectOnStep straightJoin(TableLike table); + /** + * STRAIGHT_JOIN a path to this table. + * + * @see Table#straightJoin(Path) + */ + @NotNull @CheckReturnValue + @Support({ MARIADB, MYSQL }) + SelectOnStep straightJoin(Path table); + /** * STRAIGHT_JOIN a table to this table. *

diff --git a/jOOQ/src/main/java/org/jooq/Table.java b/jOOQ/src/main/java/org/jooq/Table.java index 884e270a97..4f27f1cab9 100644 --- a/jOOQ/src/main/java/org/jooq/Table.java +++ b/jOOQ/src/main/java/org/jooq/Table.java @@ -1031,6 +1031,15 @@ extends @Support TableOnStep join(TableLike table); + /** + * INNER JOIN a path to this table. + *

+ * A synonym for {@link #innerJoin(Path)}. + */ + @NotNull + @Support + TableOptionalOnStep join(Path path); + /** * INNER JOIN a table to this table. *

@@ -1129,6 +1138,13 @@ extends @Support TableOnStep innerJoin(TableLike table); + /** + * INNER JOIN a path to this table. + */ + @NotNull + @Support + TableOptionalOnStep innerJoin(Path path); + /** * INNER JOIN a table to this table. *

@@ -1235,6 +1251,17 @@ extends @Support TablePartitionByStep leftJoin(TableLike table); + /** + * LEFT OUTER JOIN a path to this table. + *

+ * A synonym for {@link #leftOuterJoin(Path)}. + * + * @see #leftOuterJoin(Path) + */ + @NotNull + @Support + TableOptionalOnStep leftJoin(Path path); + /** * LEFT OUTER JOIN a table to this table. *

@@ -1332,6 +1359,13 @@ extends @Support TablePartitionByStep leftOuterJoin(TableLike table); + /** + * LEFT OUTER JOIN a path to this table. + */ + @NotNull + @Support + TableOptionalOnStep leftOuterJoin(Path path); + /** * LEFT OUTER JOIN a table to this table. *

@@ -1412,8 +1446,6 @@ extends * RIGHT OUTER JOIN a table to this table. *

* A synonym for {@link #rightOuterJoin(TableLike)}. - *

- * This is only possible where the underlying RDBMS supports it. * * @see #rightOuterJoin(TableLike) */ @@ -1421,13 +1453,22 @@ extends @Support TablePartitionByStep rightJoin(TableLike table); + /** + * RIGHT OUTER JOIN a path to this table. + *

+ * A synonym for {@link #rightOuterJoin(Path)}. + * + * @see #rightOuterJoin(Path) + */ + @NotNull + @Support + TableOptionalOnStep rightJoin(Path path); + /** * RIGHT OUTER JOIN a table to this table. *

* A synonym for {@link #rightOuterJoin(String)}. *

- * This is only possible where the underlying RDBMS supports it. - *

* 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 @@ -1447,8 +1488,6 @@ extends *

* A synonym for {@link #rightOuterJoin(String)}. *

- * This is only possible where the underlying RDBMS supports it. - *

* 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 @@ -1468,8 +1507,6 @@ extends *

* A synonym for {@link #rightOuterJoin(String, Object...)}. *

- * This is only possible where the underlying RDBMS supports it. - *

* 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 @@ -1490,8 +1527,6 @@ extends *

* A synonym for {@link #rightOuterJoin(String, QueryPart...)}. *

- * This is only possible where the underlying RDBMS supports it - *

* 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 @@ -1511,8 +1546,6 @@ extends * RIGHT OUTER JOIN a table to this table. *

* A synonym for {@link #rightOuterJoin(Name)}. - *

- * This is only possible where the underlying RDBMS supports it * * @see DSL#table(Name) * @see #rightOuterJoin(Name) @@ -1523,18 +1556,21 @@ extends /** * RIGHT OUTER JOIN a table to this table. - *

- * This is only possible where the underlying RDBMS supports it */ @NotNull @Support TablePartitionByStep rightOuterJoin(TableLike table); + /** + * RIGHT OUTER JOIN a path to this table. + */ + @NotNull + @Support + TableOptionalOnStep rightOuterJoin(Path path); + /** * RIGHT OUTER JOIN a table to this table. *

- * This is only possible where the underlying RDBMS supports it - *

* 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 @@ -1551,8 +1587,6 @@ extends /** * RIGHT OUTER JOIN a table to this table. *

- * This is only possible where the underlying RDBMS supports it - *

* 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 @@ -1569,8 +1603,6 @@ extends /** * RIGHT OUTER JOIN a table to this table. *

- * This is only possible where the underlying RDBMS supports it - *

* 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 @@ -1588,8 +1620,6 @@ extends /** * RIGHT OUTER JOIN a table to this table. *

- * This is only possible where the underlying RDBMS supports it - *

* 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 @@ -1606,8 +1636,6 @@ extends /** * RIGHT OUTER JOIN a table to this table. - *

- * This is only possible where the underlying RDBMS supports it * * @see DSL#table(Name) */ @@ -1624,6 +1652,15 @@ extends @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) TablePartitionByStep fullJoin(TableLike table); + /** + * FULL OUTER JOIN a path to this table. + *

+ * A synonym for {@link #fullOuterJoin(Path)}. + */ + @NotNull + @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) + TableOptionalOnStep fullJoin(Path path); + /** * FULL OUTER JOIN a table to this table. *

@@ -1695,18 +1732,21 @@ extends /** * FULL OUTER JOIN a table to this table. - *

- * This is only possible where the underlying RDBMS supports it */ @NotNull @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) TablePartitionByStep fullOuterJoin(TableLike table); + /** + * FULL OUTER JOIN a path to this table. + */ + @NotNull + @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) + TableOptionalOnStep fullOuterJoin(Path path); + /** * FULL OUTER JOIN a table to this table. *

- * This is only possible where the underlying RDBMS supports it - *

* 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 @@ -1723,8 +1763,6 @@ extends /** * FULL OUTER JOIN a table to this table. *

- * This is only possible where the underlying RDBMS supports it - *

* 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 @@ -1741,8 +1779,6 @@ extends /** * FULL OUTER JOIN a table to this table. *

- * This is only possible where the underlying RDBMS supports it - *

* 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 @@ -1760,8 +1796,6 @@ extends /** * FULL OUTER JOIN a table to this table. *

- * This is only possible where the underlying RDBMS supports it - *

* 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 @@ -1778,8 +1812,6 @@ extends /** * FULL OUTER JOIN a table to this table. - *

- * This is only possible where the underlying RDBMS supports it * * @see DSL#table(Name) */ @@ -2487,6 +2519,13 @@ extends @Support({ MARIADB, MYSQL }) TableOnStep straightJoin(TableLike table); + /** + * STRAIGHT_JOIN a path to this table. + */ + @NotNull + @Support({ MARIADB, MYSQL }) + TableOptionalOnStep straightJoin(Path path); + /** * STRAIGHT_JOIN a table to this table. *

@@ -3169,6 +3208,35 @@ extends @Support TableOnStep leftSemiJoin(TableLike table); + /** + * A synthetic LEFT SEMI JOIN clause that translates to an + * equivalent EXISTS predicate. + *

+ * The following two SQL snippets are semantically equivalent: + *


+     * -- Using LEFT SEMI JOIN
+     * FROM A
+     *     LEFT SEMI JOIN B
+     *         ON A.ID = B.ID
+     *
+     * -- Using WHERE EXISTS
+     * FROM A
+     * WHERE EXISTS (
+     *     SELECT 1 FROM B WHERE A.ID = B.ID
+     * )
+     * 
+ *

+ * Notice that according to + * Relational + * algebra's understanding of left semi join, the right hand side of the + * left semi join operator is not projected, i.e. it cannot be accessed from + * WHERE or SELECT or any other clause than + * ON. + */ + @NotNull + @Support + TableOptionalOnStep leftSemiJoin(Path path); + /** * A synthetic LEFT ANTI JOIN clause that translates to an * equivalent NOT EXISTS predicate. @@ -3198,6 +3266,35 @@ extends @Support TableOnStep leftAntiJoin(TableLike table); + /** + * A synthetic LEFT ANTI JOIN clause that translates to an + * equivalent NOT EXISTS predicate. + *

+ * The following two SQL snippets are semantically equivalent: + *


+     * -- Using LEFT ANTI JOIN
+     * FROM A
+     *     LEFT ANTI JOIN B
+     *         ON A.ID = B.ID
+     *
+     * -- Using WHERE NOT EXISTS
+     * FROM A
+     * WHERE NOT EXISTS (
+     *     SELECT 1 FROM B WHERE A.ID = B.ID
+     * )
+     * 
+ *

+ * Notice that according to + * Relational + * algebra's understanding of left anti join, the right hand side of the + * left anti join operator is not projected, i.e. it cannot be accessed from + * WHERE or SELECT or any other clause than + * ON. + */ + @NotNull + @Support + TableOptionalOnStep leftAntiJoin(Path path); + diff --git a/jOOQ/src/main/java/org/jooq/TableLike.java b/jOOQ/src/main/java/org/jooq/TableLike.java index e460bf15db..7dd17c7d1e 100644 --- a/jOOQ/src/main/java/org/jooq/TableLike.java +++ b/jOOQ/src/main/java/org/jooq/TableLike.java @@ -73,7 +73,8 @@ extends QueryPart permits Select, - Table + Table, + Path { /** diff --git a/jOOQ/src/main/java/org/jooq/impl/AbstractQuery.java b/jOOQ/src/main/java/org/jooq/impl/AbstractQuery.java index d6d5565509..8387f0fcc2 100644 --- a/jOOQ/src/main/java/org/jooq/impl/AbstractQuery.java +++ b/jOOQ/src/main/java/org/jooq/impl/AbstractQuery.java @@ -444,36 +444,23 @@ abstract class AbstractQuery extends AbstractAttachableQueryPa try { listener.executeStart(ctx); - switch (ctx.family()) { - // [#12052] DuckDB doesn't correctly implement the JDBC API protocol: - // https://github.com/duckdb/duckdb/issues/7188 - case DUCKDB: { - result = executeImmediate(ctx.statement()).executeUpdate(); - ctx.rows(result); - break; - } - - default: { - // [#1829] Statement.execute() is preferred over Statement.executeUpdate(), as - // we might be executing plain SQL and returning results. - if (!stmt.execute()) { - result = stmt.getUpdateCount(); - ctx.rows(result); - } - - - - - - - - - - - break; - } + // [#1829] Statement.execute() is preferred over Statement.executeUpdate(), as + // we might be executing plain SQL and returning results. + if (!stmt.execute()) { + result = stmt.getUpdateCount(); + ctx.rows(result); } + + + + + + + + + + listener.executeEnd(ctx); return result; } diff --git a/jOOQ/src/main/java/org/jooq/impl/AbstractTable.java b/jOOQ/src/main/java/org/jooq/impl/AbstractTable.java index e0098c8f3c..a65814abae 100644 --- a/jOOQ/src/main/java/org/jooq/impl/AbstractTable.java +++ b/jOOQ/src/main/java/org/jooq/impl/AbstractTable.java @@ -95,6 +95,7 @@ import org.jooq.JoinType; // ... import org.jooq.Name; import org.jooq.Package; +import org.jooq.Path; // ... // ... // ... @@ -1265,16 +1266,28 @@ implements return new DivideBy(this, divisor); } - @SuppressWarnings({ "unchecked", "rawtypes" }) + @SuppressWarnings("unchecked") @Override public final TableOnStep leftSemiJoin(TableLike table) { - return (TableOnStep) join(table, LEFT_SEMI_JOIN); + return (TableOnStep) join(table, LEFT_SEMI_JOIN); } - @SuppressWarnings({ "unchecked", "rawtypes" }) + @SuppressWarnings("unchecked") + @Override + public final TableOptionalOnStep leftSemiJoin(Path path) { + return (TableOptionalOnStep) join(path, LEFT_SEMI_JOIN); + } + + @SuppressWarnings("unchecked") @Override public final TableOnStep leftAntiJoin(TableLike table) { - return (TableOnStep) join(table, LEFT_ANTI_JOIN); + return (TableOnStep) join(table, LEFT_ANTI_JOIN); + } + + @SuppressWarnings("unchecked") + @Override + public final TableOptionalOnStep leftAntiJoin(Path path) { + return (TableOptionalOnStep) join(path, LEFT_ANTI_JOIN); } // ------------------------------------------------------------------------ @@ -1378,6 +1391,11 @@ implements return innerJoin(table); } + @Override + public final TableOptionalOnStep join(Path path) { + return innerJoin(path); + } + @Override public final TableOnStep join(SQL sql) { return innerJoin(sql); @@ -1408,6 +1426,11 @@ implements return join(table, JOIN); } + @Override + public final TableOptionalOnStep innerJoin(Path path) { + return join(path, JOIN); + } + @Override public final TableOnStep innerJoin(SQL sql) { return innerJoin(table(sql)); @@ -1452,6 +1475,11 @@ implements return leftOuterJoin(table); } + @Override + public final TableOptionalOnStep leftJoin(Path path) { + return leftOuterJoin(path); + } + @Override public final TablePartitionByStep leftJoin(SQL sql) { return leftOuterJoin(sql); @@ -1483,6 +1511,11 @@ implements return (TablePartitionByStep) join(table, LEFT_OUTER_JOIN); } + @Override + public final TableOptionalOnStep leftOuterJoin(Path path) { + return join(path, LEFT_OUTER_JOIN); + } + @Override public final TablePartitionByStep leftOuterJoin(SQL sql) { return leftOuterJoin(table(sql)); @@ -1513,6 +1546,11 @@ implements return rightOuterJoin(table); } + @Override + public final TableOptionalOnStep rightJoin(Path path) { + return rightOuterJoin(path); + } + @Override public final TablePartitionByStep rightJoin(SQL sql) { return rightOuterJoin(sql); @@ -1544,6 +1582,11 @@ implements return (TablePartitionByStep) join(table, RIGHT_OUTER_JOIN); } + @Override + public final TableOptionalOnStep rightOuterJoin(Path path) { + return join(path, RIGHT_OUTER_JOIN); + } + @Override public final TablePartitionByStep rightOuterJoin(SQL sql) { return rightOuterJoin(table(sql)); @@ -1569,11 +1612,17 @@ implements return rightOuterJoin(table(name)); } + @SuppressWarnings("unchecked") @Override public final TablePartitionByStep fullOuterJoin(TableLike table) { return (TablePartitionByStep) join(table, FULL_OUTER_JOIN); } + @Override + public final TableOptionalOnStep fullOuterJoin(Path path) { + return join(path, FULL_OUTER_JOIN); + } + @Override public final TablePartitionByStep fullOuterJoin(SQL sql) { return fullOuterJoin(table(sql)); @@ -1604,6 +1653,11 @@ implements return fullOuterJoin(table); } + @Override + public final TableOptionalOnStep fullJoin(Path path) { + return fullOuterJoin(path); + } + @Override public final TablePartitionByStep fullJoin(SQL sql) { return fullOuterJoin(sql); @@ -1844,6 +1898,11 @@ implements return join(table, STRAIGHT_JOIN); } + @Override + public final TableOptionalOnStep straightJoin(Path path) { + return join(path, STRAIGHT_JOIN); + } + @Override public final TableOptionalOnStep straightJoin(SQL sql) { return straightJoin(table(sql)); diff --git a/jOOQ/src/main/java/org/jooq/impl/SelectImpl.java b/jOOQ/src/main/java/org/jooq/impl/SelectImpl.java index a0f4e3d633..6a21c2c01c 100644 --- a/jOOQ/src/main/java/org/jooq/impl/SelectImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/SelectImpl.java @@ -68,6 +68,7 @@ import org.jooq.JoinType; import org.jooq.Name; import org.jooq.Operator; import org.jooq.OrderField; +import org.jooq.Path; // ... import org.jooq.QuantifiedSelect; import org.jooq.QueryPart; @@ -2241,41 +2242,81 @@ implements return innerJoin(table); } + @Override + public final SelectImpl join(Path path) { + return innerJoin(path); + } + @Override public final SelectImpl innerJoin(TableLike table) { return join(table, JoinType.JOIN); } + @Override + public final SelectImpl innerJoin(Path path) { + return join(path, JoinType.JOIN); + } + @Override public final SelectImpl leftJoin(TableLike table) { return leftOuterJoin(table); } + @Override + public final SelectImpl leftJoin(Path path) { + return leftOuterJoin(path); + } + @Override public final SelectImpl leftOuterJoin(TableLike table) { return join(table, JoinType.LEFT_OUTER_JOIN); } + @Override + public final SelectImpl leftOuterJoin(Path path) { + return join(path, JoinType.LEFT_OUTER_JOIN); + } + @Override public final SelectImpl rightJoin(TableLike table) { return rightOuterJoin(table); } + @Override + public final SelectImpl rightJoin(Path path) { + return rightOuterJoin(path); + } + @Override public final SelectImpl rightOuterJoin(TableLike table) { return join(table, JoinType.RIGHT_OUTER_JOIN); } @Override - public final SelectOnStep fullJoin(TableLike table) { + public final SelectImpl rightOuterJoin(Path path) { + return join(path, JoinType.RIGHT_OUTER_JOIN); + } + + @Override + public final SelectImpl fullJoin(TableLike table) { return fullOuterJoin(table); } + @Override + public final SelectImpl fullJoin(Path path) { + return fullOuterJoin(path); + } + @Override public final SelectImpl fullOuterJoin(TableLike table) { return join(table, JoinType.FULL_OUTER_JOIN); } + @Override + public final SelectImpl fullOuterJoin(Path path) { + return join(path, JoinType.FULL_OUTER_JOIN); + } + @Override public final SelectImpl join(TableLike table, JoinType type) { switch (type) { @@ -2336,11 +2377,21 @@ implements return join(table, JoinType.LEFT_SEMI_JOIN); } + @Override + public final SelectImpl leftSemiJoin(Path path) { + return join(path, JoinType.LEFT_SEMI_JOIN); + } + @Override public final SelectImpl leftAntiJoin(TableLike table) { return join(table, JoinType.LEFT_ANTI_JOIN); } + @Override + public final SelectImpl leftAntiJoin(Path path) { + return join(path, JoinType.LEFT_ANTI_JOIN); + } + @Override public final SelectImpl crossApply(TableLike table) { return join(table, JoinType.CROSS_APPLY); @@ -2356,6 +2407,11 @@ implements return join(table, JoinType.STRAIGHT_JOIN); } + @Override + public final SelectImpl straightJoin(Path path) { + return join(path, JoinType.STRAIGHT_JOIN); + } + @Override public final SelectImpl join(SQL sql) { return innerJoin(sql);