Skip to content

Commit

Permalink
Merge pull request #198 from taosdata/fix/TD-32693
Browse files Browse the repository at this point in the history
fix native resultset get int on float type error
  • Loading branch information
sheyanjie-qq authored Oct 27, 2024
2 parents 48a4485 + 7ea4be8 commit 51ba2ef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/com/taosdata/jdbc/TSDBResultSetBlockData.java
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,9 @@ public int getInt(int col) throws SQLException {
return ((Long) ((Timestamp) obj).getTime()).intValue();
}

case TSDB_DATA_TYPE_FLOAT:
case TSDB_DATA_TYPE_FLOAT:{
return ((Float) obj).intValue();
}
case TSDB_DATA_TYPE_DOUBLE: {
return ((Double) obj).intValue();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ public void getInt() throws SQLException {
Assert.assertEquals(1, f2);
f2 = rs.getInt(2);
Assert.assertEquals(1, f2);

f2 = rs.getInt(4);
Assert.assertEquals(3, f2);
}

@Test
Expand Down

0 comments on commit 51ba2ef

Please sign in to comment.