Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
1.4.4, 1.5.9, 1.6.1, 2.0.3, 1.6.2
-
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;
---------
test |
---------
33.3333 |
---------
1 row in set (0.00 sec)
When run through the Driver v1.6.1:
Exception in thread "main" java.lang.RuntimeException: java.sql.SQLException: Out of range value for column 'test' : value 33.3333 is not in Integer range
at ::
Caused by: java.sql.SQLException: Out of range value for column 'test' : value 33.3333 is not in Integer range
at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.parseInt(SelectResultSet.java:3440)
at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.getInternalInt(SelectResultSet.java:1075)
at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.getInt(SelectResultSet.java:1054)
at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.getInt(SelectResultSet.java:1061)
When run on Driver 1.x:
Results: 33.
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.
Attachments
Activity
Field | Original Value | New Value |
---|---|---|
Summary | Driver not dealing with Float values as integer. | Driver not dealing with Float/Double values as integer. |
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. 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; +---------+ | test | +---------+ | 33.3333 | +---------+ 1 row in set (0.00 sec) When run through the Driver v1.6.1: Exception in thread "main" java.lang.RuntimeException: java.sql.SQLException: Out of range value for column 'test' : value 33.3333 is not in Integer range at mariajdbc.JDBCCallableStatementOUTParameterExample.testSQL(JDBCCallableStatementOUTParameterExample.java:56) at mariajdbc.JDBCCallableStatementOUTParameterExample.main(JDBCCallableStatementOUTParameterExample.java:24) Caused by: java.sql.SQLException: Out of range value for column 'test' : value 33.3333 is not in Integer range at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.parseInt(SelectResultSet.java:3440) at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.getInternalInt(SelectResultSet.java:1075) at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.getInt(SelectResultSet.java:1054) at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.getInt(SelectResultSet.java:1061) at mariajdbc.JDBCCallableStatementOUTParameterExample.testSQL(JDBCCallableStatementOUTParameterExample.java:52) ... 1 more When run on Driver 1.x: Results: 33. 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. |
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. 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; +---------+ | test | +---------+ | 33.3333 | +---------+ 1 row in set (0.00 sec) When run through the Driver v1.6.1: Exception in thread "main" java.lang.RuntimeException: java.sql.SQLException: Out of range value for column 'test' : value 33.3333 is not in Integer range at :: Caused by: java.sql.SQLException: Out of range value for column 'test' : value 33.3333 is not in Integer range at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.parseInt(SelectResultSet.java:3440) at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.getInternalInt(SelectResultSet.java:1075) at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.getInt(SelectResultSet.java:1054) at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.getInt(SelectResultSet.java:1061) When run on Driver 1.x: Results: 33. 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. |
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. 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; +---------+ | test | +---------+ | 33.3333 | +---------+ 1 row in set (0.00 sec) When run through the Driver v1.6.1: Exception in thread "main" java.lang.RuntimeException: java.sql.SQLException: Out of range value for column 'test' : value 33.3333 is not in Integer range at :: Caused by: java.sql.SQLException: Out of range value for column 'test' : value 33.3333 is not in Integer range at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.parseInt(SelectResultSet.java:3440) at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.getInternalInt(SelectResultSet.java:1075) at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.getInt(SelectResultSet.java:1054) at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.getInt(SelectResultSet.java:1061) When run on Driver 1.x: Results: 33. 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. |
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; +---------+ | test | +---------+ | 33.3333 | +---------+ 1 row in set (0.00 sec) When run through the Driver v1.6.1: Exception in thread "main" java.lang.RuntimeException: java.sql.SQLException: Out of range value for column 'test' : value 33.3333 is not in Integer range at :: Caused by: java.sql.SQLException: Out of range value for column 'test' : value 33.3333 is not in Integer range at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.parseInt(SelectResultSet.java:3440) at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.getInternalInt(SelectResultSet.java:1075) at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.getInt(SelectResultSet.java:1054) at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.getInt(SelectResultSet.java:1061) When run on Driver 1.x: Results: 33. 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. |
Component/s | JDBC 4.2 compatibility [ 14001 ] |
Summary | Driver not dealing with Float/Double values as integer. | Driver not dealing with non zero decimal values |
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; +---------+ | test | +---------+ | 33.3333 | +---------+ 1 row in set (0.00 sec) When run through the Driver v1.6.1: Exception in thread "main" java.lang.RuntimeException: java.sql.SQLException: Out of range value for column 'test' : value 33.3333 is not in Integer range at :: Caused by: java.sql.SQLException: Out of range value for column 'test' : value 33.3333 is not in Integer range at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.parseInt(SelectResultSet.java:3440) at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.getInternalInt(SelectResultSet.java:1075) at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.getInt(SelectResultSet.java:1054) at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.getInt(SelectResultSet.java:1061) When run on Driver 1.x: Results: 33. 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. |
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; +---------+ | test | +---------+ | 33.3333 | +---------+ 1 row in set (0.00 sec) When run through the Driver v1.6.1: Exception in thread "main" java.lang.RuntimeException: java.sql.SQLException: Out of range value for column 'test' : value 33.3333 is not in Integer range at :: Caused by: java.sql.SQLException: Out of range value for column 'test' : value 33.3333 is not in Integer range at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.parseInt(SelectResultSet.java:3440) at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.getInternalInt(SelectResultSet.java:1075) at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.getInt(SelectResultSet.java:1054) at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.getInt(SelectResultSet.java:1061) When run on Driver 1.x: Results: 33. 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 an Exception. |
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; +---------+ | test | +---------+ | 33.3333 | +---------+ 1 row in set (0.00 sec) When run through the Driver v1.6.1: Exception in thread "main" java.lang.RuntimeException: java.sql.SQLException: Out of range value for column 'test' : value 33.3333 is not in Integer range at :: Caused by: java.sql.SQLException: Out of range value for column 'test' : value 33.3333 is not in Integer range at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.parseInt(SelectResultSet.java:3440) at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.getInternalInt(SelectResultSet.java:1075) at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.getInt(SelectResultSet.java:1054) at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.getInt(SelectResultSet.java:1061) When run on Driver 1.x: Results: 33. 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 an Exception. |
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; +---------+ | test | +---------+ | 33.3333 | +---------+ 1 row in set (0.00 sec) When run through the Driver v1.6.1: Exception in thread "main" java.lang.RuntimeException: java.sql.SQLException: Out of range value for column 'test' : value 33.3333 is not in Integer range at :: Caused by: java.sql.SQLException: Out of range value for column 'test' : value 33.3333 is not in Integer range at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.parseInt(SelectResultSet.java:3440) at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.getInternalInt(SelectResultSet.java:1075) at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.getInt(SelectResultSet.java:1054) at org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet.getInt(SelectResultSet.java:1061) When run on Driver 1.x: Results: 33. 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. |
Fix Version/s | 2.0.3 [ 22559 ] | |
Fix Version/s | 1.6.2 [ 22560 ] |
Status | Open [ 1 ] | In Progress [ 3 ] |
Resolution | Fixed [ 1 ] | |
Status | In Progress [ 3 ] | Closed [ 6 ] |
Resolution | Fixed [ 1 ] | |
Status | Closed [ 6 ] | Stalled [ 10000 ] |
Fix Version/s | 1.6.4 [ 22561 ] | |
Fix Version/s | 2.1.0 [ 22528 ] | |
Fix Version/s | 2.0.3 [ 22559 ] | |
Fix Version/s | 1.6.2 [ 22560 ] |
Fix Version/s | 1.6.3 [ 22562 ] | |
Fix Version/s | 1.6.4 [ 22561 ] |
Affects Version/s | 1.6.2 [ 22560 ] |
Affects Version/s | 2.0.3 [ 22559 ] |
Resolution | Fixed [ 1 ] | |
Status | Stalled [ 10000 ] | Closed [ 6 ] |
Workflow | MariaDB v3 [ 81322 ] | MariaDB v4 [ 134996 ] |
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:
}
}
}
}