[jOOQ/jOOQ#12916] Select.(), , (), (), () don't actually return null in the absence of a predicate

This commit is contained in:
Lukas Eder 2022-01-21 16:15:45 +01:00
parent 4a1db22f86
commit 7c4d467a5c
2 changed files with 12 additions and 3 deletions

View File

@ -55,6 +55,9 @@ import org.jooq.SQL;
import org.jooq.Select;
import org.jooq.impl.QOM.UProxy;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* @author Lukas Eder
*/
@ -67,6 +70,12 @@ final class ConditionProviderImpl extends AbstractQueryPart implements Condition
this.condition = condition;
}
@Nullable
final Condition getWhereOrNull() {
return hasWhere() ? condition : null;
}
@NotNull
final Condition getWhere() {
return hasWhere() ? condition : noCondition();
}

View File

@ -4489,7 +4489,7 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
@Override
public final Condition $where() {
return condition;
return condition.getWhereOrNull();
}
@Override
@ -4528,7 +4528,7 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
@Override
public final Condition $having() {
return having;
return having.getWhereOrNull();
}
@Override
@ -4554,7 +4554,7 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
@Override
public final Condition $qualify() {
return qualify;
return qualify.getWhereOrNull();
}
@Override