Class JdbcTypeMapper

java.lang.Object
com.illumon.iris.utils.JdbcTypeMapper

public class JdbcTypeMapper
extends Object
  • Constructor Details

  • 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 information
      columnName - 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 mappings
      metaData - a JDBC ResultSetMetaData object that will provide the SQL type information
      columnName - 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 information
      columnName - the name of the JDBC ResultSet column
      deephavenDataType - 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 information
      columnName - the name of the JDBC ResultSet column
      deephavenDataType - if not null, the desired Deephaven target data type
      throwException - 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 mappings
      metaData - a JDBC ResultSetMetaData object that will provide the SQL type information
      column - the JDBC ResultSetMetaData column index
      deephavenDataType - 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 mappings
      rs - the JDBC ResultSet
      columnName - the column for which to find a type match
      deephavenDataType - if not null, the desired Deephaven target data type
      throwException - 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 mappings
      type - the SQL type
      deephavenDataType - 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 mappings
      type - the SQL type
      deephavenDataType - the column type, if known. If null, the default type mapping will be provided
      throwException - 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