Details
- 
    
Bug
 - 
    Status: Closed (View Workflow)
 - 
    
Major
 - 
    Resolution: Fixed
 - 
    1.4.5, 1.5.9, 1.6.0, 1.6.4, 1.6.5
 - 
    None
 
Description
A while ago we did JDBC driver upgrade from 1.4.5 to 1.6.4 and noticed an issue when using getShort-method for BIT(1) data type.
After closer inspection we wrote a test which returns the value using different methods and using PreparedStatement/Statement. Other ResultSet methods (getString, getObject, getByte, getBoolean) return the correct result (0/1), but getShort()-method produces strange results.
I am not familiar with MariaDB JDBC driver internal logic, but it seems this has to do something with text/binary protocol detection.
Driver version 1.4.5/1.5.9, using PreparedStatement:
BIT(1) field value in database 0, getShort returns 0
BIT(1) field value in database 1, getShort returns 1
Driver version 1.4.5/1.5.9, using Statement:
BIT(1) field value in database 0, getShort returns -48
BIT(1) field value in database 1, getShort returns -47
Driver version 1.6.0/1.6.4/1.6.5, using PreparedStatement:
BIT(1) field value in database 0, getShort returns -48
BIT(1) field value in database 1, getShort returns -47
Driver version 1.6.0/1.6.4/1.6.5, using Statement:
BIT(1) field value in database 0, getShort returns -48
BIT(1) field value in database 1, getShort returns -47
MariaDB server information:
version	10.1.26-MariaDB
version_comment	MariaDB Server
version_compile_machine	x86_64
version_compile_os	Linux