Package com.illumon.iris.utils
Class JdbcTypeMapper
java.lang.Object
com.illumon.iris.utils.JdbcTypeMapper
public class JdbcTypeMapper extends Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJdbcTypeMapper.BooleanDataTypeMappingstatic classJdbcTypeMapper.ByteArrayDataTypeMappingstatic classJdbcTypeMapper.ByteDataTypeMappingstatic classJdbcTypeMapper.CharDataTypeMappingstatic interfaceJdbcTypeMapper.ColumnSourceBinderA closure that can be used to bind a ColumnSource to the given PreparedStatement and parameter index.static classJdbcTypeMapper.ContextA catch-all bucket for settings used when converting Deephaven column values to and from JDBC values.static classJdbcTypeMapper.DataTypeMapping<T>An abstraction for mapping a JDBC type to an Deephaven column type.static classJdbcTypeMapper.DateDBDateTimeDataTypeMappingstatic classJdbcTypeMapper.DateLocalDateDataTypeMappingstatic classJdbcTypeMapper.DateYearDataTypeMappingstatic classJdbcTypeMapper.DecimalDataTypeMappingstatic classJdbcTypeMapper.DecimalToDoubleDataTypeMappingProvides a SQL decimal/numeric to double precision Deephaven type mappingstatic classJdbcTypeMapper.DecimalToFloatDataTypeMappingProvides a mapping from SQL decimal/numeric to Deephaven BigDecimal type.static classJdbcTypeMapper.DoubleDataTypeMappingstatic classJdbcTypeMapper.DoubleToDecimalDataTypeMappingA mapping that converts SQL double precision floating point to Deephaven BigDecimalstatic classJdbcTypeMapper.FloatDataTypeMappingstatic classJdbcTypeMapper.FloatToDecimalDataTypeMappingA mapping that converts SQL single precision floating point to Deephaven BigDecimalstatic classJdbcTypeMapper.IntDataTypeMappingstatic classJdbcTypeMapper.LongDataTypeMappingstatic classJdbcTypeMapper.ShortDataTypeMappingstatic classJdbcTypeMapper.StringDataTypeMappingstatic classJdbcTypeMapper.StringDoubleArrayDataTypeMappingA mapping for backward compatibility, converts a string column to a double array with a specified delimiterstatic classJdbcTypeMapper.StringLongArrayDataTypeMappingA mapping for backward compatibility, converts a string column to a long array with a specified delimiterstatic classJdbcTypeMapper.TimeDataTypeMappingBase<T>static classJdbcTypeMapper.TimeLocalTimeDataTypeMappingstatic classJdbcTypeMapper.TimeNanosDataTypeMappingstatic classJdbcTypeMapper.TimestampDBDateTimeDataTypeMapping -
Constructor Summary
Constructors Constructor Description JdbcTypeMapper() -
Method Summary
Modifier and Type Method Description static <T> JdbcTypeMapper.DataTypeMapping<T>getColumnTypeMapping(Class<? extends Connection> connClass, int type, Class<? extends T> deephavenDataType)Get type mapping for converting JDBC to/from Deephaven column type.static <T> JdbcTypeMapper.DataTypeMapping<T>getColumnTypeMapping(Class<? extends Connection> connClass, int type, Class<? extends T> deephavenDataType, boolean throwException)Get type mapping for converting JDBC to/from Deephaven column type.static <T> JdbcTypeMapper.DataTypeMapping<T>getColumnTypeMapping(Connection connection, ResultSetMetaData metaData, int column, Class<T> deephavenDataType)Get type mapping for converting JDBC to/from Deephaven column type.static <T> JdbcTypeMapper.DataTypeMapping<T>getColumnTypeMapping(Connection connection, ResultSetMetaData rs, String columnName, Class<T> deephavenDataType, boolean throwException)Get type mapping for converting JDBC to/from Deephaven column type.static <T> JdbcTypeMapper.DataTypeMapping<T>getColumnTypeMapping(ResultSet rs, String columnName, Class<T> deephavenDataType)Get type mapping for converting JDBC to/from Deephaven column type.static <T> JdbcTypeMapper.DataTypeMapping<T>getColumnTypeMapping(ResultSet rs, String columnName, Class<T> deephavenDataType, boolean throwException)Get type mapping for converting JDBC to/from Deephaven column type.static JdbcTypeMapper.DataTypeMappinggetDefaultColumnTypeMapping(Connection connection, ResultSetMetaData metaData, String columnName)Get the default type mapping for converting JDBC/SQL values to/from a Deephaven column type.static JdbcTypeMapper.DataTypeMappinggetDefaultColumnTypeMapping(ResultSet rs, String columnName)Get the default type mapping for converting JDBC/SQL values to/from a Deephaven column type.
-
Constructor Details
-
JdbcTypeMapper
public JdbcTypeMapper()
-
-
Method Details
-
getDefaultColumnTypeMapping
public static JdbcTypeMapper.DataTypeMapping getDefaultColumnTypeMapping(ResultSet rs, String columnName)Get the default type mapping for converting JDBC/SQL values to/from a Deephaven column type.- Parameters:
rs- JDBC ResultSet from which to extract type informationcolumnName- Name of the column- Returns:
- The default mapping for the specified column
-
getDefaultColumnTypeMapping
public static JdbcTypeMapper.DataTypeMapping getDefaultColumnTypeMapping(Connection connection, ResultSetMetaData metaData, String columnName)Get the default type mapping for converting JDBC/SQL values to/from a Deephaven column type.- Parameters:
connection- a JDBC Connection object, used to determine database-specific mappingsmetaData- a JDBC ResultSetMetaData object that will provide the SQL type informationcolumnName- the name of the JDBC ResultSet column- Returns:
- a mapping object that can be used to map SQL/JDBC ResultSet values to and from Deephaven column values
-
getColumnTypeMapping
public static <T> JdbcTypeMapper.DataTypeMapping<T> getColumnTypeMapping(ResultSet rs, String columnName, Class<T> deephavenDataType)Get type mapping for converting JDBC to/from Deephaven column type. If the target Deephaven type is not specified, a default will be used.- Type Parameters:
T- the target Deephaven type- Parameters:
rs- a JDBC ResultSet object that will provide the SQL type informationcolumnName- the name of the JDBC ResultSet columndeephavenDataType- if not null, the desired Deephaven target data type- Returns:
- a mapping object that can be used to map SQL/JDBC ResultSet values to and from Deephaven column values
-
getColumnTypeMapping
public static <T> JdbcTypeMapper.DataTypeMapping<T> getColumnTypeMapping(ResultSet rs, String columnName, Class<T> deephavenDataType, boolean throwException)Get type mapping for converting JDBC to/from Deephaven column type. If the target Deephaven type is not specified, a default will be used.- Type Parameters:
T- the target Deephaven type- Parameters:
rs- a JDBC ResultSet object that will provide the SQL type informationcolumnName- the name of the JDBC ResultSet columndeephavenDataType- if not null, the desired Deephaven target data typethrowException- if true, throw an exception if a mapping cannot be found. Otherwise, return null- Returns:
- a mapping object that can be used to map SQL/JDBC ResultSet values to and from Deephaven column values
-
getColumnTypeMapping
public static <T> JdbcTypeMapper.DataTypeMapping<T> getColumnTypeMapping(Connection connection, ResultSetMetaData metaData, int column, Class<T> deephavenDataType)Get type mapping for converting JDBC to/from Deephaven column type. If the target Deephaven type is not specified, a default will be used.- Type Parameters:
T- the target Deephaven type- Parameters:
connection- a JDBC Connection object, used to determine database-specific mappingsmetaData- a JDBC ResultSetMetaData object that will provide the SQL type informationcolumn- the JDBC ResultSetMetaData column indexdeephavenDataType- if not null, the desired Deephaven target data type- Returns:
- a mapping object that can be used to map SQL/JDBC ResultSet values to and from Deephaven column values
-
getColumnTypeMapping
public static <T> JdbcTypeMapper.DataTypeMapping<T> getColumnTypeMapping(Connection connection, ResultSetMetaData rs, String columnName, Class<T> deephavenDataType, boolean throwException)Get type mapping for converting JDBC to/from Deephaven column type. If the target Deephaven type is not specified, a default will be used.- Type Parameters:
T- the target Deephaven type- Parameters:
connection- a JDBC Connection object, used to determine database-specific mappingsrs- the JDBC ResultSetcolumnName- the column for which to find a type matchdeephavenDataType- if not null, the desired Deephaven target data typethrowException- if true, throw an exception if a mapping cannot be found. Otherwise, return null- Returns:
- a mapping object that can be used to map SQL/JDBC ResultSet values to and from Deephaven column values
-
getColumnTypeMapping
public static <T> JdbcTypeMapper.DataTypeMapping<T> getColumnTypeMapping(Class<? extends Connection> connClass, int type, Class<? extends T> deephavenDataType)Get type mapping for converting JDBC to/from Deephaven column type. If the target Deephaven type is not specified, a default will be used.- Type Parameters:
T- the target Deephaven type- Parameters:
connClass- a JDBC Connection subclass, used to determine database-specific mappingstype- the SQL typedeephavenDataType- if not null, the desired Deephaven target data type- Returns:
- a mapping object that can be used to map SQL/JDBC ResultSet values to and from Deephaven column values
-
getColumnTypeMapping
public static <T> JdbcTypeMapper.DataTypeMapping<T> getColumnTypeMapping(Class<? extends Connection> connClass, int type, Class<? extends T> deephavenDataType, boolean throwException)Get type mapping for converting JDBC to/from Deephaven column type. If the target Deephaven type is not specified, a default will be used.- Type Parameters:
T- the target Deephaven type- Parameters:
connClass- a JDBC Connection subclass, used to determine database-specific mappingstype- the SQL typedeephavenDataType- the column type, if known. If null, the default type mapping will be providedthrowException- if true, throw an exception if a mapping cannot be found. Otherwise, return null- Returns:
- a mapping object that can be used to map SQL/JDBC ResultSet values to and from Deephaven column values
-