[#2438] Add ParamType Param.paramType() to indicate whether a parameter is INDEXED, NAMED, INLINED
This commit is contained in:
parent
1e714a567c
commit
23b5f7cf8a
@ -40,6 +40,7 @@
|
||||
*/
|
||||
package org.jooq;
|
||||
|
||||
import org.jooq.conf.ParamType;
|
||||
import org.jooq.exception.DataTypeException;
|
||||
import org.jooq.impl.DSL;
|
||||
import org.jooq.tools.Convert;
|
||||
@ -119,4 +120,9 @@ public interface Param<T> extends Field<T> {
|
||||
* A flag on the bind value to force it to be inlined in rendered SQL
|
||||
*/
|
||||
boolean isInline();
|
||||
|
||||
/**
|
||||
* The parameter type.
|
||||
*/
|
||||
ParamType getParamType();
|
||||
}
|
||||
|
||||
@ -42,7 +42,9 @@ package org.jooq.impl;
|
||||
|
||||
import static org.jooq.Clause.FIELD;
|
||||
import static org.jooq.Clause.FIELD_VALUE;
|
||||
import static org.jooq.conf.ParamType.INDEXED;
|
||||
import static org.jooq.conf.ParamType.INLINED;
|
||||
import static org.jooq.conf.ParamType.NAMED;
|
||||
import static org.jooq.conf.ParamType.NAMED_OR_INLINED;
|
||||
|
||||
// ...
|
||||
@ -51,6 +53,7 @@ import org.jooq.Context;
|
||||
import org.jooq.DataType;
|
||||
import org.jooq.Param;
|
||||
import org.jooq.UDTRecord;
|
||||
import org.jooq.conf.ParamType;
|
||||
import org.jooq.tools.StringUtils;
|
||||
|
||||
/**
|
||||
@ -157,4 +160,14 @@ abstract class AbstractParam<T> extends AbstractField<T> implements Param<T> {
|
||||
|| (context.paramType() == INLINED)
|
||||
|| (context.paramType() == NAMED_OR_INLINED && StringUtils.isBlank(paramName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final ParamType getParamType() {
|
||||
return inline
|
||||
? INLINED
|
||||
: StringUtils.isBlank(paramName)
|
||||
? INDEXED
|
||||
: NAMED
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user