提交 7761f5dc 编写于 作者: 杨翊 Sion Yang 提交者: Liang Zhang

Fix #3027 get TINYINT and SMALLINT as INTEGER (#3028)

上级 17410b98
......@@ -52,9 +52,7 @@ public final class QueryResultUtil {
case Types.BOOLEAN:
return resultSet.getBoolean(columnIndex);
case Types.TINYINT:
return resultSet.getByte(columnIndex);
case Types.SMALLINT:
return resultSet.getShort(columnIndex);
case Types.INTEGER:
return resultSet.getInt(columnIndex);
case Types.BIGINT:
......
......@@ -74,15 +74,15 @@ public final class QueryResultUtilTest {
@Test
public void assertGetValueByTinyint() throws SQLException {
when(resultSetMetaData.getColumnType(1)).thenReturn(Types.TINYINT);
when(resultSet.getByte(1)).thenReturn(Byte.MAX_VALUE);
assertThat((byte) QueryResultUtil.getValue(resultSet, 1), is(Byte.MAX_VALUE));
when(resultSet.getInt(1)).thenReturn(Integer.MAX_VALUE);
assertThat((int) QueryResultUtil.getValue(resultSet, 1), is(Integer.MAX_VALUE));
}
@Test
public void assertGetValueBySmallint() throws SQLException {
when(resultSetMetaData.getColumnType(1)).thenReturn(Types.SMALLINT);
when(resultSet.getShort(1)).thenReturn(Short.MAX_VALUE);
assertThat((short) QueryResultUtil.getValue(resultSet, 1), is(Short.MAX_VALUE));
when(resultSet.getInt(1)).thenReturn(Integer.MAX_VALUE);
assertThat((int) QueryResultUtil.getValue(resultSet, 1), is(Integer.MAX_VALUE));
}
@Test
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册