AndreyUS opened a new issue #3231: Issue with data type "INT UNSIGNED"
URL: https://github.com/apache/incubator-shardingsphere/issues/3231
 
 
   ## Bug Report
   
   1. Create the table
   >CREATE TABLE IF NOT EXISTS `table_name` (
     `my_id` int(11) unsigned NOT NULL,
   ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
   2.  I'm trying to extract value: 
   > resultSet.getLong("my_id")
   
   Exception occurs: 
   
   > java.sql.SQLDataException: Value '4294967295' is outside of valid range 
for type java.lang.Integer
        at 
com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:114)
        at 
com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
        at 
com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
        at 
com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
        at 
com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73)
        at 
com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:92)
        at com.mysql.cj.jdbc.result.ResultSetImpl.getInt(ResultSetImpl.java:805)
        at 
com.zaxxer.hikari.pool.HikariProxyResultSet.getInt(HikariProxyResultSet.java)
        at 
org.apache.shardingsphere.core.execute.sql.execute.result.QueryResultUtil.getValueByColumnType(QueryResultUtil.java:59)
        at 
org.apache.shardingsphere.core.execute.sql.execute.result.QueryResultUtil.getValue(QueryResultUtil.java:45)
        at 
org.apache.shardingsphere.core.execute.sql.execute.result.StreamQueryResult.getValue(StreamQueryResult.java:75)
        at 
org.apache.shardingsphere.core.merge.dql.common.StreamMergedResult.getValue(StreamMergedResult.java:56)
        at 
org.apache.shardingsphere.shardingjdbc.jdbc.core.resultset.ShardingResultSet.getLong(ShardingResultSet.java:112)
   
   Version: Sharding-JDBC 4.0.0RC2
   
   It should extract value as Long.
   
   Mysql jdbc driver in MysqlType.java contains such declaration for it:
   > INT_UNSIGNED("INT UNSIGNED", Types.INTEGER, Long.class, 
MysqlType.FIELD_FLAG_UNSIGNED | MysqlType.FIELD_FLAG_ZEROFILL, 
MysqlType.IS_DECIMAL, 10L,
               "[(M)] [UNSIGNED] [ZEROFILL]"),
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to