[CONJ-496] Driver not dealing with non zero decimal values Created: 2017-06-21 Updated: 2017-07-06 Resolved: 2017-07-06 |
|
| Status: | Closed |
| Project: | MariaDB Connector/J |
| Component/s: | JDBC 4.2 compatibility |
| Affects Version/s: | 1.4.4, 1.5.9, 1.6.1, 2.0.3, 1.6.2 |
| Fix Version/s: | 2.1.0, 1.6.3 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Kris Iyer | Assignee: | Diego Dupin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
We have an environment where we are upgrading the driver from v1.1.8 to 1.6.1 where we are running into issues where a decimal value coming back on the result set does not get parsed as an integer on v1.6.1 (getInt). The previous behavior on 1.x was that the value would get rounded and be a valid integer. For instance: mysql> select 100/3 as test;
---------
--------- When run through the Driver v1.6.1: When run on Driver 1.x: Tested this on multiple versions > 1.x and it seems to be consistent with 1.6.1. The workaround i figured is to parse as Double or Float. However we have a lot of code to refactor if thats what is desired moving forward. Note: This also affects getByte, getShort and getInt behavior. For instance a getByte against 1.0 = 1, whereas a getByte against 1.1 will be a similar out of range Exception for the byte range. |
| Comments |
| Comment by Kris Iyer [ 2017-06-21 ] | |||||||||||||||
|
If it helps this seems to have been introduced in v1.3.3. v1.3.2 and lower seem to give you the same behavior as 1.x (which is getInt() rounds off decimals). v1.3.2 dealt with NFE and returned the value as a BigDecimal:
| |||||||||||||||
| Comment by Kris Iyer [ 2017-06-22 ] | |||||||||||||||
|
Submitted a fix for this issue - https://github.com/MariaDB/mariadb-connector-j/pull/108 Thanks! | |||||||||||||||
| Comment by Kris Iyer [ 2017-06-27 ] | |||||||||||||||
|
These fixes have not made it into 1.6.2 or 2.0.3 - atleast by looking at what was released today. The submitted Pull Request for the fix is also open. | |||||||||||||||
| Comment by Diego Dupin [ 2017-06-27 ] | |||||||||||||||
|
réopen issue, i've confused pull request 107 and 108. | |||||||||||||||
| Comment by Diego Dupin [ 2017-06-27 ] | |||||||||||||||
|
This will be corrected in 2.1.0 version. correction is available using 2.1.0 snapshot :
| |||||||||||||||
| Comment by Kris Iyer [ 2017-06-27 ] | |||||||||||||||
|
Thanks for the update. Would it also be possible to get a 1.6.4-SNAPSHOT as well? Will help to use a Java 7 compatible version to unblock teams on this. Also if i could get an ETA for the releases that will be great. | |||||||||||||||
| Comment by Diego Dupin [ 2017-06-28 ] | |||||||||||||||
|
Snapshot for version 1.6 : (1.6.3-SNAPSHOT) now available with this correction :
1.6.3 and 2.1.0 release date is 2017-07-31 (https://jira.mariadb.org/plugins/servlet/project-config/CONJ/administer-versions?&status=unreleased) | |||||||||||||||
| Comment by Kris Iyer [ 2017-06-28 ] | |||||||||||||||
|
Thanks for the update and providing 1.6.3-SNAPSHOT! | |||||||||||||||
| Comment by JF D [ 2017-07-05 ] | |||||||||||||||
|
Comment at line 3519 is no longer valid in org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet:
| |||||||||||||||
| Comment by Kris Iyer [ 2017-07-05 ] | |||||||||||||||
|
Thanks for catching that. I have a Pull Request into develop to update that. | |||||||||||||||
| Comment by Diego Dupin [ 2017-07-06 ] | |||||||||||||||
|
yes, PR merged. |