Description:
Server side prepared statements are broken, the connector cannot handle the binary result set type for a DECIMAL column.
How to repeat:
Create a server side prepared statement that returns a DECIMAL(6,2) column, an exception will be thrown when the results are listed.
Suggested fix:
in the method: com.mysql.jdbc.MysqlIO.unpackBinaryResultSetRow
There is no case branch for the MysqlDefs.FIELD_TYPE_DECIMAL type. This results in any server side prepared statments which return for example DECIMAL(6,2) types to throw an exception at line 4069 claiming the type is unknown.
The solution is fairly simple, first add a case branch in the last block above the exception:
case MysqlDefs.FIELD_TYPE_TINY_BLOB:
case MysqlDefs.FIELD_TYPE_MEDIUM_BLOB:
case MysqlDefs.FIELD_TYPE_LONG_BLOB:
case MysqlDefs.FIELD_TYPE_BLOB:
case MysqlDefs.FIELD_TYPE_VAR_STRING:
case MysqlDefs.FIELD_TYPE_STRING:
case MysqlDefs.FIELD_TYPE_DECIMAL: <--- extra branch, line 4065
Also the com.mysql.jdbc.ResultSet.getNativeString method has to be modified similarly, at line 4232:
switch (mysqlType) {
case MysqlDefs.FIELD_TYPE_TINY_BLOB:
case MysqlDefs.FIELD_TYPE_MEDIUM_BLOB:
case MysqlDefs.FIELD_TYPE_LONG_BLOB:
case MysqlDefs.FIELD_TYPE_BLOB:
case MysqlDefs.FIELD_TYPE_DECIMAL: <-- extra branch.
then everything works.