-
Notifications
You must be signed in to change notification settings - Fork 39
Closed
Description
Senario:
When we declare table with unsigned tinyint, and store value larger than max value of corresponding SIGNED type, negative number is return.
Reproduce
CREATE TABLE t1 (ts TIMESTAMP, f1 TINYINT UNSINGED, f2 SMALLINT UNSIGNED, f3 INT UNSIGNED, f4 BIGINT UNSIGNED);INSERT INTO t1 (ts, f1, f2, f3, f4) VALUES (NOW, 255, 65535, 4294967295, POW(2, 64) - 1);Solution:
Just like the mysql-connector-j way, map TINY_UNSIGNED to Integer, SMALLINT_UNSIGNED to Integer, INT_UNSIGNED to Long, BIGINT_UNSIGNED to BigInteger.
UTINYINTshould useShortinstead ofByte.USMALLINTshould useIntegerinstead ofShort.UINTshould useLonginstead ofInteger.UBIGINTshould useBigIntegerinstead ofLong
Metadata
Metadata
Assignees
Labels
No labels