}
}
@Override
public void set(BindingSetStatementContext<U> ctx) throws SQLException {
Configuration configuration = ctx.configuration();
SQLDialect dialect = ctx.dialect();
T value = converter.to(ctx.value());
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 {
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
if (value == null) {
int sqlType = DefaultDataType.getDataType(dialect, type).getSQLType();
/* [pro] xx
xx xxxxxxxxxxxx xxxxx xxxxx xxxx xx xx xxxxx xxxx xxxxx xxxx xxxx
xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx x
xxxxxx xxxxxxxx x xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx xxxxxxxxxx
x
xxxx
xx [/pro] */
// [#1126] Oracle's UDTs need to be bound with their type name
if (UDTRecord.class.isAssignableFrom(type)) {
String typeName = Utils.newRecord(false, (Class<UDTRecord<?>>) type)
.<RuntimeException>operate(null)
.getUDT()
.getName();
ctx.statement().setNull(ctx.index(), sqlType, typeName);
}
// [#1225] [#1227] TODO Put this logic into DataType
// Some dialects have trouble binding binary data as BLOB
else if (asList(POSTGRES).contains(configuration.dialect()) && sqlType == Types.BLOB) {
ctx.statement().setNull(ctx.index(), Types.BINARY);
}
/* [pro] xx
xxxx xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xx xxxxxxx x