|
1 | 1 | package com.clickhouse.jdbc; |
2 | 2 |
|
3 | 3 | import com.clickhouse.client.api.data_formats.internal.BinaryStreamReader; |
| 4 | +import org.apache.commons.lang3.RandomStringUtils; |
4 | 5 | import org.testng.annotations.Ignore; |
5 | 6 | import org.testng.annotations.Test; |
6 | 7 |
|
@@ -281,16 +282,24 @@ void testWithClause() throws Exception { |
281 | 282 | @Test(groups = { "integration" }) |
282 | 283 | void testInsert() throws Exception { |
283 | 284 | int ROWS = 100000; |
| 285 | + String payload = RandomStringUtils.random(1024, true, true); |
284 | 286 | try (Connection conn = getJdbcConnection()) { |
285 | 287 | for (int j = 0; j < 10; j++) { |
286 | 288 | try (Statement stmt = conn.createStatement()) { |
287 | | - stmt.execute("CREATE TABLE insert_batch (`id` UInt32, `name` String) ENGINE = Memory"); |
| 289 | + stmt.execute("CREATE TABLE insert_batch ( `off16` Int16, `str` String, `p_int8` Int8, `p_int16` Int16, `p_int32` Int32, `p_int64` Int64, `p_float32` Float32, `p_float64` Float64, `p_bool` Bool) ENGINE = Memory"); |
288 | 290 | } |
289 | | - String insertQuery = "INSERT INTO insert_batch (id, name) VALUES (?,?)"; |
| 291 | + String insertQuery = "INSERT INTO insert_batch (off16, str, p_int8, p_int16, p_int32, p_int64, p_float32, p_float64, p_bool) VALUES (?,?,?,?,?,?,?,?,?)"; |
290 | 292 | try (PreparedStatement stmt = conn.prepareStatement(insertQuery)) { |
291 | 293 | for (int i = 0; i < ROWS; i++) { |
292 | | - stmt.setInt(1, i); |
293 | | - stmt.setString(2, "name" + i); |
| 294 | + stmt.setShort(1, (short) i); |
| 295 | + stmt.setString(2, payload); |
| 296 | + stmt.setByte(3, (byte)i); |
| 297 | + stmt.setShort(4, (short)i); |
| 298 | + stmt.setInt(5, i); |
| 299 | + stmt.setLong(6, (long)i); |
| 300 | + stmt.setFloat(7, (float)(i*0.1)); |
| 301 | + stmt.setDouble(8, (double)(i*0.1)); |
| 302 | + stmt.setBoolean(9, true); |
294 | 303 | stmt.addBatch(); |
295 | 304 | } |
296 | 305 | long startBatchTime = System.currentTimeMillis(); |
|
0 commit comments