[#5393] Cannot apply Binding to PostgreSQL UDT arrays
This commit is contained in:
parent
be5a63cded
commit
8eb73b4180
@ -857,14 +857,11 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
SQLDialect dialect = ctx.dialect();
|
||||
T value = converter.to(ctx.value());
|
||||
|
||||
if (log.isTraceEnabled()) {
|
||||
if (value != null && value.getClass().isArray() && value.getClass() != byte[].class) {
|
||||
if (log.isTraceEnabled())
|
||||
if (value != null && value.getClass().isArray() && value.getClass() != byte[].class)
|
||||
log.trace("Binding variable " + ctx.index(), Arrays.asList((Object[]) value) + " (" + type + ")");
|
||||
}
|
||||
else {
|
||||
else
|
||||
log.trace("Binding variable " + ctx.index(), value + " (" + type + ")");
|
||||
}
|
||||
}
|
||||
|
||||
// Setting null onto a prepared statement is subtly different for every
|
||||
// SQL dialect. See the following section for details
|
||||
@ -2182,6 +2179,9 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
else if (Record.class.isAssignableFrom(type)) {
|
||||
return (T) pgNewRecord(type, null, string);
|
||||
}
|
||||
else if (type == Object.class) {
|
||||
return (T) string;
|
||||
}
|
||||
else {
|
||||
Converter<Object, T> c = (Converter<Object, T>) converter;
|
||||
return c.from(pgFromString(c.fromType(), string));
|
||||
|
||||
@ -52,6 +52,7 @@ import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.jooq.Converter;
|
||||
import org.jooq.Record;
|
||||
import org.jooq.exception.DataTypeException;
|
||||
import org.jooq.tools.reflect.Reflect;
|
||||
@ -465,7 +466,9 @@ public class PostgresUtils {
|
||||
sb.append("(");
|
||||
|
||||
String separator = "";
|
||||
for (Object a : r.intoArray()) {
|
||||
for (int i = 0; i < r.size(); i++) {
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
Object a = ((Converter) r.field(i).getConverter()).to(r.get(i));
|
||||
sb.append(separator);
|
||||
|
||||
// [#753] null must not be set as a literal
|
||||
|
||||
Loading…
Reference in New Issue
Block a user