Skip to content

Commit 0fdaafa

Browse files
committed
Pin datatype to custom connection type
1 parent 24364f9 commit 0fdaafa

1 file changed

Lines changed: 5 additions & 12 deletions

File tree

jdbc-v2/src/main/java/com/clickhouse/jdbc/metadata/ResultSetMetaDataImpl.java

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ private static List<ColumnTypeBinding> buildColumnTypeBindings(List<ClickHouseCo
7272
columnClass = defaultClass != null ? defaultClass : Object.class;
7373
columnType = jdbcType.getVendorTypeNumber();
7474
}
75-
bindings.add(new ColumnTypeBinding(column, jdbcType, defaultClass, columnType, columnClass));
75+
bindings.add(new ColumnTypeBinding(column, jdbcType, columnType, columnClass));
7676
}
7777
return bindings.build();
7878
}
@@ -86,15 +86,12 @@ private static List<ColumnTypeBinding> buildColumnTypeBindings(List<ClickHouseCo
8686
private static final class ColumnTypeBinding {
8787
private final ClickHouseColumn column;
8888
private final SQLType jdbcType;
89-
private final Class<?> defaultClass;
9089
private final int columnType;
9190
private final Class<?> columnClass;
9291

93-
ColumnTypeBinding(ClickHouseColumn column, SQLType jdbcType, Class<?> defaultClass,
94-
int columnType, Class<?> columnClass) {
92+
ColumnTypeBinding(ClickHouseColumn column, SQLType jdbcType, int columnType, Class<?> columnClass) {
9593
this.column = column;
9694
this.jdbcType = jdbcType;
97-
this.defaultClass = defaultClass;
9895
this.columnType = columnType;
9996
this.columnClass = columnClass;
10097
}
@@ -111,10 +108,6 @@ public Class<?> getColumnClass() {
111108
return columnClass;
112109
}
113110

114-
public Class<?> getDefaultClass() {
115-
return defaultClass;
116-
}
117-
118111
public int getColumnType() {
119112
return columnType;
120113
}
@@ -160,12 +153,12 @@ public Class<?> resolveColumnClass(String columnName, Map<String, Class<?>> type
160153
}
161154

162155
if (typeMap == null || typeMap.isEmpty()) {
163-
return binding.getDefaultClass();
156+
return binding.getColumnClass();
164157
}
165158

166159
Class<?> resolved = typeMap.get(dataType.name());
167160
if (resolved == null) {
168-
resolved = typeMap.getOrDefault(binding.getJdbcType().getName(), binding.getDefaultClass());
161+
resolved = typeMap.getOrDefault(binding.getJdbcType().getName(), binding.getColumnClass());
169162
}
170163
return resolved;
171164
}
@@ -268,7 +261,7 @@ public String getCatalogName(int column) throws SQLException {
268261

269262
@Override
270263
public int getColumnType(int column) throws SQLException {
271-
return getColumnTypeBinding(column).columnType;
264+
return getColumnTypeBinding(column).getColumnType();
272265
}
273266

274267
@Override

0 commit comments

Comments
 (0)