From 3a28431d2089a7665208ce4c282b3291d8a57595 Mon Sep 17 00:00:00 2001 From: Zhichun Wu Date: Sat, 5 Mar 2022 20:17:09 +0800 Subject: [PATCH] Fix test failure on CH older than 22.1 --- .../jdbc/ClickHousePreparedStatementTest.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/clickhouse-jdbc/src/test/java/com/clickhouse/jdbc/ClickHousePreparedStatementTest.java b/clickhouse-jdbc/src/test/java/com/clickhouse/jdbc/ClickHousePreparedStatementTest.java index 9590914db..fe8fbeaca 100644 --- a/clickhouse-jdbc/src/test/java/com/clickhouse/jdbc/ClickHousePreparedStatementTest.java +++ b/clickhouse-jdbc/src/test/java/com/clickhouse/jdbc/ClickHousePreparedStatementTest.java @@ -88,13 +88,11 @@ private void checkTable(Statement stmt, String query, String[] results) throws S public void testReadWriteBool() throws SQLException { try (ClickHouseConnection conn = newConnection(new Properties()); Statement s = conn.createStatement(); - PreparedStatement stmt = conn.prepareStatement("insert into test_read_write_bool values(?,?)")) { - s.execute("drop table if exists test_read_write_bool"); - try { - s.execute("create table test_read_write_bool(id Int32, b Bool)engine=Memory"); - } catch (SQLException e) { - s.execute("create table test_read_write_bool(id Int32, b UInt8)engine=Memory"); - } + PreparedStatement stmt = conn.prepareStatement( + "insert into test_read_write_bool select c1, c2 from input('c1 Int32, c2 Bool')")) { + s.execute("drop table if exists test_read_write_bool; " + + "create table test_read_write_bool(id Int32, b Bool)engine=Memory"); + stmt.setInt(1, 1); stmt.setBoolean(2, true); stmt.addBatch();