Skip to content

Commit fb9cc45

Browse files
author
Paultagoras
committed
Using the type passed
1 parent 6c00dbb commit fb9cc45

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

jdbc-v2/src/main/java/com/clickhouse/jdbc/ConnectionImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.clickhouse.client.api.ClientConfigProperties;
55
import com.clickhouse.client.api.query.GenericRecord;
66
import com.clickhouse.client.api.query.QuerySettings;
7+
import com.clickhouse.data.ClickHouseDataType;
78
import com.clickhouse.jdbc.internal.ClientInfoProperties;
89
import com.clickhouse.jdbc.internal.JdbcConfiguration;
910
import com.clickhouse.jdbc.internal.ExceptionUtils;
@@ -483,8 +484,7 @@ public Properties getClientInfo() throws SQLException {
483484
@Override
484485
public Array createArrayOf(String typeName, Object[] elements) throws SQLException {
485486
try {
486-
// TODO: pass type name
487-
return new com.clickhouse.jdbc.types.Array(List.of(elements), "", Types.OTHER);
487+
return new com.clickhouse.jdbc.types.Array(List.of(elements), typeName, JdbcUtils.convertToSqlType(ClickHouseDataType.valueOf(typeName)));
488488
} catch (Exception e) {
489489
throw new SQLException("Failed to create array", ExceptionUtils.SQL_STATE_CLIENT_ERROR, e);
490490
}

jdbc-v2/src/test/java/com/clickhouse/jdbc/ConnectionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public void setAndGetClientInfoTest() throws SQLException {
246246
@Test(groups = { "integration" })
247247
public void createArrayOfTest() throws SQLException {
248248
Connection localConnection = this.getJdbcConnection();
249-
Array array = localConnection.createArrayOf("type-name", new Object[] { 1, 2, 3 });
249+
Array array = localConnection.createArrayOf("Int8", new Object[] { 1, 2, 3 });
250250
Assert.assertNotNull(array);
251251
Assert.assertEquals(array.getArray(), new Object[] { 1, 2, 3 });
252252
}

0 commit comments

Comments
 (0)