Skip to content

Commit

Permalink
fix native resultset get int on float type error
Browse files Browse the repository at this point in the history
  • Loading branch information
sheyanjie-qq committed Oct 27, 2024
1 parent 48a4485 commit 7ea4be8
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 7ea4be8

Please sign in to comment.