Documentation of 'org.hsqldb.types.BinaryType' Java class
BinaryType
org.hsqldb.types

Class BinaryType

  • All Implemented Interfaces:
    java.lang.Cloneable, SchemaObject
    Direct Known Subclasses:
    BitType, BlobType


    public class BinaryType
    extends Type
    Type implementation for BINARY, VARBINARY and (part) BLOB.

    SQL:2008 Standard specifies silent truncation of zero bytes at the end of the binary strings used for assignment and contatenation.

    * A binary string of type BINARY VALYING and BLOB when assigned to a column of similar type but shorter maximum length. The behaviour is similar to trimming of space characters from strings of CHARACTER VARYING and CLOB types.

    In most real-world use-cases, all the bytes of variable-length binary values stored in a database are significant and should not be discarded.

    HSQLDB follows the Standard completely, despite this inadequecy.

    Comparison of binary values follows the Standard. When two values are not the same length and all the bytes of the shorter value equal the initial sequence of bytes of the longer value, then the shorter value is the smaller. The Standard treats this determination as implementation dependent.

    BIT types, which were part of the SQL:1999, can be converted to and from BINARY. The BIT strings may be padded with zero bits for byte alignment.

    As an extension to the Standard, HSQLDB supports cast from CHARACTER types to BINARY. The length of the string must be even and all character must be hexadecimal characters.

    Since:
    1.9.0
    • Method Detail

      • displaySize

        public int displaySize()
        Specified by:
        displaySize in class Type
      • getJDBCTypeCode

        public int getJDBCTypeCode()
        Description copied from class: Type
        Returns the JDBC type number of type, if it exists, otherwise the HSQLDB / SQL type.
        Specified by:
        getJDBCTypeCode in class Type
      • getJDBCClass

        public java.lang.Class getJDBCClass()
        Specified by:
        getJDBCClass in class Type
      • getJDBCClassName

        public java.lang.String getJDBCClassName()
        Description copied from class: Type
        Returns the JDBC class name of type, if it exists, otherwise the HSQLDB class name.
        Specified by:
        getJDBCClassName in class Type
      • getNameString

        public java.lang.String getNameString()
        Description copied from class: Type
        Returns the name of the type
        Specified by:
        getNameString in class Type
      • getNameFullString

        public java.lang.String getNameFullString()
      • getDefinition

        public java.lang.String getDefinition()
        Description copied from class: Type
        Returns the full definition of the type, including parameters
        Specified by:
        getDefinition in class Type
      • isBinaryType

        public boolean isBinaryType()
        Overrides:
        isBinaryType in class Type
      • precedenceDegree

        public int precedenceDegree(Type other)
        relaxes the SQL standard list to avoid problems with covnersion of literals and java method parameter type issues
        Overrides:
        precedenceDegree in class Type
      • getAggregateType

        public Type getAggregateType(Type other)
        Description copied from class: Type
        Common type used in comparison opertions. other must be comparable with this.
        Specified by:
        getAggregateType in class Type
      • compare

        public int compare(Session session,
                           java.lang.Object a,
                           java.lang.Object b)
        Specified by:
        compare in class Type
      • castToType

        public java.lang.Object castToType(SessionInterface session,
                                           java.lang.Object a,
                                           Type otherType)
        Description copied from class: Type
        Explicit casts are handled by this method. SQL standard 6.12 rules for enforcement of size, precision and scale are implemented. For CHARACTER values, it performs truncation in all cases of long strings.
        Overrides:
        castToType in class Type
      • convertToType

        public java.lang.Object convertToType(SessionInterface session,
                                              java.lang.Object a,
                                              Type otherType)
        Description copied from class: Type
        Same as castToType except for CHARACTER values. Perform string truncation of trailing spaces only. For other long strings, it raises an exception.
        Specified by:
        convertToType in class Type
      • convertToDefaultType

        public java.lang.Object convertToDefaultType(SessionInterface session,
                                                     java.lang.Object a)
        Description copied from class: Type
        Converts the object to the given type without limit checks. Used for JDBC writes.
        Specified by:
        convertToDefaultType in class Type
      • convertToString

        public java.lang.String convertToString(java.lang.Object a)
        Specified by:
        convertToString in class Type
      • convertToSQLString

        public java.lang.String convertToSQLString(java.lang.Object a)
        Specified by:
        convertToSQLString in class Type
      • canConvertFrom

        public boolean canConvertFrom(Type otherType)
        Specified by:
        canConvertFrom in class Type
      • canMoveFrom

        public int canMoveFrom(Type otherType)
        Description copied from class: Type
        Can convert without changing the object
        Overrides:
        canMoveFrom in class Type
        Returns:
        0 always, 1 range check required, -1 never
      • concat

        public java.lang.Object concat(Session session,
                                       java.lang.Object a,
                                       java.lang.Object b)
        Overrides:
        concat in class Type
      • getBinaryType

        public static BinaryType getBinaryType(int type,
                                               long precision)

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.