|
7 | 7 | import static org.assertj.core.data.Offset.offset; |
8 | 8 |
|
9 | 9 | import java.io.ByteArrayInputStream; |
| 10 | +import java.math.BigDecimal; |
10 | 11 | import java.nio.charset.StandardCharsets; |
11 | 12 | import java.sql.Connection; |
12 | 13 | import java.sql.Date; |
@@ -830,4 +831,46 @@ public void gh914_reuseExecute() throws SQLException { |
830 | 831 | assertThat(rs2).isNotNull(); |
831 | 832 | } |
832 | 833 | } |
| 834 | + |
| 835 | + @Test |
| 836 | + public void gh1002_pi() throws SQLException { |
| 837 | + BigDecimal pi = new BigDecimal("3.14"); |
| 838 | + stat.executeUpdate("create table gh1002(nr number(10,2))"); |
| 839 | + |
| 840 | + try (PreparedStatement ps = conn.prepareStatement("insert into gh1002 values (?)")) { |
| 841 | + ps.setBigDecimal(1, pi); |
| 842 | + ps.execute(); |
| 843 | + } |
| 844 | + |
| 845 | + ResultSet rs = stat.executeQuery("select nr from gh1002"); |
| 846 | + assertThat(rs.getBigDecimal(1)).isEqualTo(pi); |
| 847 | + } |
| 848 | + |
| 849 | + @Test |
| 850 | + public void gh1002_pi_real() throws SQLException { |
| 851 | + BigDecimal pi = new BigDecimal("3.14"); |
| 852 | + stat.executeUpdate("create table gh1002(nr REAL)"); |
| 853 | + |
| 854 | + try (PreparedStatement ps = conn.prepareStatement("insert into gh1002 values (?)")) { |
| 855 | + ps.setBigDecimal(1, pi); |
| 856 | + ps.execute(); |
| 857 | + } |
| 858 | + |
| 859 | + ResultSet rs = stat.executeQuery("select nr from gh1002"); |
| 860 | + assertThat(rs.getBigDecimal(1)).isEqualTo(pi); |
| 861 | + } |
| 862 | + |
| 863 | + @Test |
| 864 | + public void gh1002_pi_text() throws SQLException { |
| 865 | + BigDecimal pi = new BigDecimal("3.14"); |
| 866 | + stat.executeUpdate("create table gh1002(nr TEXT)"); |
| 867 | + |
| 868 | + try (PreparedStatement ps = conn.prepareStatement("insert into gh1002 values (?)")) { |
| 869 | + ps.setBigDecimal(1, pi); |
| 870 | + ps.execute(); |
| 871 | + } |
| 872 | + |
| 873 | + ResultSet rs = stat.executeQuery("select nr from gh1002"); |
| 874 | + assertThat(rs.getBigDecimal(1)).isEqualTo(pi); |
| 875 | + } |
833 | 876 | } |
0 commit comments