[#430] Add support for the Firebird database - Fixed binding of NULL
values to PreparedStatements
This commit is contained in:
parent
9fb61a5089
commit
88de2f62da
@ -59,6 +59,7 @@ import java.util.Arrays;
|
||||
|
||||
import org.jooq.ArrayRecord;
|
||||
import org.jooq.BindContext;
|
||||
import org.jooq.Context;
|
||||
import org.jooq.Converter;
|
||||
import org.jooq.DataType;
|
||||
import org.jooq.EnumType;
|
||||
@ -236,7 +237,7 @@ class Val<T> extends AbstractField<T> implements Param<T> {
|
||||
|
||||
// [#1727] VARCHAR types should be cast to their actual lengths in some
|
||||
// dialects
|
||||
else if (getValue() != null && (type == SQLDataType.VARCHAR || type == SQLDataType.CHAR) && asList(FIREBIRD).contains(dialect)) {
|
||||
else if ((type == SQLDataType.VARCHAR || type == SQLDataType.CHAR) && asList(FIREBIRD).contains(dialect)) {
|
||||
toSQLCast(context, getDataType(context), getValueLength());
|
||||
}
|
||||
|
||||
@ -535,7 +536,7 @@ class Val<T> extends AbstractField<T> implements Param<T> {
|
||||
public final void bind(BindContext context) {
|
||||
|
||||
// [#1302] Bind value only if it was not explicitly forced to be inlined
|
||||
if (!isInline()) {
|
||||
if (!isInline(context)) {
|
||||
context.bindValue(getValue(), getType());
|
||||
}
|
||||
}
|
||||
@ -579,7 +580,12 @@ class Val<T> extends AbstractField<T> implements Param<T> {
|
||||
return inline;
|
||||
}
|
||||
|
||||
private final boolean isInline(Context<?> context) {
|
||||
// It looks as though jaybird cannot properly bind NULL!
|
||||
return isInline() || (context.getDialect() == FIREBIRD && value == null);
|
||||
}
|
||||
|
||||
private final boolean isInline(RenderContext context) {
|
||||
return isInline() || context.inline();
|
||||
return isInline((Context<?>) context) || context.inline();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user