[jOOQ/jOOQ#13640] Add mutators for ()
This commit is contained in:
parent
fe0be5c94d
commit
366561ddeb
@ -202,6 +202,14 @@ extends
|
||||
@Experimental
|
||||
@Nullable With $with();
|
||||
|
||||
/**
|
||||
* Experimental query object model accessor method, see also {@link QOM}.
|
||||
* Subject to change in future jOOQ versions, use at your own risk.
|
||||
*/
|
||||
@Experimental
|
||||
@CheckReturnValue
|
||||
@Nullable Select<?> $with(With newWith);
|
||||
|
||||
/**
|
||||
* Experimental query object model accessor method, see also {@link QOM}.
|
||||
* Subject to change in future jOOQ versions, use at your own risk.
|
||||
@ -214,6 +222,7 @@ extends
|
||||
* Subject to change in future jOOQ versions, use at your own risk.
|
||||
*/
|
||||
@Experimental
|
||||
@CheckReturnValue
|
||||
@NotNull Select<?> $select(Collection<? extends SelectFieldOrAsterisk> newSelect);
|
||||
|
||||
/**
|
||||
@ -228,6 +237,7 @@ extends
|
||||
* Subject to change in future jOOQ versions, use at your own risk.
|
||||
*/
|
||||
@Experimental
|
||||
@CheckReturnValue
|
||||
@NotNull Select<R> $distinct(boolean newDistinct);
|
||||
|
||||
/**
|
||||
@ -242,6 +252,7 @@ extends
|
||||
* Subject to change in future jOOQ versions, use at your own risk.
|
||||
*/
|
||||
@Experimental
|
||||
@CheckReturnValue
|
||||
@NotNull Select<R> $distinctOn(Collection<? extends SelectFieldOrAsterisk> newDistinctOn);
|
||||
|
||||
/**
|
||||
@ -256,6 +267,7 @@ extends
|
||||
* Subject to change in future jOOQ versions, use at your own risk.
|
||||
*/
|
||||
@Experimental
|
||||
@CheckReturnValue
|
||||
@NotNull Select<R> $from(Collection<? extends Table<?>> newFrom);
|
||||
|
||||
/**
|
||||
@ -270,6 +282,7 @@ extends
|
||||
* Subject to change in future jOOQ versions, use at your own risk.
|
||||
*/
|
||||
@Experimental
|
||||
@CheckReturnValue
|
||||
@NotNull Select<R> $where(Condition newWhere);
|
||||
|
||||
/**
|
||||
@ -284,6 +297,7 @@ extends
|
||||
* Subject to change in future jOOQ versions, use at your own risk.
|
||||
*/
|
||||
@Experimental
|
||||
@CheckReturnValue
|
||||
@NotNull Select<R> $groupBy(Collection<? extends GroupField> newGroupBy);
|
||||
|
||||
/**
|
||||
@ -298,6 +312,7 @@ extends
|
||||
* Subject to change in future jOOQ versions, use at your own risk.
|
||||
*/
|
||||
@Experimental
|
||||
@CheckReturnValue
|
||||
@NotNull Select<R> $groupByDistinct(boolean newGroupByDistinct);
|
||||
|
||||
/**
|
||||
@ -312,6 +327,7 @@ extends
|
||||
* Subject to change in future jOOQ versions, use at your own risk.
|
||||
*/
|
||||
@Experimental
|
||||
@CheckReturnValue
|
||||
@NotNull Select<R> $having(Condition newHaving);
|
||||
|
||||
/**
|
||||
@ -326,6 +342,7 @@ extends
|
||||
* Subject to change in future jOOQ versions, use at your own risk.
|
||||
*/
|
||||
@Experimental
|
||||
@CheckReturnValue
|
||||
@NotNull Select<R> $window(Collection<? extends WindowDefinition> newWindow);
|
||||
|
||||
/**
|
||||
@ -340,6 +357,7 @@ extends
|
||||
* Subject to change in future jOOQ versions, use at your own risk.
|
||||
*/
|
||||
@Experimental
|
||||
@CheckReturnValue
|
||||
@NotNull Select<R> $qualify(Condition newQualify);
|
||||
|
||||
/**
|
||||
@ -354,6 +372,7 @@ extends
|
||||
* Subject to change in future jOOQ versions, use at your own risk.
|
||||
*/
|
||||
@Experimental
|
||||
@CheckReturnValue
|
||||
@NotNull Select<R> $orderBy(Collection<? extends SortField<?>> newOrderBy);
|
||||
|
||||
/**
|
||||
@ -368,6 +387,7 @@ extends
|
||||
* Subject to change in future jOOQ versions, use at your own risk.
|
||||
*/
|
||||
@Experimental
|
||||
@CheckReturnValue
|
||||
@NotNull Select<R> $limit(Field<? extends Number> newLimit);
|
||||
|
||||
/**
|
||||
@ -382,6 +402,7 @@ extends
|
||||
* Subject to change in future jOOQ versions, use at your own risk.
|
||||
*/
|
||||
@Experimental
|
||||
@CheckReturnValue
|
||||
@NotNull Select<R> $limitPercent(boolean newLimitPercent);
|
||||
|
||||
/**
|
||||
@ -396,6 +417,7 @@ extends
|
||||
* Subject to change in future jOOQ versions, use at your own risk.
|
||||
*/
|
||||
@Experimental
|
||||
@CheckReturnValue
|
||||
@NotNull Select<R> $limitWithTies(boolean newLimitWithTies);
|
||||
|
||||
/**
|
||||
@ -410,6 +432,7 @@ extends
|
||||
* Subject to change in future jOOQ versions, use at your own risk.
|
||||
*/
|
||||
@Experimental
|
||||
@CheckReturnValue
|
||||
@NotNull Select<R> $offset(Field<? extends Number> newOffset);
|
||||
|
||||
|
||||
@ -453,6 +476,9 @@ extends
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -432,14 +432,20 @@ public final class QOM {
|
||||
* A <code>WITH</code> clause of a {@link Select}, {@link Insert},
|
||||
* {@link Update}, or {@link Delete} statement.
|
||||
*/
|
||||
public /*sealed*/ interface With
|
||||
public sealed interface With
|
||||
extends
|
||||
org.jooq.QueryPart
|
||||
/*permits
|
||||
WithImpl*/
|
||||
permits
|
||||
WithImpl
|
||||
{
|
||||
@NotNull UnmodifiableList<? extends CommonTableExpression<?>> $commonTableExpressions();
|
||||
@CheckReturnValue
|
||||
@NotNull
|
||||
With $commonTableExpressions(UnmodifiableList<? extends CommonTableExpression<?>> commonTableExpressions);
|
||||
boolean $recursive();
|
||||
@CheckReturnValue
|
||||
@NotNull
|
||||
With $recursive(boolean recursive);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -134,6 +134,8 @@ import org.jooq.WindowDefinition;
|
||||
import org.jooq.impl.QOM.UnmodifiableList;
|
||||
import org.jooq.impl.QOM.With;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* A wrapper for a {@link SelectQuery}
|
||||
*
|
||||
@ -3403,6 +3405,11 @@ implements
|
||||
return getDelegate().$with();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Select<?> $with(With newWith) {
|
||||
return getDelegate().$with(newWith);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final UnmodifiableList<? extends SelectFieldOrAsterisk> $select() {
|
||||
return getDelegate().$select();
|
||||
|
||||
@ -306,6 +306,7 @@ import org.jooq.impl.ForLock.ForLockWaitMode;
|
||||
import org.jooq.impl.QOM.CompareCondition;
|
||||
import org.jooq.impl.QOM.Materialized;
|
||||
import org.jooq.impl.QOM.UnmodifiableList;
|
||||
import org.jooq.impl.QOM.With;
|
||||
import org.jooq.impl.Tools.BooleanDataKey;
|
||||
import org.jooq.impl.Tools.ExtendedDataKey;
|
||||
import org.jooq.impl.Tools.SimpleDataKey;
|
||||
@ -600,7 +601,11 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
|
||||
}
|
||||
|
||||
private final SelectQueryImpl<R> copy(Consumer<? super SelectQueryImpl<R>> finisher) {
|
||||
SelectQueryImpl<R> result = copyTo(CopyClause.END, false, new SelectQueryImpl<>(configuration(), with));
|
||||
return copy(finisher, with);
|
||||
}
|
||||
|
||||
private final SelectQueryImpl<R> copy(Consumer<? super SelectQueryImpl<R>> finisher, WithImpl newWith) {
|
||||
SelectQueryImpl<R> result = copyTo(CopyClause.END, false, new SelectQueryImpl<>(configuration(), newWith));
|
||||
finisher.accept(result);
|
||||
return result;
|
||||
}
|
||||
@ -4674,6 +4679,11 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
|
||||
return with;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final SelectQueryImpl<?> $with(With newWith) {
|
||||
return copy(s -> {}, (WithImpl) newWith);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final UnmodifiableList<SelectFieldOrAsterisk> $select() {
|
||||
return QOM.unmodifiable(select);
|
||||
|
||||
@ -41,13 +41,6 @@ import static org.jooq.Clause.WITH;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.CUBRID;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.DERBY;
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
// ...
|
||||
@ -60,7 +53,6 @@ import static org.jooq.impl.Keywords.K_WITH;
|
||||
import static org.jooq.impl.Tools.EMPTY_NAME;
|
||||
import static org.jooq.impl.Tools.BooleanDataKey.DATA_LIST_ALREADY_INDENTED;
|
||||
import static org.jooq.impl.Tools.SimpleDataKey.DATA_TOP_LEVEL_CTE;
|
||||
import static org.jooq.impl.Transformations.NO_SUPPORT_CTE;
|
||||
import static org.jooq.impl.Transformations.transformInlineCTE;
|
||||
|
||||
import java.util.Arrays;
|
||||
@ -141,6 +133,8 @@ import org.jooq.WithStep;
|
||||
import org.jooq.impl.QOM.UnmodifiableList;
|
||||
import org.jooq.impl.QOM.With;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* This type models an intermediary DSL construction step, which leads towards
|
||||
* creating any of the other 5 DML statement types.
|
||||
@ -181,7 +175,7 @@ implements
|
||||
WithStep,
|
||||
With
|
||||
{
|
||||
private static final Clause[] CLAUSES = { WITH };
|
||||
private static final Clause[] CLAUSES = { WITH };
|
||||
|
||||
|
||||
|
||||
@ -189,15 +183,15 @@ implements
|
||||
|
||||
|
||||
|
||||
final CommonTableExpressionList ctes;
|
||||
final boolean recursive;
|
||||
private Configuration configuration;
|
||||
final CommonTableExpressionList ctes;
|
||||
final boolean recursive;
|
||||
private Configuration configuration;
|
||||
|
||||
// Intermediary properties for CTE construction
|
||||
|
||||
private Name alias;
|
||||
private Name[] fieldAliases;
|
||||
private BiFunction<? super Field<?>, ? super Integer, ? extends String> fieldNameFunction;
|
||||
private transient Name alias;
|
||||
private transient Name[] fieldAliases;
|
||||
private transient BiFunction<? super Field<?>, ? super Integer, ? extends String> fieldNameFunction;
|
||||
|
||||
WithImpl(Configuration configuration, boolean recursive) {
|
||||
this.configuration = configuration;
|
||||
@ -587,12 +581,12 @@ implements
|
||||
|
||||
|
||||
@Override
|
||||
public final WithStep with(CommonTableExpression<?>... tables) {
|
||||
public final WithImpl with(CommonTableExpression<?>... tables) {
|
||||
return with(Arrays.asList(tables));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final WithStep with(Collection<? extends CommonTableExpression<?>> tables) {
|
||||
public final WithImpl with(Collection<? extends CommonTableExpression<?>> tables) {
|
||||
for (CommonTableExpression<?> table : tables)
|
||||
ctes.add(table);
|
||||
|
||||
@ -1191,11 +1185,21 @@ implements
|
||||
return QOM.unmodifiable(ctes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final WithImpl $commonTableExpressions(UnmodifiableList<? extends CommonTableExpression<?>> c) {
|
||||
return new WithImpl(configuration, recursive).with(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean $recursive() {
|
||||
return recursive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final WithImpl $recursive(boolean r) {
|
||||
return new WithImpl(configuration, r).with(ctes);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user