[jOOQ/jOOQ#15005] Add org.jooq.Path<R>, a type to model join paths
This includes: - New org.jooq.Path type - New JOIN method overloads - Code generation implementation and configuration
This commit is contained in:
parent
f1e58301e4
commit
656e211d42
@ -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();
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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<O extends %s> %sPath(%s<O> child, %s<O, %s> key) {", visibility(), Record.class, className, Table.class, ForeignKey.class, recordType);
|
||||
out.println("super(child, key);");
|
||||
out.println("}");
|
||||
}
|
||||
|
||||
if (supportsPathsToMany) {
|
||||
out.println("%s<O extends %s> %sPath(%s<O> parent, %s<O, %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 <code>" + referencedTable.getQualifiedName() + "</code> table"
|
||||
|
||||
@ -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()));
|
||||
|
||||
@ -1987,6 +1987,10 @@ This is a prerequisite for various advanced features]]></jxb:javadoc></jxb:prope
|
||||
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Generate implicit join path constructors on generated tables for incoming foreign key relationships (to-many relationships)]]></jxb:javadoc></jxb:property></appinfo></annotation>
|
||||
</element>
|
||||
|
||||
<element name="implicitJoinPathTableSubtypes" type="boolean" default="true" minOccurs="0" maxOccurs="1">
|
||||
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Generate implicit join path table subtypes implementing {@link org.jooq.Path} for increased JOIN convenience.]]></jxb:javadoc></jxb:property></appinfo></annotation>
|
||||
</element>
|
||||
|
||||
<element name="implicitJoinPathUnusedConstructors" type="boolean" default="false" minOccurs="0" maxOccurs="1">
|
||||
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Generate implicit join path constructors also if there isn't any outgoing or incoming foreign key relationship.]]></jxb:javadoc></jxb:property></appinfo></annotation>
|
||||
</element>
|
||||
|
||||
51
jOOQ/src/main/java/org/jooq/Path.java
Normal file
51
jOOQ/src/main/java/org/jooq/Path.java
Normal file
@ -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.
|
||||
* <p>
|
||||
* 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<R extends Record> extends TableLike<R> {
|
||||
|
||||
}
|
||||
@ -166,6 +166,19 @@ public interface SelectJoinStep<R extends Record> extends SelectWhereStep<R> {
|
||||
@Support
|
||||
SelectOnStep<R> join(TableLike<?> table);
|
||||
|
||||
/**
|
||||
* Convenience method to <code>INNER JOIN</code> a path to the last table
|
||||
* added to the <code>FROM</code> clause using {@link Table#join(Path)}.
|
||||
* <p>
|
||||
* A synonym for {@link #innerJoin(Path)}.
|
||||
*
|
||||
* @see Table#join(Path)
|
||||
* @see #innerJoin(Path)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support
|
||||
SelectOptionalOnStep<R> join(Path<?> path);
|
||||
|
||||
/**
|
||||
* Convenience method to <code>INNER JOIN</code> a table to the last table
|
||||
* added to the <code>FROM</code> clause using {@link Table#join(String)}.
|
||||
@ -280,6 +293,16 @@ public interface SelectJoinStep<R extends Record> extends SelectWhereStep<R> {
|
||||
@Support
|
||||
SelectOnStep<R> innerJoin(TableLike<?> table);
|
||||
|
||||
/**
|
||||
* Convenience method to <code>INNER JOIN</code> a path to the last table
|
||||
* added to the <code>FROM</code> clause using {@link Table#join(Path)}.
|
||||
*
|
||||
* @see Table#innerJoin(Path)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support
|
||||
SelectOnStep<R> innerJoin(Path<?> path);
|
||||
|
||||
/**
|
||||
* Convenience method to <code>INNER JOIN</code> a table to the last table
|
||||
* added to the <code>FROM</code> clause using {@link Table#join(String)}.
|
||||
@ -525,6 +548,20 @@ public interface SelectJoinStep<R extends Record> extends SelectWhereStep<R> {
|
||||
@Support
|
||||
SelectJoinPartitionByStep<R> leftJoin(TableLike<?> table);
|
||||
|
||||
/**
|
||||
* Convenience method to <code>LEFT OUTER JOIN</code> a path to the last
|
||||
* table added to the <code>FROM</code> clause using
|
||||
* {@link Table#leftOuterJoin(Path)}.
|
||||
* <p>
|
||||
* A synonym for {@link #leftOuterJoin(Path)}.
|
||||
*
|
||||
* @see Table#leftOuterJoin(Path)
|
||||
* @see #leftOuterJoin(Path)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support
|
||||
SelectOptionalOnStep<R> leftJoin(Path<?> table);
|
||||
|
||||
/**
|
||||
* Convenience method to <code>LEFT OUTER JOIN</code> a table to the last
|
||||
* table added to the <code>FROM</code> clause using
|
||||
@ -641,6 +678,17 @@ public interface SelectJoinStep<R extends Record> extends SelectWhereStep<R> {
|
||||
@Support
|
||||
SelectJoinPartitionByStep<R> leftOuterJoin(TableLike<?> table);
|
||||
|
||||
/**
|
||||
* Convenience method to <code>LEFT OUTER JOIN</code> a path to the last
|
||||
* table added to the <code>FROM</code> clause using
|
||||
* {@link Table#leftOuterJoin(Path)}
|
||||
*
|
||||
* @see Table#leftOuterJoin(Path)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support
|
||||
SelectOptionalOnStep<R> leftOuterJoin(Path<?> path);
|
||||
|
||||
/**
|
||||
* Convenience method to <code>LEFT OUTER JOIN</code> a table to the last
|
||||
* table added to the <code>FROM</code> clause using
|
||||
@ -737,8 +785,6 @@ public interface SelectJoinStep<R extends Record> extends SelectWhereStep<R> {
|
||||
* {@link Table#rightOuterJoin(TableLike)}.
|
||||
* <p>
|
||||
* A synonym for {@link #rightOuterJoin(TableLike)}.
|
||||
* <p>
|
||||
* This is only possible where the underlying RDBMS supports it
|
||||
*
|
||||
* @see Table#rightOuterJoin(TableLike)
|
||||
* @see #rightOuterJoin(TableLike)
|
||||
@ -747,6 +793,20 @@ public interface SelectJoinStep<R extends Record> extends SelectWhereStep<R> {
|
||||
@Support
|
||||
SelectJoinPartitionByStep<R> rightJoin(TableLike<?> table);
|
||||
|
||||
/**
|
||||
* Convenience method to <code>RIGHT OUTER JOIN</code> a path to the last
|
||||
* table added to the <code>FROM</code> clause using
|
||||
* {@link Table#rightOuterJoin(Path)}.
|
||||
* <p>
|
||||
* A synonym for {@link #rightOuterJoin(Path)}.
|
||||
*
|
||||
* @see Table#rightOuterJoin(Path)
|
||||
* @see #rightOuterJoin(Path)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support
|
||||
SelectOptionalOnStep<R> rightJoin(Path<?> path);
|
||||
|
||||
/**
|
||||
* Convenience method to <code>RIGHT OUTER JOIN</code> a table to the last
|
||||
* table added to the <code>FROM</code> clause using
|
||||
@ -754,8 +814,6 @@ public interface SelectJoinStep<R extends Record> extends SelectWhereStep<R> {
|
||||
* <p>
|
||||
* A synonym for {@link #rightOuterJoin(String)}.
|
||||
* <p>
|
||||
* This is only possible where the underlying RDBMS supports it
|
||||
* <p>
|
||||
* <b>NOTE</b>: 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<R extends Record> extends SelectWhereStep<R> {
|
||||
* <p>
|
||||
* A synonym for {@link #rightOuterJoin(String)}.
|
||||
* <p>
|
||||
* This is only possible where the underlying RDBMS supports it
|
||||
* <p>
|
||||
* <b>NOTE</b>: 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<R extends Record> extends SelectWhereStep<R> {
|
||||
* <p>
|
||||
* A synonym for {@link #rightOuterJoin(String, Object...)}.
|
||||
* <p>
|
||||
* This is only possible where the underlying RDBMS supports it
|
||||
* <p>
|
||||
* <b>NOTE</b>: 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<R extends Record> extends SelectWhereStep<R> {
|
||||
* <p>
|
||||
* A synonym for {@link #rightOuterJoin(String, QueryPart...)}.
|
||||
* <p>
|
||||
* This is only possible where the underlying RDBMS supports it
|
||||
* <p>
|
||||
* <b>NOTE</b>: 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<R extends Record> extends SelectWhereStep<R> {
|
||||
* {@link Table#rightOuterJoin(Name)}.
|
||||
* <p>
|
||||
* A synonym for {@link #rightOuterJoin(Name)}.
|
||||
* <p>
|
||||
* 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<R extends Record> extends SelectWhereStep<R> {
|
||||
* Convenience method to <code>RIGHT OUTER JOIN</code> a table to the last
|
||||
* table added to the <code>FROM</code> clause using
|
||||
* {@link Table#rightOuterJoin(TableLike)}
|
||||
* <p>
|
||||
* This is only possible where the underlying RDBMS supports it
|
||||
*
|
||||
* @see Table#rightOuterJoin(TableLike)
|
||||
*/
|
||||
@ -875,13 +923,22 @@ public interface SelectJoinStep<R extends Record> extends SelectWhereStep<R> {
|
||||
@Support
|
||||
SelectJoinPartitionByStep<R> rightOuterJoin(TableLike<?> table);
|
||||
|
||||
/**
|
||||
* Convenience method to <code>RIGHT OUTER JOIN</code> a path to the last
|
||||
* table added to the <code>FROM</code> clause using
|
||||
* {@link Table#rightOuterJoin(Path)}
|
||||
*
|
||||
* @see Table#rightOuterJoin(Path)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support
|
||||
SelectOptionalOnStep<R> rightOuterJoin(Path<?> path);
|
||||
|
||||
/**
|
||||
* Convenience method to <code>RIGHT OUTER JOIN</code> a table to the last
|
||||
* table added to the <code>FROM</code> clause using
|
||||
* {@link Table#rightOuterJoin(String)}
|
||||
* <p>
|
||||
* This is only possible where the underlying RDBMS supports it
|
||||
* <p>
|
||||
* <b>NOTE</b>: 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<R extends Record> extends SelectWhereStep<R> {
|
||||
* table added to the <code>FROM</code> clause using
|
||||
* {@link Table#rightOuterJoin(String)}
|
||||
* <p>
|
||||
* This is only possible where the underlying RDBMS supports it
|
||||
* <p>
|
||||
* <b>NOTE</b>: 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<R extends Record> extends SelectWhereStep<R> {
|
||||
* table added to the <code>FROM</code> clause using
|
||||
* {@link Table#rightOuterJoin(String, Object...)}
|
||||
* <p>
|
||||
* This is only possible where the underlying RDBMS supports it
|
||||
* <p>
|
||||
* <b>NOTE</b>: 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<R extends Record> extends SelectWhereStep<R> {
|
||||
* table added to the <code>FROM</code> clause using
|
||||
* {@link Table#rightOuterJoin(String, QueryPart...)}
|
||||
* <p>
|
||||
* This is only possible where the underlying RDBMS supports it
|
||||
* <p>
|
||||
* <b>NOTE</b>: 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<R extends Record> extends SelectWhereStep<R> {
|
||||
* Convenience method to <code>RIGHT OUTER JOIN</code> a table to the last
|
||||
* table added to the <code>FROM</code> clause using
|
||||
* {@link Table#rightOuterJoin(Name)}
|
||||
* <p>
|
||||
* 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<R extends Record> extends SelectWhereStep<R> {
|
||||
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
|
||||
SelectOnStep<R> fullJoin(TableLike<?> table);
|
||||
|
||||
/**
|
||||
* Convenience method to <code>FULL OUTER JOIN</code> a path to the last
|
||||
* table added to the <code>FROM</code> clause using
|
||||
* {@link Table#fullOuterJoin(Path)}.
|
||||
* <p>
|
||||
* A synonym for {@link #fullOuterJoin(Path)}.
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
|
||||
SelectOptionalOnStep<R> fullJoin(Path<?> table);
|
||||
|
||||
/**
|
||||
* Convenience method to <code>FULL OUTER JOIN</code> a table to the last
|
||||
* table added to the <code>FROM</code> clause using
|
||||
@ -1069,8 +1129,6 @@ public interface SelectJoinStep<R extends Record> extends SelectWhereStep<R> {
|
||||
* Convenience method to <code>FULL OUTER JOIN</code> a table to the last
|
||||
* table added to the <code>FROM</code> clause using
|
||||
* {@link Table#fullOuterJoin(TableLike)}
|
||||
* <p>
|
||||
* This is only possible where the underlying RDBMS supports it
|
||||
*
|
||||
* @see Table#fullOuterJoin(TableLike)
|
||||
*/
|
||||
@ -1078,13 +1136,22 @@ public interface SelectJoinStep<R extends Record> extends SelectWhereStep<R> {
|
||||
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
|
||||
SelectOnStep<R> fullOuterJoin(TableLike<?> table);
|
||||
|
||||
/**
|
||||
* Convenience method to <code>FULL OUTER JOIN</code> a path to the last
|
||||
* table added to the <code>FROM</code> clause using
|
||||
* {@link Table#fullOuterJoin(Path)}
|
||||
*
|
||||
* @see Table#fullOuterJoin(Path)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
|
||||
SelectOptionalOnStep<R> fullOuterJoin(Path<?> table);
|
||||
|
||||
/**
|
||||
* Convenience method to <code>FULL OUTER JOIN</code> a table to the last
|
||||
* table added to the <code>FROM</code> clause using
|
||||
* {@link Table#fullOuterJoin(String)}
|
||||
* <p>
|
||||
* This is only possible where the underlying RDBMS supports it
|
||||
* <p>
|
||||
* <b>NOTE</b>: 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<R extends Record> extends SelectWhereStep<R> {
|
||||
* table added to the <code>FROM</code> clause using
|
||||
* {@link Table#fullOuterJoin(String)}
|
||||
* <p>
|
||||
* This is only possible where the underlying RDBMS supports it
|
||||
* <p>
|
||||
* <b>NOTE</b>: 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<R extends Record> extends SelectWhereStep<R> {
|
||||
* table added to the <code>FROM</code> clause using
|
||||
* {@link Table#fullOuterJoin(String, Object...)}
|
||||
* <p>
|
||||
* This is only possible where the underlying RDBMS supports it
|
||||
* <p>
|
||||
* <b>NOTE</b>: 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<R extends Record> extends SelectWhereStep<R> {
|
||||
* table added to the <code>FROM</code> clause using
|
||||
* {@link Table#fullOuterJoin(String, QueryPart...)}
|
||||
* <p>
|
||||
* This is only possible where the underlying RDBMS supports it
|
||||
* <p>
|
||||
* <b>NOTE</b>: 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<R extends Record> extends SelectWhereStep<R> {
|
||||
* Convenience method to <code>FULL OUTER JOIN</code> a tableto the last
|
||||
* table added to the <code>FROM</code> clause using
|
||||
* {@link Table#fullOuterJoin(Name)}
|
||||
* <p>
|
||||
* 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<R extends Record> extends SelectWhereStep<R> {
|
||||
@Support
|
||||
SelectOnStep<R> leftSemiJoin(TableLike<?> table);
|
||||
|
||||
/**
|
||||
* A synthetic <code>LEFT SEMI JOIN</code> clause that translates to an
|
||||
* equivalent <code>EXISTS</code> predicate.
|
||||
* <p>
|
||||
* The following two SQL snippets are semantically equivalent:
|
||||
* <pre><code>
|
||||
* -- 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
|
||||
* )
|
||||
* </code></pre>
|
||||
* <p>
|
||||
* Notice that according to
|
||||
* <a href="https://en.wikipedia.org/wiki/Relational_algebra">Relational
|
||||
* algebra's</a> 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
|
||||
* <code>WHERE</code> or <code>SELECT</code> or any other clause than
|
||||
* <code>ON</code>.
|
||||
*
|
||||
* @see Table#leftSemiJoin(Path)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support
|
||||
SelectOptionalOnStep<R> leftSemiJoin(Path<?> path);
|
||||
|
||||
/**
|
||||
* A synthetic <code>LEFT ANTI JOIN</code> clause that translates to an
|
||||
* equivalent <code>NOT EXISTS</code> predicate.
|
||||
@ -1720,6 +1810,37 @@ public interface SelectJoinStep<R extends Record> extends SelectWhereStep<R> {
|
||||
@Support
|
||||
SelectOnStep<R> leftAntiJoin(TableLike<?> table);
|
||||
|
||||
/**
|
||||
* A synthetic <code>LEFT ANTI JOIN</code> clause that translates to an
|
||||
* equivalent <code>NOT EXISTS</code> predicate.
|
||||
* <p>
|
||||
* The following two SQL snippets are semantically equivalent:
|
||||
* <pre><code>
|
||||
* -- 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
|
||||
* )
|
||||
* </code></pre>
|
||||
* <p>
|
||||
* Notice that according to
|
||||
* <a href="https://en.wikipedia.org/wiki/Relational_algebra">Relational
|
||||
* algebra's</a> 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
|
||||
* <code>WHERE</code> or <code>SELECT</code> or any other clause than
|
||||
* <code>ON</code>.
|
||||
*
|
||||
* @see Table#leftAntiJoin(Path)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support
|
||||
SelectOptionalOnStep<R> leftAntiJoin(Path<?> path);
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: APPLY clauses on tables
|
||||
// -------------------------------------------------------------------------
|
||||
@ -1911,6 +2032,15 @@ public interface SelectJoinStep<R extends Record> extends SelectWhereStep<R> {
|
||||
@Support({ MARIADB, MYSQL })
|
||||
SelectOnStep<R> straightJoin(TableLike<?> table);
|
||||
|
||||
/**
|
||||
* <code>STRAIGHT_JOIN</code> a path to this table.
|
||||
*
|
||||
* @see Table#straightJoin(Path)
|
||||
*/
|
||||
@NotNull @CheckReturnValue
|
||||
@Support({ MARIADB, MYSQL })
|
||||
SelectOnStep<R> straightJoin(Path<?> table);
|
||||
|
||||
/**
|
||||
* <code>STRAIGHT_JOIN</code> a table to this table.
|
||||
* <p>
|
||||
|
||||
@ -1031,6 +1031,15 @@ extends
|
||||
@Support
|
||||
TableOnStep<Record> join(TableLike<?> table);
|
||||
|
||||
/**
|
||||
* <code>INNER JOIN</code> a path to this table.
|
||||
* <p>
|
||||
* A synonym for {@link #innerJoin(Path)}.
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
TableOptionalOnStep<Record> join(Path<?> path);
|
||||
|
||||
/**
|
||||
* <code>INNER JOIN</code> a table to this table.
|
||||
* <p>
|
||||
@ -1129,6 +1138,13 @@ extends
|
||||
@Support
|
||||
TableOnStep<Record> innerJoin(TableLike<?> table);
|
||||
|
||||
/**
|
||||
* <code>INNER JOIN</code> a path to this table.
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
TableOptionalOnStep<Record> innerJoin(Path<?> path);
|
||||
|
||||
/**
|
||||
* <code>INNER JOIN</code> a table to this table.
|
||||
* <p>
|
||||
@ -1235,6 +1251,17 @@ extends
|
||||
@Support
|
||||
TablePartitionByStep<Record> leftJoin(TableLike<?> table);
|
||||
|
||||
/**
|
||||
* <code>LEFT OUTER JOIN</code> a path to this table.
|
||||
* <p>
|
||||
* A synonym for {@link #leftOuterJoin(Path)}.
|
||||
*
|
||||
* @see #leftOuterJoin(Path)
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
TableOptionalOnStep<Record> leftJoin(Path<?> path);
|
||||
|
||||
/**
|
||||
* <code>LEFT OUTER JOIN</code> a table to this table.
|
||||
* <p>
|
||||
@ -1332,6 +1359,13 @@ extends
|
||||
@Support
|
||||
TablePartitionByStep<Record> leftOuterJoin(TableLike<?> table);
|
||||
|
||||
/**
|
||||
* <code>LEFT OUTER JOIN</code> a path to this table.
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
TableOptionalOnStep<Record> leftOuterJoin(Path<?> path);
|
||||
|
||||
/**
|
||||
* <code>LEFT OUTER JOIN</code> a table to this table.
|
||||
* <p>
|
||||
@ -1412,8 +1446,6 @@ extends
|
||||
* <code>RIGHT OUTER JOIN</code> a table to this table.
|
||||
* <p>
|
||||
* A synonym for {@link #rightOuterJoin(TableLike)}.
|
||||
* <p>
|
||||
* This is only possible where the underlying RDBMS supports it.
|
||||
*
|
||||
* @see #rightOuterJoin(TableLike)
|
||||
*/
|
||||
@ -1421,13 +1453,22 @@ extends
|
||||
@Support
|
||||
TablePartitionByStep<Record> rightJoin(TableLike<?> table);
|
||||
|
||||
/**
|
||||
* <code>RIGHT OUTER JOIN</code> a path to this table.
|
||||
* <p>
|
||||
* A synonym for {@link #rightOuterJoin(Path)}.
|
||||
*
|
||||
* @see #rightOuterJoin(Path)
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
TableOptionalOnStep<Record> rightJoin(Path<?> path);
|
||||
|
||||
/**
|
||||
* <code>RIGHT OUTER JOIN</code> a table to this table.
|
||||
* <p>
|
||||
* A synonym for {@link #rightOuterJoin(String)}.
|
||||
* <p>
|
||||
* This is only possible where the underlying RDBMS supports it.
|
||||
* <p>
|
||||
* <b>NOTE</b>: 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
|
||||
* <p>
|
||||
* A synonym for {@link #rightOuterJoin(String)}.
|
||||
* <p>
|
||||
* This is only possible where the underlying RDBMS supports it.
|
||||
* <p>
|
||||
* <b>NOTE</b>: 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
|
||||
* <p>
|
||||
* A synonym for {@link #rightOuterJoin(String, Object...)}.
|
||||
* <p>
|
||||
* This is only possible where the underlying RDBMS supports it.
|
||||
* <p>
|
||||
* <b>NOTE</b>: 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
|
||||
* <p>
|
||||
* A synonym for {@link #rightOuterJoin(String, QueryPart...)}.
|
||||
* <p>
|
||||
* This is only possible where the underlying RDBMS supports it
|
||||
* <p>
|
||||
* <b>NOTE</b>: 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
|
||||
* <code>RIGHT OUTER JOIN</code> a table to this table.
|
||||
* <p>
|
||||
* A synonym for {@link #rightOuterJoin(Name)}.
|
||||
* <p>
|
||||
* This is only possible where the underlying RDBMS supports it
|
||||
*
|
||||
* @see DSL#table(Name)
|
||||
* @see #rightOuterJoin(Name)
|
||||
@ -1523,18 +1556,21 @@ extends
|
||||
|
||||
/**
|
||||
* <code>RIGHT OUTER JOIN</code> a table to this table.
|
||||
* <p>
|
||||
* This is only possible where the underlying RDBMS supports it
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
TablePartitionByStep<Record> rightOuterJoin(TableLike<?> table);
|
||||
|
||||
/**
|
||||
* <code>RIGHT OUTER JOIN</code> a path to this table.
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
TableOptionalOnStep<Record> rightOuterJoin(Path<?> path);
|
||||
|
||||
/**
|
||||
* <code>RIGHT OUTER JOIN</code> a table to this table.
|
||||
* <p>
|
||||
* This is only possible where the underlying RDBMS supports it
|
||||
* <p>
|
||||
* <b>NOTE</b>: 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
|
||||
/**
|
||||
* <code>RIGHT OUTER JOIN</code> a table to this table.
|
||||
* <p>
|
||||
* This is only possible where the underlying RDBMS supports it
|
||||
* <p>
|
||||
* <b>NOTE</b>: 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
|
||||
/**
|
||||
* <code>RIGHT OUTER JOIN</code> a table to this table.
|
||||
* <p>
|
||||
* This is only possible where the underlying RDBMS supports it
|
||||
* <p>
|
||||
* <b>NOTE</b>: 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
|
||||
/**
|
||||
* <code>RIGHT OUTER JOIN</code> a table to this table.
|
||||
* <p>
|
||||
* This is only possible where the underlying RDBMS supports it
|
||||
* <p>
|
||||
* <b>NOTE</b>: 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
|
||||
|
||||
/**
|
||||
* <code>RIGHT OUTER JOIN</code> a table to this table.
|
||||
* <p>
|
||||
* 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<Record> fullJoin(TableLike<?> table);
|
||||
|
||||
/**
|
||||
* <code>FULL OUTER JOIN</code> a path to this table.
|
||||
* <p>
|
||||
* A synonym for {@link #fullOuterJoin(Path)}.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
|
||||
TableOptionalOnStep<Record> fullJoin(Path<?> path);
|
||||
|
||||
/**
|
||||
* <code>FULL OUTER JOIN</code> a table to this table.
|
||||
* <p>
|
||||
@ -1695,18 +1732,21 @@ extends
|
||||
|
||||
/**
|
||||
* <code>FULL OUTER JOIN</code> a table to this table.
|
||||
* <p>
|
||||
* This is only possible where the underlying RDBMS supports it
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
|
||||
TablePartitionByStep<Record> fullOuterJoin(TableLike<?> table);
|
||||
|
||||
/**
|
||||
* <code>FULL OUTER JOIN</code> a path to this table.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
|
||||
TableOptionalOnStep<Record> fullOuterJoin(Path<?> path);
|
||||
|
||||
/**
|
||||
* <code>FULL OUTER JOIN</code> a table to this table.
|
||||
* <p>
|
||||
* This is only possible where the underlying RDBMS supports it
|
||||
* <p>
|
||||
* <b>NOTE</b>: 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
|
||||
/**
|
||||
* <code>FULL OUTER JOIN</code> a table to this table.
|
||||
* <p>
|
||||
* This is only possible where the underlying RDBMS supports it
|
||||
* <p>
|
||||
* <b>NOTE</b>: 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
|
||||
/**
|
||||
* <code>FULL OUTER JOIN</code> a table to this table.
|
||||
* <p>
|
||||
* This is only possible where the underlying RDBMS supports it
|
||||
* <p>
|
||||
* <b>NOTE</b>: 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
|
||||
/**
|
||||
* <code>FULL OUTER JOIN</code> a table to this table.
|
||||
* <p>
|
||||
* This is only possible where the underlying RDBMS supports it
|
||||
* <p>
|
||||
* <b>NOTE</b>: 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
|
||||
|
||||
/**
|
||||
* <code>FULL OUTER JOIN</code> a table to this table.
|
||||
* <p>
|
||||
* This is only possible where the underlying RDBMS supports it
|
||||
*
|
||||
* @see DSL#table(Name)
|
||||
*/
|
||||
@ -2487,6 +2519,13 @@ extends
|
||||
@Support({ MARIADB, MYSQL })
|
||||
TableOnStep<Record> straightJoin(TableLike<?> table);
|
||||
|
||||
/**
|
||||
* <code>STRAIGHT_JOIN</code> a path to this table.
|
||||
*/
|
||||
@NotNull
|
||||
@Support({ MARIADB, MYSQL })
|
||||
TableOptionalOnStep<Record> straightJoin(Path<?> path);
|
||||
|
||||
/**
|
||||
* <code>STRAIGHT_JOIN</code> a table to this table.
|
||||
* <p>
|
||||
@ -3169,6 +3208,35 @@ extends
|
||||
@Support
|
||||
TableOnStep<R> leftSemiJoin(TableLike<?> table);
|
||||
|
||||
/**
|
||||
* A synthetic <code>LEFT SEMI JOIN</code> clause that translates to an
|
||||
* equivalent <code>EXISTS</code> predicate.
|
||||
* <p>
|
||||
* The following two SQL snippets are semantically equivalent:
|
||||
* <pre><code>
|
||||
* -- 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
|
||||
* )
|
||||
* </code></pre>
|
||||
* <p>
|
||||
* Notice that according to
|
||||
* <a href="https://en.wikipedia.org/wiki/Relational_algebra">Relational
|
||||
* algebra's</a> 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
|
||||
* <code>WHERE</code> or <code>SELECT</code> or any other clause than
|
||||
* <code>ON</code>.
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
TableOptionalOnStep<R> leftSemiJoin(Path<?> path);
|
||||
|
||||
/**
|
||||
* A synthetic <code>LEFT ANTI JOIN</code> clause that translates to an
|
||||
* equivalent <code>NOT EXISTS</code> predicate.
|
||||
@ -3198,6 +3266,35 @@ extends
|
||||
@Support
|
||||
TableOnStep<R> leftAntiJoin(TableLike<?> table);
|
||||
|
||||
/**
|
||||
* A synthetic <code>LEFT ANTI JOIN</code> clause that translates to an
|
||||
* equivalent <code>NOT EXISTS</code> predicate.
|
||||
* <p>
|
||||
* The following two SQL snippets are semantically equivalent:
|
||||
* <pre><code>
|
||||
* -- 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
|
||||
* )
|
||||
* </code></pre>
|
||||
* <p>
|
||||
* Notice that according to
|
||||
* <a href="https://en.wikipedia.org/wiki/Relational_algebra">Relational
|
||||
* algebra's</a> 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
|
||||
* <code>WHERE</code> or <code>SELECT</code> or any other clause than
|
||||
* <code>ON</code>.
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
TableOptionalOnStep<R> leftAntiJoin(Path<?> path);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -73,7 +73,8 @@ extends
|
||||
QueryPart
|
||||
permits
|
||||
Select,
|
||||
Table
|
||||
Table,
|
||||
Path
|
||||
{
|
||||
|
||||
/**
|
||||
|
||||
@ -444,36 +444,23 @@ abstract class AbstractQuery<R extends Record> 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;
|
||||
}
|
||||
|
||||
@ -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<R> leftSemiJoin(TableLike<?> table) {
|
||||
return (TableOnStep) join(table, LEFT_SEMI_JOIN);
|
||||
return (TableOnStep<R>) join(table, LEFT_SEMI_JOIN);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public final TableOptionalOnStep<R> leftSemiJoin(Path<?> path) {
|
||||
return (TableOptionalOnStep<R>) join(path, LEFT_SEMI_JOIN);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public final TableOnStep<R> leftAntiJoin(TableLike<?> table) {
|
||||
return (TableOnStep) join(table, LEFT_ANTI_JOIN);
|
||||
return (TableOnStep<R>) join(table, LEFT_ANTI_JOIN);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public final TableOptionalOnStep<R> leftAntiJoin(Path<?> path) {
|
||||
return (TableOptionalOnStep<R>) join(path, LEFT_ANTI_JOIN);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
@ -1378,6 +1391,11 @@ implements
|
||||
return innerJoin(table);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final TableOptionalOnStep<Record> join(Path<?> path) {
|
||||
return innerJoin(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final TableOnStep<Record> join(SQL sql) {
|
||||
return innerJoin(sql);
|
||||
@ -1408,6 +1426,11 @@ implements
|
||||
return join(table, JOIN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final TableOptionalOnStep<Record> innerJoin(Path<?> path) {
|
||||
return join(path, JOIN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final TableOnStep<Record> innerJoin(SQL sql) {
|
||||
return innerJoin(table(sql));
|
||||
@ -1452,6 +1475,11 @@ implements
|
||||
return leftOuterJoin(table);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final TableOptionalOnStep<Record> leftJoin(Path<?> path) {
|
||||
return leftOuterJoin(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final TablePartitionByStep<Record> leftJoin(SQL sql) {
|
||||
return leftOuterJoin(sql);
|
||||
@ -1483,6 +1511,11 @@ implements
|
||||
return (TablePartitionByStep<Record>) join(table, LEFT_OUTER_JOIN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final TableOptionalOnStep<Record> leftOuterJoin(Path<?> path) {
|
||||
return join(path, LEFT_OUTER_JOIN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final TablePartitionByStep<Record> leftOuterJoin(SQL sql) {
|
||||
return leftOuterJoin(table(sql));
|
||||
@ -1513,6 +1546,11 @@ implements
|
||||
return rightOuterJoin(table);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final TableOptionalOnStep<Record> rightJoin(Path<?> path) {
|
||||
return rightOuterJoin(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final TablePartitionByStep<Record> rightJoin(SQL sql) {
|
||||
return rightOuterJoin(sql);
|
||||
@ -1544,6 +1582,11 @@ implements
|
||||
return (TablePartitionByStep<Record>) join(table, RIGHT_OUTER_JOIN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final TableOptionalOnStep<Record> rightOuterJoin(Path<?> path) {
|
||||
return join(path, RIGHT_OUTER_JOIN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final TablePartitionByStep<Record> rightOuterJoin(SQL sql) {
|
||||
return rightOuterJoin(table(sql));
|
||||
@ -1569,11 +1612,17 @@ implements
|
||||
return rightOuterJoin(table(name));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public final TablePartitionByStep<Record> fullOuterJoin(TableLike<?> table) {
|
||||
return (TablePartitionByStep<Record>) join(table, FULL_OUTER_JOIN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final TableOptionalOnStep<Record> fullOuterJoin(Path<?> path) {
|
||||
return join(path, FULL_OUTER_JOIN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final TablePartitionByStep<Record> fullOuterJoin(SQL sql) {
|
||||
return fullOuterJoin(table(sql));
|
||||
@ -1604,6 +1653,11 @@ implements
|
||||
return fullOuterJoin(table);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final TableOptionalOnStep<Record> fullJoin(Path<?> path) {
|
||||
return fullOuterJoin(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final TablePartitionByStep<Record> fullJoin(SQL sql) {
|
||||
return fullOuterJoin(sql);
|
||||
@ -1844,6 +1898,11 @@ implements
|
||||
return join(table, STRAIGHT_JOIN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final TableOptionalOnStep<Record> straightJoin(Path<?> path) {
|
||||
return join(path, STRAIGHT_JOIN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final TableOptionalOnStep<Record> straightJoin(SQL sql) {
|
||||
return straightJoin(table(sql));
|
||||
|
||||
@ -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<R> 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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user