Interface TypeDescriptor

  • All Known Implementing Classes:
    TypeDescriptorImpl

    public interface TypeDescriptor
    TypeDescriptor represents a type in a system catalog, a persistent type. Examples are columns in tables and parameters for routines. A TypeDescriptor is immutable.
    • Field Detail

      • MAXIMUM_WIDTH_UNKNOWN

        static final int MAXIMUM_WIDTH_UNKNOWN
        The return value from getMaximumWidth() for types where the maximum width is unknown.
        See Also:
        Constant Field Values
      • INTEGER

        static final TypeDescriptor INTEGER
        Catalog type for nullable INTEGER
      • INTEGER_NOT_NULL

        static final TypeDescriptor INTEGER_NOT_NULL
        Catalog type for not nullable INTEGER
      • SMALLINT

        static final TypeDescriptor SMALLINT
        Catalog type for nullable SMALLINT
      • SMALLINT_NOT_NULL

        static final TypeDescriptor SMALLINT_NOT_NULL
        Catalog type for not nullable INTEGER
      • DOUBLE

        static final TypeDescriptor DOUBLE
        Catalog type for nullable DOUBLE
    • Method Detail

      • getJDBCTypeId

        int getJDBCTypeId()
        Get the jdbc type id for this type. JDBC type can be found in java.sql.Types.
        Returns:
        a jdbc type, e.g. java.sql.Types.DECIMAL
        See Also:
        Types
      • getMaximumWidth

        int getMaximumWidth()
        Returns the maximum width of the type. This may have different meanings for different types. For example, with char, it means the maximum number of characters, while with int, it is the number of bytes (i.e. 4).
        Returns:
        the maximum length of this Type; -1 means "unknown/no max length"
      • getMaximumWidthInBytes

        int getMaximumWidthInBytes()
        Returns the maximum width of the type IN BYTES. This is the maximum number of bytes that could be returned for this type if the corresponding getXXX() method is used. For example, if we have a CHAR type, then we want the number of bytes that would be returned by a ResultSet.getString() call.
        Returns:
        the maximum length of this Type IN BYTES; -1 means "unknown/no max length"
      • getPrecision

        int getPrecision()
        Returns the number of decimal digits for the type, if applicable.
        Returns:
        The number of decimal digits for the type. Returns zero for non-numeric types.
      • getScale

        int getScale()
        Returns the number of digits to the right of the decimal for the type, if applicable.
        Returns:
        The number of digits to the right of the decimal for the type. Returns zero for non-numeric types.
      • isNullable

        boolean isNullable()
        Gets the nullability that values of this type have.
        Returns:
        true if values of this type may be null. false otherwise
      • getTypeName

        java.lang.String getTypeName()
        Gets the name of this type.
        Returns:
        the name of this type
      • getSQLstring

        java.lang.String getSQLstring()
        Converts this type descriptor (including length/precision) to a string suitable for appearing in a SQL type specifier. E.g. VARCHAR(30) or java.util.Hashtable
        Returns:
        String version of type, suitable for running through a SQL Parser.
      • getCollationType

        int getCollationType()
        Get the collation type for this type. This api applies only to character string types. And its return value is valid only if the collation derivation of this type is "implicit" or "explicit". (In Derby 10.3, collation derivation can't be "explicit". Hence in Derby 10.3, this api should be used only if the collation derivation is "implicit".
        Returns:
        collation type which applies to character string types with collation derivation of "implicit" or "explicit". The possible return values in Derby 10.3 will be COLLATION_TYPE_UCS_BASIC and COLLATION_TYPE_TERRITORY_BASED.
        See Also:
        StringDataValue.COLLATION_TYPE_UCS_BASIC, StringDataValue.COLLATION_TYPE_TERRITORY_BASED
      • isRowMultiSet

        boolean isRowMultiSet()
        Return true if this is a Row Multiset type
      • isUserDefinedType

        boolean isUserDefinedType()
        Return true if this is a user defined type
      • getRowTypes

        TypeDescriptor[] getRowTypes()
        If this catalog type is a row multi-set type then return its array of catalog types.
        Returns:
        Catalog ypes comprising the row, null if this is not a row type.
      • getRowColumnNames

        java.lang.String[] getRowColumnNames()
        If this catalog type is a row multi-set type then return its array of column names.
        Returns:
        Column names comprising the row, null if this is not a row type.