Class JdbcTypeConverter

java.lang.Object
org.firebirdsql.jdbc.field.JdbcTypeConverter

@InternalApi @NullMarked public final class JdbcTypeConverter extends Object
Helper class to convert from Firebird and metadata type information to JDBC type information.
Since:
3.0
Author:
Mark Rotteveel
  • Method Details

    • toJdbcType

      public static int toJdbcType(FieldDescriptor fieldDescriptor)
      Gets the JDBC type value from Types for the field descriptor.
      Parameters:
      fieldDescriptor - Field descriptor
      Returns:
      JDBC type, or Types.OTHER for unknown types
    • isJdbcType

      public static boolean isJdbcType(FieldDescriptor fieldDescriptor, int jdbcType)
      Determines if a field descriptor matches a JDBC type value from Types.
      Parameters:
      fieldDescriptor - Field descritpor
      jdbcType - JDBC type
      Returns:
      true if the field descriptor and JDBC type are equivalent (using toJdbcType(FieldDescriptor))
    • fromFirebirdToJdbcType

      public static int fromFirebirdToJdbcType(int firebirdType, int subtype, int scale)
      Converts from the Firebird type, subtype and scale to the JDBC type value from Types.

      This method is not capable of identifying Types.ROWID; this will be identified as Types.BINARY instead.

      Parameters:
      firebirdType - Firebird type value (from ISCConstants SQL_* with or without nullable bit set
      subtype - Subtype
      scale - Scale
      Returns:
      JDBC type, or Types.OTHER for unknown types
    • fromMetaDataToJdbcType

      public static int fromMetaDataToJdbcType(int metaDataType, int subtype, int scale)
      Converts from the metadata type (as used in the system tables) to JDBC type values from Types.
      Parameters:
      metaDataType - Metadata type value
      subtype - Subtype
      scale - Scale
      Returns:
      JDBC type, or Types.OTHER for unknown types
    • fromMetaDataToFirebirdType

      public static int fromMetaDataToFirebirdType(int metaDataType)
      Converts the metadata type value to the Firebird type value (null bit not set).
      Parameters:
      metaDataType - Metadata type value
      Returns:
      Firebird type value
    • getTypeName

      public static String getTypeName(int jdbcType, int firebirdType, int subtype, int scale)