Package com.clickhouse.jdbc
Class JdbcTypeMapping
java.lang.Object
com.clickhouse.jdbc.JdbcTypeMapping
This class defines mappings among
Types, JDBCType,
ClickHouseDataType, ClickHouseColumn, and Class. It
does not impact serialization and deserialization, which is handled
separately by ClickHouseDataProcessor.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic JdbcTypeMappingGets ANSI type mapping.protected Class<?>getCustomJavaClass(ClickHouseColumn column, Map<String, Class<?>> typeMap) Gets custom Java class for the given column.protected ClickHouseDataTypegetDataType(int sqlType) Gets correspondingClickHouseDataTypeof the givenTypes.static JdbcTypeMappingGets default type mapping.protected intgetSqlType(Class<?> javaClass) Gets correspondingTypesfor the given Java class.toColumn(int sqlType, int scaleOrLength) ConvertsTypesto ClickHouse column.ConvertsJDBCTypeto ClickHouse column.Class<?>toJavaClass(ClickHouseColumn column, Map<String, Class<?>> typeMap) ConvertsClickHouseColumntoClass.toNativeType(ClickHouseColumn column) ConvertsClickHouseColumnto native type.inttoSqlType(ClickHouseColumn column, Map<String, Class<?>> typeMap) ConvertsClickHouseColumnto generic SQL type defined in JDBC.
-
Constructor Details
-
JdbcTypeMapping
public JdbcTypeMapping()
-
-
Method Details
-
getDefaultMapping
Gets default type mapping.- Returns:
- non-null type mapping
-
getAnsiMapping
Gets ANSI type mapping.- Returns:
- non-null type mapping
-
getCustomJavaClass
Gets custom Java class for the given column.- Parameters:
column- non-null column definitiontypeMap- column type to Java class map, could be null- Returns:
- custom Java class which may or may not be null
-
getDataType
Gets correspondingClickHouseDataTypeof the givenTypes.- Parameters:
sqlType- generic SQL types defined in JDBC- Returns:
- non-null ClickHouse data type
-
getSqlType
Gets correspondingTypesfor the given Java class.- Parameters:
javaClass- non-null Java class- Returns:
- generic SQL type defined in JDBC
-
toColumn
ConvertsJDBCTypeto ClickHouse column.- Parameters:
jdbcType- JDBC typescaleOrLength- scale or length- Returns:
- non-null ClickHouse column
-
toColumn
ConvertsTypesto ClickHouse column.- Parameters:
sqlType- generic SQL types defined in JDBCscaleOrLength- scale or length- Returns:
- non-null ClickHouse column
-
toJavaClass
ConvertsClickHouseColumntoClass.- Parameters:
column- non-null column definitiontypeMap- optional custom type mapping- Returns:
- non-null Java class
-
toNativeType
ConvertsClickHouseColumnto native type.- Parameters:
column- non-null column definition- Returns:
- non-null native type
-
toSqlType
ConvertsClickHouseColumnto generic SQL type defined in JDBC.- Parameters:
column- non-null column definitiontypeMap- optional custom mapping- Returns:
- generic SQL type defined in JDBC
-