[jOOQ/jOOQ#14067] HSQLDB is also affected

This commit is contained in:
Lukas Eder 2022-10-11 14:29:01 +02:00
parent eacceadee4
commit 076e1fca8c
2 changed files with 8 additions and 2 deletions

View File

@ -38,6 +38,7 @@
package org.jooq.impl;
import static org.jooq.SQLDialect.FIREBIRD;
import static org.jooq.impl.ClobBinding.NO_SUPPORT_NULL_LOBS;
import static org.jooq.impl.DefaultExecuteContext.localConnection;
import static org.jooq.impl.DefaultExecuteContext.localTargetConnection;
import static org.jooq.impl.Tools.asInt;
@ -106,7 +107,7 @@ public class BlobBinding implements Binding<byte[], byte[]> {
Blob blob = newBlob(ctx, ctx.value(), ctx.statement().getConnection());
// [#14067] Workaround for Firebird bug https://github.com/FirebirdSQL/jaybird/issues/712
if (blob == null && ctx.family() == FIREBIRD)
if (blob == null && NO_SUPPORT_NULL_LOBS.contains(ctx.dialect()))
ctx.statement().setNull(ctx.index(), Types.BLOB);
else
ctx.statement().setBlob(ctx.index(), blob);

View File

@ -38,6 +38,7 @@
package org.jooq.impl;
import static org.jooq.SQLDialect.FIREBIRD;
import static org.jooq.SQLDialect.HSQLDB;
import static org.jooq.impl.DefaultExecuteContext.localConnection;
import static org.jooq.impl.DefaultExecuteContext.localTargetConnection;
import static org.jooq.impl.Tools.asInt;
@ -46,6 +47,7 @@ import java.io.Reader;
import java.sql.Clob;
import java.sql.SQLException;
import java.sql.Types;
import java.util.Set;
import org.jooq.Binding;
import org.jooq.BindingGetResultSetContext;
@ -58,6 +60,7 @@ import org.jooq.BindingSetStatementContext;
import org.jooq.Converter;
import org.jooq.Converters;
import org.jooq.ResourceManagingScope;
import org.jooq.SQLDialect;
import org.jooq.Scope;
import org.jooq.Source;
import org.jooq.conf.ParamType;
@ -76,6 +79,8 @@ import org.jooq.tools.jdbc.JDBCUtils;
*/
public class ClobBinding implements Binding<String, String> {
static final Set<SQLDialect> NO_SUPPORT_NULL_LOBS = SQLDialect.supportedBy(FIREBIRD, HSQLDB);
@Override
public final Converter<String, String> converter() {
return Converters.identity(String.class);
@ -99,7 +104,7 @@ public class ClobBinding implements Binding<String, String> {
Clob clob = newClob(ctx, ctx.value());
// [#14067] Workaround for Firebird bug https://github.com/FirebirdSQL/jaybird/issues/712
if (clob == null && ctx.family() == FIREBIRD)
if (clob == null && NO_SUPPORT_NULL_LOBS.contains(ctx.dialect()))
ctx.statement().setNull(ctx.index(), Types.CLOB);
else
ctx.statement().setClob(ctx.index(), clob);