@@ -136,6 +136,9 @@ public void testMaxFloatValues() throws SQLException {
136
136
public void testMutation () throws SQLException {
137
137
Properties props = new Properties ();
138
138
try (ClickHouseConnection conn = newConnection (props ); ClickHouseStatement stmt = conn .createStatement ()) {
139
+ Assert .assertEquals (stmt .executeBatch (), new int [0 ]);
140
+ Assert .assertEquals (stmt .executeLargeBatch (), new long [0 ]);
141
+
139
142
Assert .assertFalse (stmt .execute ("drop table if exists test_mutation;"
140
143
+ "create table test_mutation(a String, b UInt32) engine=MergeTree() order by tuple()" ),
141
144
"Should not return result set" );
@@ -156,6 +159,9 @@ public void testMutation() throws SQLException {
156
159
stmt .addBatch ("drop table non_existing_table" );
157
160
stmt .addBatch ("insert into test_mutation values('2',2)" );
158
161
Assert .assertThrows (SQLException .class , () -> stmt .executeBatch ());
162
+
163
+ Assert .assertEquals (stmt .executeBatch (), new int [0 ]);
164
+ Assert .assertEquals (stmt .executeLargeBatch (), new long [0 ]);
159
165
}
160
166
161
167
props .setProperty (JdbcConfig .PROP_CONTINUE_BATCH , "true" );
@@ -269,7 +275,12 @@ public void testExecute() throws SQLException {
269
275
public void testExecuteBatch () throws SQLException {
270
276
Properties props = new Properties ();
271
277
try (Connection conn = newConnection (props ); Statement stmt = conn .createStatement ()) {
272
- Assert .assertThrows (SQLException .class , () -> stmt .executeBatch ());
278
+ Assert .assertEquals (stmt .executeBatch (), new int [0 ]);
279
+ Assert .assertEquals (stmt .executeLargeBatch (), new long [0 ]);
280
+ stmt .addBatch ("select 1" );
281
+ stmt .clearBatch ();
282
+ Assert .assertEquals (stmt .executeBatch (), new int [0 ]);
283
+ Assert .assertEquals (stmt .executeLargeBatch (), new long [0 ]);
273
284
stmt .addBatch ("select 1" );
274
285
// mixed usage
275
286
Assert .assertThrows (SQLException .class , () -> stmt .execute ("select 2" ));
0 commit comments