Skip to content

Commit

Permalink
add large decimal test
Browse files Browse the repository at this point in the history
  • Loading branch information
stepansergeevitch committed Jan 30, 2025
1 parent 3d6a82e commit b7e5b31
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/integrationTest/java/integration/tests/NumericTypesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import integration.IntegrationTest;
import org.junit.jupiter.api.Test;

import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
Expand All @@ -21,4 +22,15 @@ void shouldHaveCorrectInfo() throws SQLException {
assertEquals(38, resultSet.getMetaData().getPrecision(1));
}
}

@Test
void shouldHandleLargeDecimals() throws SQLException {
String sql = "SELECT 12345678901234567890123456789.123456789::decimal(38, 9);";
try (Connection connection = createConnection(null);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(sql)) {
resultSet.next();
assertEquals(new BigDecimal("12345678901234567890123456789.123456789"), resultSet.getBigDecimal(1));
}
}
}

0 comments on commit b7e5b31

Please sign in to comment.