[jOOQ/jOOQ#12425] Various fixes
- ConditionProviderImpl shouldn't nest ConditionProviderImpl - Stick with MFieldAlias, instead of MAliasedField - Added and implemented MTableAlias - Add a Param.(T) setter
This commit is contained in:
parent
d5e8a36e31
commit
205757698b
@ -57,6 +57,8 @@ import org.jooq.Param;
|
||||
import org.jooq.ParamMode;
|
||||
import org.jooq.QualifiedRecord;
|
||||
import org.jooq.conf.ParamType;
|
||||
// ...
|
||||
// ...
|
||||
import org.jooq.tools.StringUtils;
|
||||
|
||||
/**
|
||||
@ -196,6 +198,12 @@ abstract class AbstractParam<T> extends AbstractParamX<T> implements SimpleQuery
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public /* non-final */ MParam<T> $value(T newValue) {
|
||||
// TODO [#12425] Only Val implements this, so far.
|
||||
throw new UNotYetImplementedException();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// XXX: Object API
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@ -49,7 +49,8 @@ import org.jooq.tools.JooqLogger;
|
||||
* @author Lukas Eder
|
||||
*/
|
||||
abstract class AbstractParamX<T> extends AbstractField<T> implements Param<T> {
|
||||
private static final JooqLogger log = JooqLogger.getLogger(AbstractParam.class);
|
||||
|
||||
private static final JooqLogger log = JooqLogger.getLogger(AbstractParam.class);
|
||||
|
||||
AbstractParamX(Name name, DataType<T> type) {
|
||||
super(name, type);
|
||||
|
||||
@ -102,9 +102,11 @@ final class ConditionProviderImpl extends AbstractQueryPart implements Condition
|
||||
@Override
|
||||
public final void addConditions(Operator operator, Condition conditions) {
|
||||
if (hasWhere())
|
||||
condition = DSL.condition(operator, getWhere(), conditions);
|
||||
setWhere(DSL.condition(operator, getWhere(), conditions));
|
||||
else if (conditions instanceof ConditionProviderImpl)
|
||||
setWhere(((ConditionProviderImpl) conditions).getWhere());
|
||||
else
|
||||
condition = conditions;
|
||||
setWhere(conditions);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -43,6 +43,7 @@ import org.jooq.Param;
|
||||
import org.jooq.ParamMode;
|
||||
import org.jooq.conf.ParamType;
|
||||
// ...
|
||||
// ...
|
||||
|
||||
/**
|
||||
* A {@link Param} wrapper object that allows for lazily initialising the value
|
||||
@ -123,6 +124,11 @@ final class ConvertedVal<T> extends AbstractParamX<T> implements UNotYetImplemen
|
||||
return getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final MParam<T> $value(T value) {
|
||||
return ((AbstractParamX) delegate).$value(delegate.getDataType().convert(value));
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// The Object API
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@ -154,6 +154,11 @@ final class LazyVal<T> extends AbstractParamX<T> implements MVal<T> {
|
||||
return delegate.$value();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final MParam<T> $value(T value) {
|
||||
return delegate.$value(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <R> R traverse(
|
||||
R init,
|
||||
|
||||
@ -675,6 +675,7 @@ public final class QOM {
|
||||
|
||||
public interface MParam<T> extends MField<T>, UEmpty {
|
||||
T $value();
|
||||
MParam<T> $value(T value);
|
||||
}
|
||||
public interface MInline<T> extends MParam<T> {}
|
||||
public interface MVal<T> extends MParam<T> {}
|
||||
@ -2889,11 +2890,22 @@ public final class QOM {
|
||||
* A marker interface for {@link QueryPart} implementations whose
|
||||
* {@link MQueryPart} semantics has not yet been implemented.
|
||||
*
|
||||
* @deprecated - [#12425] - 3.16.0 - Missing implementations should be added as soon as possible!
|
||||
* @deprecated - [#12425] - 3.16.0 - Missing implementations should be added
|
||||
* as soon as possible!
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
interface UNotYetImplemented extends UEmpty {}
|
||||
|
||||
/**
|
||||
* A marker interface for {@link MQueryPart} methods that have not yet been
|
||||
* implemented.
|
||||
*
|
||||
* @deprecated - [#12425] - 3.16.0 - Missing implementations should be added
|
||||
* as soon as possible!
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
static class UNotYetImplementedException extends RuntimeException {}
|
||||
|
||||
interface UProxy<Q extends MQueryPart> extends MQueryPart {
|
||||
Q $delegate();
|
||||
|
||||
@ -2932,7 +2944,7 @@ public final class QOM {
|
||||
|
||||
@Override
|
||||
default MQueryPart replace(Function1<? super MQueryPart, ? extends MQueryPart> replacement) {
|
||||
return this;
|
||||
return replacement.apply(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -76,6 +76,7 @@ import org.jooq.JSONB;
|
||||
import org.jooq.RenderContext;
|
||||
import org.jooq.conf.ParamType;
|
||||
import org.jooq.exception.DataAccessException;
|
||||
// ...
|
||||
import org.jooq.tools.JooqLogger;
|
||||
import org.jooq.tools.StringUtils;
|
||||
import org.jooq.types.DayToSecond;
|
||||
@ -339,4 +340,13 @@ final class Val<T> extends AbstractParam<T> {
|
||||
return "?";
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX: Query Object Model
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public final MParam<T> $value(T newValue) {
|
||||
return copy(newValue);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user