SQL:2008 Standard specifies silent truncation of zero bytes at the end of the binary strings used for assignment and concatenation.
A binary string of type BINARY VARYING and BLOB when assigned to a column of similar type but shorter maximum length.
The Second operand of a concatenation when the length of the result exceeds the maximum implementation-dependent length of BINARY VARYING and BLOB binary strings.
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 inadequacy.
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.
| Modifier and Type | Field and Description |
|---|---|
| public static final long |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| public boolean | |
| public int | canMoveFrom(Type otherType)
Overrides org. When canConvertFrom() is true, can convert without changing the object |
| pack-priv Object | |
| public Object | castToType(SessionInterface session, Object a, Type otherType)
Overrides org. Explicit casts are handled by this method. |
| public int | |
| public Object | |
| public Object | convertJavaToSQL(SessionInterface session, Object a)
Overrides org.
|
| public Object | convertSQLToJava(SessionInterface session, Object a)
Overrides org.
|
| public Object | convertToDefaultType(SessionInterface session, Object a)
Implements abstract org. Converts the object to the given type without limit checks. |
| public void | |
| public String | |
| public String | |
| public Object | convertToType(SessionInterface session, Object a, Type otherType)
Implements abstract org. Same as castToType except for CHARACTER values. |
| public Object | convertToTypeLimits(SessionInterface session, Object a)
Implements abstract org.
|
| public int | |
| public Type | getAggregateType(Type other)
Implements abstract org. Common type used in comparison operations. |
| public static BinaryType | |
| public Type | getCombinedType(Session session, Type other, int operation)
Implements abstract org. Returns type for concat |
| public String | getDefinition()
Implements abstract org. Returns the full definition of the type, including parameters |
| public Class | |
| public String | getJDBCClassName()
Implements abstract org. Returns the JDBC class name of type, if it exists, otherwise the HSQLDB class name. |
| public int | getJDBCTypeCode()
Implements abstract org. Returns the JDBC type number of type, if it exists, otherwise the HSQLDB / SQL type. |
| public long | |
| public String | |
| public String | getNameString()
Implements abstract org. Returns the name of the type |
| pack-priv int | |
| public boolean | |
| public BlobData | |
| public long | |
| public int | precedenceDegree(Type other)
Overrides org. relaxes the SQL standard list to avoid problems with conversion of literals and java method parameter type issues |
| public boolean | |
| public BlobData | |
| public BlobData |
| maxBinaryPrecision | back to summary |
|---|---|
| public static final long maxBinaryPrecision | |
| BinaryType | back to summary |
|---|---|
| protected BinaryType(int type, long precision) | |
| acceptsPrecision | back to summary |
|---|---|
| public boolean acceptsPrecision() Overrides org. | |
| canConvertFrom | back to summary |
|---|---|
| public boolean canConvertFrom(Type otherType) Implements abstract org. | |
| canMoveFrom | back to summary |
|---|---|
| public int canMoveFrom(Type otherType) Overrides org. Doc from org. When canConvertFrom() is true, can convert without changing the object | |
| castOrConvertToType | back to summary |
|---|---|
| pack-priv Object castOrConvertToType(SessionInterface session, Object a, Type otherType, boolean cast) | |
| castToType | back to summary |
|---|---|
| public Object castToType(SessionInterface session, Object a, Type otherType) Overrides org. Doc from org. 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. | |
| compare | back to summary |
|---|---|
| public int compare(Session session, Object a, Object b) Implements abstract org. | |
| concat | back to summary |
|---|---|
| public Object concat(Session session, Object a, Object b) Overrides org. | |
| convertJavaToSQL | back to summary |
|---|---|
| public Object convertJavaToSQL(SessionInterface session, Object a) Overrides org. | |
| convertSQLToJava | back to summary |
|---|---|
| public Object convertSQLToJava(SessionInterface session, Object a) Overrides org. | |
| convertToDefaultType | back to summary |
|---|---|
| public Object convertToDefaultType(SessionInterface session, Object a) Implements abstract org. Doc from org. Converts the object to the given type without limit checks. Used for JDBC writes. | |
| convertToJSON | back to summary |
|---|---|
| public void convertToJSON(Object a, StringBuilder sb) Overrides org. | |
| convertToSQLString | back to summary |
|---|---|
| public String convertToSQLString(Object a) Implements abstract org. | |
| convertToString | back to summary |
|---|---|
| public String convertToString(Object a) Implements abstract org. | |
| convertToType | back to summary |
|---|---|
| public Object convertToType(SessionInterface session, Object a, Type otherType) Implements abstract org. Doc from org. Same as castToType except for CHARACTER values. Perform string truncation of trailing spaces only. For other long strings, it raises an exception. | |
| convertToTypeLimits | back to summary |
|---|---|
| public Object convertToTypeLimits(SessionInterface session, Object a) Implements abstract org. | |
| displaySize | back to summary |
|---|---|
| public int displaySize() Implements abstract org. | |
| getAggregateType | back to summary |
|---|---|
| public Type getAggregateType(Type other) Implements abstract org. Doc from org. Common type used in comparison operations. other must be comparable with this. | |
| getBinaryType | back to summary |
|---|---|
| public static BinaryType getBinaryType(int type, long precision) | |
| getCombinedType | back to summary |
|---|---|
| public Type getCombinedType(Session session, Type other, int operation) Implements abstract org. Returns type for concat | |
| getDefinition | back to summary |
|---|---|
| public String getDefinition() Implements abstract org. Doc from org. Returns the full definition of the type, including parameters | |
| getJDBCClass | back to summary |
|---|---|
| public Class Implements abstract org. | |
| getJDBCClassName | back to summary |
|---|---|
| public String getJDBCClassName() Implements abstract org. Doc from org. Returns the JDBC class name of type, if it exists, otherwise the HSQLDB class name. | |
| getJDBCTypeCode | back to summary |
|---|---|
| public int getJDBCTypeCode() Implements abstract org. Doc from org. Returns the JDBC type number of type, if it exists, otherwise the HSQLDB / SQL type. | |
| getMaxPrecision | back to summary |
|---|---|
| public long getMaxPrecision() Overrides org. | |
| getNameFullString | back to summary |
|---|---|
| public String getNameFullString() | |
| getNameString | back to summary |
|---|---|
| public String getNameString() Implements abstract org. Doc from org. Returns the name of the type | |
| getRightTrimSize | back to summary |
|---|---|
| pack-priv int getRightTrimSize(BlobData data) | |
| isBinaryType | back to summary |
|---|---|
| public boolean isBinaryType() Overrides org. | |
| overlay | back to summary |
|---|---|
| public BlobData overlay(Session session, BlobData data, BlobData overlay, long offset, long length, boolean hasLength) | |
| position | back to summary |
|---|---|
| public long position(SessionInterface session, BlobData data, BlobData otherData, Type otherType, long offset) | |
| precedenceDegree | back to summary |
|---|---|
| public int precedenceDegree(Type other) Overrides org. relaxes the SQL standard list to avoid problems with conversion of literals and java method parameter type issues | |
| requiresPrecision | back to summary |
|---|---|
| public boolean requiresPrecision() Overrides org. | |
| substring | back to summary |
|---|---|
| public BlobData substring(SessionInterface session, BlobData data, long offset, long length, boolean hasLength) | |
| trim | back to summary |
|---|---|
| public BlobData trim(Session session, BlobData data, int trim, boolean leading, boolean trailing) | |