Bug #21062 ResultSet.getInt()/getShort() do not function correctly on a BIT datatype column
Submitted: 14 Jul 2006 14:40 Modified: 26 Jul 2006 18:17
Reporter: [ name withheld ] Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:3.1.13 OS:Linux (Linux)
Assigned to: Mark Matthews

[14 Jul 2006 14:40] [ name withheld ]
Description:
The getByte() function works with BIT columns, but the getInt() and getShort() methods don't.

java.lang.ArrayIndexOutOfBoundsException: 4
	at com.mysql.jdbc.ResultSet.getNumericRepresentationOfSQLBitType(ResultSet.java:4638)
	at com.mysql.jdbc.ResultSet.getInt(ResultSet.java:2422)
	at com.mysql.jdbc.ResultSet.getInt(ResultSet.java:2507)

How to repeat:
I created a table with BIT(7), BIT(31) and BIT(12) columns. When I try to retrieve the values, only the getByte() method for the BIT(7) column works, the others throw an exception (see description).
Use maximum values in each column.

Suggested fix:
I previously used an earlier version (may be 3.1.10) where the getByte() did not work, too, but this seems to be fixed. Might have the same reason?
[15 Jul 2006 14:53] [ name withheld ]
does not occur anymore
[15 Jul 2006 14:56] [ name withheld ]
sorry, still does...
[18 Jul 2006 16:01] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/9283