Skip to content

Commit

Permalink
Merge pull request #40 from jumpserver/pr@dev@fix_bigdecimal_loss
Browse files Browse the repository at this point in the history
fix: 修复大数导致的精度丢失问题
  • Loading branch information
Aaron3S authored Sep 13, 2024
2 parents 89662b4 + e499de3 commit a731cca
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.jumpserver.chen.framework.utils.PageUtils;
import org.jumpserver.chen.framework.utils.ReflectUtils;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.*;
import java.util.ArrayList;
Expand Down Expand Up @@ -160,13 +161,11 @@ private void executeStatement(SQLExecutePlan plan, Statement statement, SQLQuery
var obj = resultSet.getObject(i);
if (obj instanceof Timestamp timestamp) {
fs.add(new Date(timestamp.getTime()));
} else if (obj instanceof Long l) {
fs.add(l.toString());
} else if (obj instanceof BigInteger b) {
fs.add(b.toString());
} else if (obj instanceof Long || obj instanceof BigDecimal || obj instanceof BigInteger) {
fs.add(obj.toString());
} else if (obj instanceof byte[]) {
fs.add(HexUtils.bytesToHex((byte[]) obj));
}else if (obj instanceof Blob){
} else if (obj instanceof Blob) {
fs.add(HexUtils.bytesToHex(((Blob) obj).getBytes(1, (int) ((Blob) obj).length())));
} else {
fs.add(obj);
Expand Down

0 comments on commit a731cca

Please sign in to comment.