Skip to content

Commit

Permalink
add integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
stepansergeevitch committed Feb 11, 2025
1 parent 73102dc commit 2ac39fa
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/integrationTest/java/integration/tests/ConnectionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,32 @@ void validatesOnSystemEngineIfParameterProvided() throws SQLException {

}

@Test
@Tag("v2")
void preparedStatementBatchesWorkIfMergeParameterProvided() throws SQLException {
String engineName = integration.ConnectionInfo.getInstance().getEngine();
try (Connection connection = createConnection(engineName, Map.of("merge_prepared_statement_batches", "true"))) {
try (Statement statement = connection.createStatement()) {
statement.executeUpdate("CREATE TABLE test_table (id INT)");
try (java.sql.PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO test_table VALUES (?)")) {
for (int i = 0; i < 10; i++) {
preparedStatement.setInt(1, i);
preparedStatement.addBatch();
}
preparedStatement.executeBatch();
}
try (ResultSet rs = statement.executeQuery("SELECT COUNT(*) FROM test_table")) {
assertTrue(rs.next());
assertEquals(10, rs.getInt(1));
}
} finally {
try (Statement statement = connection.createStatement()) {
statement.executeUpdate("DROP TABLE IF EXISTS test_table");
}
}
}
}

void unsuccessfulConnect(boolean useDatabase, boolean useEngine) throws SQLException {
ConnectionInfo params = integration.ConnectionInfo.getInstance();
String url = getJdbcUrl(params, useDatabase, useEngine);
Expand Down

0 comments on commit 2ac39fa

Please sign in to comment.