Bug #12167 getInt() for SMALLINT UNSIGNED column returns incorrect value
| Submitted: | 25 Jul 2005 23:33 | Modified: | 25 Jul 2005 23:44 |
|---|---|---|---|
| Reporter: | Boris Burtin | Email Updates: | |
| Status: | Duplicate | Impact on me: | |
| Category: | Connector / J | Severity: | S1 (Critical) |
| Version: | 3.1.10 | OS: | Any (*) |
| Assigned to: | CPU Architecture: | Any |
[25 Jul 2005 23:44]
Aleksey Kishkin
duplicate of http://bugs.mysql.com/bug.php?id=11874
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.037 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: When a column is declared as SMALLINT UNSIGNED NOT NULL, the driver incorrectly offsets the value returned from the database by 65536. How to repeat: * Create a table with a column that's declared as SMALLINT UNSIGNED NOT NULL * Insert the value 8 into the column * run "SELECT * FROM my_table" * call ResultSet.getInt(columnName) the value returned is 65544, not 8. I tracked it down to the following code in the ResultSet class: case MysqlDefs.FIELD_TYPE_SHORT: if (!f.isUnsigned()) { return getNativeShort(columnIndex + 1); } return getNativeShort(columnIndex + 1) + 65536; the value returned by getNativeShort() is 8, but the driver still tries to offset it. Suggested fix: Please ensure that the correct value is being returned by ResultSet.getInt() for all integer types.