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 class
JdbcTypeMapper.BooleanDataTypeMapping
static class
JdbcTypeMapper.ByteArrayDataTypeMapping
static class
JdbcTypeMapper.ByteDataTypeMapping
static class
JdbcTypeMapper.CharDataTypeMapping
static interface
JdbcTypeMapper.ColumnSourceBinder
A closure that can be used to bind a ColumnSource to the given PreparedStatement and parameter index.static class
JdbcTypeMapper.Context
A catch-all bucket for settings used when converting Deephaven column values to and from JDBC values.static class
JdbcTypeMapper.DataTypeMapping<T>
An abstraction for mapping a JDBC type to an Deephaven column type.static class
JdbcTypeMapper.DateDBDateTimeDataTypeMapping
static class
JdbcTypeMapper.DateLocalDateDataTypeMapping
static class
JdbcTypeMapper.DateYearDataTypeMapping
static class
JdbcTypeMapper.DecimalDataTypeMapping
static class
JdbcTypeMapper.DecimalToDoubleDataTypeMapping
Provides a SQL decimal/numeric to double precision Deephaven type mappingstatic class
JdbcTypeMapper.DecimalToFloatDataTypeMapping
Provides a mapping from SQL decimal/numeric to Deephaven BigDecimal type.static class
JdbcTypeMapper.DoubleDataTypeMapping
static class
JdbcTypeMapper.DoubleToDecimalDataTypeMapping
A mapping that converts SQL double precision floating point to Deephaven BigDecimalstatic class
JdbcTypeMapper.FloatDataTypeMapping
static class
JdbcTypeMapper.FloatToDecimalDataTypeMapping
A mapping that converts SQL single precision floating point to Deephaven BigDecimalstatic class
JdbcTypeMapper.IntDataTypeMapping
static class
JdbcTypeMapper.LongDataTypeMapping
static class
JdbcTypeMapper.ShortDataTypeMapping
static class
JdbcTypeMapper.StringDataTypeMapping
static class
JdbcTypeMapper.StringDoubleArrayDataTypeMapping
A mapping for backward compatibility, converts a string column to a double array with a specified delimiterstatic class
JdbcTypeMapper.StringLongArrayDataTypeMapping
A mapping for backward compatibility, converts a string column to a long array with a specified delimiterstatic class
JdbcTypeMapper.TimeDataTypeMappingBase<T>
static class
JdbcTypeMapper.TimeLocalTimeDataTypeMapping
static class
JdbcTypeMapper.TimeNanosDataTypeMapping
static class
JdbcTypeMapper.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.DataTypeMapping
getDefaultColumnTypeMapping(Connection connection, ResultSetMetaData metaData, String columnName)
Get the default type mapping for converting JDBC/SQL values to/from a Deephaven column type.static JdbcTypeMapper.DataTypeMapping
getDefaultColumnTypeMapping(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
-