[jOOQ/jOOQ#14027] ClobBinding and BlobBinding shouldn't delegate sql()
generation to internal DefaultClobBinding or DefaultBlobBinding
This commit is contained in:
parent
77015bbc52
commit
2b57efb150
@ -66,12 +66,14 @@ import static org.jooq.impl.Keywords.K_CASE;
|
||||
import static org.jooq.impl.Keywords.K_COLUMNS;
|
||||
import static org.jooq.impl.Keywords.K_DECLARE;
|
||||
import static org.jooq.impl.Keywords.K_END;
|
||||
import static org.jooq.impl.Keywords.K_END_IF;
|
||||
import static org.jooq.impl.Keywords.K_END_LOOP;
|
||||
import static org.jooq.impl.Keywords.K_FALSE;
|
||||
import static org.jooq.impl.Keywords.K_FIRST;
|
||||
import static org.jooq.impl.Keywords.K_FOR;
|
||||
import static org.jooq.impl.Keywords.K_FROM;
|
||||
import static org.jooq.impl.Keywords.K_FUNCTION;
|
||||
import static org.jooq.impl.Keywords.K_IF;
|
||||
import static org.jooq.impl.Keywords.K_IN;
|
||||
import static org.jooq.impl.Keywords.K_IS;
|
||||
import static org.jooq.impl.Keywords.K_IS_NOT_NULL;
|
||||
@ -1466,6 +1468,12 @@ implements
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -57,6 +57,7 @@ import org.jooq.BindingSetStatementContext;
|
||||
import org.jooq.Converter;
|
||||
import org.jooq.Converters;
|
||||
import org.jooq.ResourceManagingScope;
|
||||
import org.jooq.conf.ParamType;
|
||||
import org.jooq.impl.R2DBC.R2DBCPreparedStatement;
|
||||
import org.jooq.impl.R2DBC.R2DBCResultSet;
|
||||
import org.jooq.tools.jdbc.JDBCUtils;
|
||||
@ -81,7 +82,10 @@ public class BlobBinding implements Binding<byte[], byte[]> {
|
||||
|
||||
@Override
|
||||
public final void sql(BindingSQLContext<byte[]> ctx) throws SQLException {
|
||||
ctx.render().visit(DSL.val(ctx.value(), SQLDataType.BLOB));
|
||||
if (ctx.render().paramType() == ParamType.INLINED)
|
||||
ctx.render().visit(DSL.inline(ctx.convert(converter()).value(), SQLDataType.BLOB));
|
||||
else
|
||||
ctx.render().sql(ctx.variable());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -148,6 +152,9 @@ public class BlobBinding implements Binding<byte[], byte[]> {
|
||||
}
|
||||
|
||||
static final Blob newBlob(ResourceManagingScope scope, byte[] bytes, Connection connection) throws SQLException {
|
||||
if (bytes == null)
|
||||
return null;
|
||||
|
||||
Blob blob;
|
||||
|
||||
switch (scope.dialect()) {
|
||||
|
||||
@ -59,6 +59,7 @@ import org.jooq.Converters;
|
||||
import org.jooq.ResourceManagingScope;
|
||||
import org.jooq.Scope;
|
||||
import org.jooq.Source;
|
||||
import org.jooq.conf.ParamType;
|
||||
import org.jooq.tools.jdbc.JDBCUtils;
|
||||
|
||||
// ...
|
||||
@ -81,7 +82,10 @@ public class ClobBinding implements Binding<String, String> {
|
||||
|
||||
@Override
|
||||
public final void sql(BindingSQLContext<String> ctx) throws SQLException {
|
||||
ctx.render().visit(DSL.val(ctx.value(), SQLDataType.CLOB));
|
||||
if (ctx.render().paramType() == ParamType.INLINED)
|
||||
ctx.render().visit(DSL.inline(ctx.convert(converter()).value(), SQLDataType.CLOB));
|
||||
else
|
||||
ctx.render().sql(ctx.variable());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -154,6 +158,9 @@ public class ClobBinding implements Binding<String, String> {
|
||||
}
|
||||
|
||||
static final Clob newClob(ResourceManagingScope scope, String string) throws SQLException {
|
||||
if (string == null)
|
||||
return null;
|
||||
|
||||
Clob clob;
|
||||
|
||||
switch (scope.dialect()) {
|
||||
|
||||
@ -703,7 +703,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
|
||||
final DataType<T> dataType;
|
||||
final ContextConverter<T, U> converter;
|
||||
final ContextConverter<T, U> converter;
|
||||
final boolean attachable;
|
||||
|
||||
InternalBinding(DataType<T> dataType, Converter<T, U> converter) {
|
||||
@ -4317,7 +4317,6 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
|
||||
|
||||
|
||||
ctx.output().writeString(value);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user