[CONJ-841] ResultSetMetaData::getColumnTypeName() returns incorrect type name for LONGTEXT Created: 2020-11-15 Updated: 2020-12-02 Resolved: 2020-11-16 |
|
| Status: | Closed |
| Project: | MariaDB Connector/J |
| Component/s: | metadata |
| Affects Version/s: | None |
| Fix Version/s: | 2.7.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Lawrin Novitsky | Assignee: | Diego Dupin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
https://docs.oracle.com/javase/8/docs/api/java/sql/ResultSetMetaData.html#getColumnTypeName-int- says that getColumnTypeName "Returns: type name used by the database.", but for LONGTEXT type it will return VARCHAR. The solution could be to change the branch in the switch in the method to look like if (len < 0) { return "LONGTEXT"; }else if (len <= 255) { return "VARCHAR"; }else if (len <= 65535) { return "TEXT"; }else if (len <= 16777215) { return "MEDIUMTEXT"; }else { return "LONGTEXT"; } |
| Comments |
| Comment by Lawrin Novitsky [ 2020-11-15 ] |
|
The diff against master. No testcase. |
| Comment by Diego Dupin [ 2020-11-16 ] |
|
Corrected with https://github.com/mariadb-corporation/mariadb-connector-j/commit/fd276551dc98549d13f600b721596a6bc43c8d60 small difference compare to description:
|
| Comment by Lawrin Novitsky [ 2020-12-02 ] |
|
diego dupin Shouldn't then MariaDbResultSetMetaData.getColumnType changed accordingly? i.e. size in characters to be considered, and Types.VARCHAR returned up to the length 65532, and Types.LONGVARCHAR for longer types? |