stoty commented on a change in pull request #150:
URL: https://github.com/apache/calcite-avatica/pull/150#discussion_r694982141
##########
File path:
server/src/test/java/org/apache/calcite/avatica/remote/RemoteMetaTest.java
##########
@@ -481,6 +483,38 @@ private static String longString(String fragment, int
length) {
}
}
+ @Test public void testBigDecimalTest() throws Exception {
+ final String tableName = "testbigdecimal";
+ try (Connection conn = DriverManager.getConnection(url);
+ Statement stmt = conn.createStatement()) {
+ conn.setAutoCommit(false);
+ stmt.execute("DROP TABLE IF EXISTS " + tableName);
+ stmt.execute("CREATE TABLE " + tableName + " ("
+ + "pk VARCHAR NOT NULL PRIMARY KEY, "
+ + "v1 DECIMAL(10,5))");
+ conn.commit();
+ try (PreparedStatement pstmt = conn.prepareStatement("INSERT INTO "
+ + tableName + " values(?, ?)")) {
+ pstmt.setString(1, "1");
+ pstmt.setBigDecimal(2, new BigDecimal("12345.67890"));
+ assertEquals(1, pstmt.executeUpdate());
+
+ pstmt.setString(1, "2");
+ pstmt.setObject(2, new BigDecimal("12345.67890"));
+ assertEquals(1, pstmt.executeUpdate());
+
+ pstmt.setString(1, "3");
+ pstmt.setObject(2, new BigDecimal("12345.67890"), Types.NUMERIC);
+ assertEquals(1, pstmt.executeUpdate());
+
+ pstmt.setString(1, "4");
+ pstmt.setObject(2, new BigDecimal("12345.67890"), Types.DECIMAL);
+ assertEquals(1, pstmt.executeUpdate());
+ }
+ conn.commit();
Review comment:
Sure, I'll add that tomorrow.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]