[CONJ-144] getColumnClassName doesn't support all data types Created: 2015-03-02  Updated: 2016-09-01  Resolved: 2016-09-01

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: 1.1.8
Fix Version/s: 1.5.2

Type: Bug Priority: Major
Reporter: Georg Richter Assignee: Georg Richter
Resolution: Fixed Votes: 0
Labels: None


 Description   

getColunClassName only supports the following data types:

TINYINT
INTEGER
BIGINT
YEAR
BIT
STRING
VARCHAR
VARSTRING

support for the following data types is missing:

BOOLEAN
SMALLINT
FLOAT, DOUBLE, DECIMAL
BINARY
DATE, TIME, TIMESTAMP



 Comments   
Comment by Vladislav Vaintroub [ 2015-03-02 ]

Actually, all Types should be handled.The switch statement in https://github.com/MariaDB/mariadb-connector-j/blob/master/src/main/java/org/mariadb/jdbc/internal/mysql/MySQLType.java#L123 is only for non-trivial cases, where just mysql type info alone does not suffice, but other information like field length or encoding is required to derive the type. Trivial cases are handled after the switch statement.

There is a reasonably extensive datatype test, which checks for equality of resultSetMetaData.getColumnClassName() and resultSet.getObject().getClass().getName() for many datatypes.
https://github.com/MariaDB/mariadb-connector-j/blob/master/src/test/java/org/mariadb/jdbc/DatatypeTest.java

Comment by Diego Dupin [ 2016-09-01 ]

Tested, i confirm metadata for "missing" type work well.
corresponding code is now in :
https://github.com/MariaDB/mariadb-connector-j/blob/master/src/main/java/org/mariadb/jdbc/internal/MariaDbType.java#L168

The default type.getClassName() return appropriate result.

Generated at Thu Feb 08 03:13:29 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.