[#2477] Some databases cannot bind strings as numbers (e.g. Postgres)

This commit is contained in:
Lukas Eder 2013-05-24 15:32:42 +02:00
parent 79a97a82ae
commit c5d74cabc4

View File

@ -70,7 +70,10 @@ import org.jooq.exception.SQLDialectNotSupportedException;
import org.jooq.tools.Convert;
import org.jooq.tools.JooqLogger;
import org.jooq.types.DayToSecond;
import org.jooq.types.UNumber;
import org.jooq.types.UByte;
import org.jooq.types.UInteger;
import org.jooq.types.ULong;
import org.jooq.types.UShort;
import org.jooq.types.YearToMonth;
/**
@ -252,8 +255,17 @@ class DefaultBindContext extends AbstractBindContext {
stmt.setString(nextIndex(), value.toString());
}
}
else if (UNumber.class.isAssignableFrom(type)) {
stmt.setString(nextIndex(), value.toString());
else if (type == UByte.class) {
stmt.setShort(nextIndex(), ((UByte) value).shortValue());
}
else if (type == UShort.class) {
stmt.setInt(nextIndex(), ((UShort) value).intValue());
}
else if (type == UInteger.class) {
stmt.setLong(nextIndex(), ((UInteger) value).longValue());
}
else if (type == ULong.class) {
stmt.setBigDecimal(nextIndex(), new BigDecimal(value.toString()));
}
else if (type == UUID.class) {
switch (dialect) {