[#2450] Cannot set precision on TINYINT, SMALLINT, INT, BIGINT data
types - Restored some logic from previous commit
This commit is contained in:
parent
3237426f3e
commit
2162af594e
@ -66,6 +66,10 @@ import org.jooq.UDTRecord;
|
||||
import org.jooq.exception.SQLDialectNotSupportedException;
|
||||
import org.jooq.tools.Convert;
|
||||
import org.jooq.types.Interval;
|
||||
import org.jooq.types.UByte;
|
||||
import org.jooq.types.UInteger;
|
||||
import org.jooq.types.ULong;
|
||||
import org.jooq.types.UShort;
|
||||
|
||||
/**
|
||||
* A common base class for data types.
|
||||
@ -229,6 +233,22 @@ public class DefaultDataType<T> implements DataType<T> {
|
||||
this.castTypeName = castTypeName;
|
||||
this.castTypeBase = TYPE_NAME_PATTERN.matcher(castTypeName).replaceAll("").trim();
|
||||
this.arrayType = (Class<T[]>) Array.newInstance(type, 0).getClass();
|
||||
|
||||
if (precision == 0) {
|
||||
if (type == Long.class || type == ULong.class) {
|
||||
precision = LONG_PRECISION;
|
||||
}
|
||||
else if (type == Integer.class || type == UInteger.class) {
|
||||
precision = INTEGER_PRECISION;
|
||||
}
|
||||
else if (type == Short.class || type == UShort.class) {
|
||||
precision = SHORT_PRECISION;
|
||||
}
|
||||
else if (type == Byte.class || type == UByte.class) {
|
||||
precision = BYTE_PRECISION;
|
||||
}
|
||||
}
|
||||
|
||||
this.precision = precision;
|
||||
this.scale = scale;
|
||||
this.length = length;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user