Top Description Fields Constructors Methods
org.apache.derby.iapi.types

pack-priv Class CollatorSQLClob

extends SQLClob
implements CollationElementsInterface
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.types.CollationElementsInterface
Imports
java.sql.Clob, org.apache.derby.shared.common.error.StandardException, org.apache.derby.shared.common.sanity.SanityManager, java.text.RuleBasedCollator

CollatorSQLClob class differs from SQLClob based on how the 2 classes use different collations to collate their data. SQLClob uses Derby's default collation which is UCS_BASIC. Whereas, this class uses the RuleBasedCollator object that was passed to it in it's constructor and that RuleBasedCollator object decides the collation. In Derby 10.3, this class will be passed a RuleBasedCollator which is based on the database's territory. In future releases of Derby, this class can be used to do other kinds of collations like case-insensitive collation etc by just passing an appropriate RuleBasedCollator object for that kind of collation.

Field Summary

Modifier and TypeField and Description
private WorkHorseForCollatorDatatypes

Constructor Summary

AccessConstructor and Description
pack-priv
CollatorSQLClob(RuleBasedCollator collatorForCharacterDatatypes)

Create SQL CLOB value initially set to NULL that performs collation according to collatorForCharacterDatatypes

pack-priv
CollatorSQLClob(String val, RuleBasedCollator collatorForCharacterDatatypes)

Create SQL CLOB value initially set to value that performs collation according to collatorForCharacterDatatypes

pack-priv
CollatorSQLClob(Clob val, RuleBasedCollator collatorForCharacterDatatypes)

Create SQL CLOB value initially set to value that performs collation according to collatorForCharacterDatatypes

Method Summary

Modifier and TypeMethod and Description
public DataValueDescriptor
cloneValue(boolean
any streams representing the data value will be materialized if true, the data value will be kept as a stream if possible if false
forceMaterialization
)

Overrides org.apache.derby.iapi.types.SQLClob.cloneValue.

Implements org.apache.derby.iapi.types.DataValueDescriptor.cloneValue.

Returns a clone of this CLOB value.

protected RuleBasedCollator

Returns:

The Collator object which should be used for collation operation on this object
getCollatorForCollation
()

Overrides org.apache.derby.iapi.types.SQLChar.getCollatorForCollation.

Get the RuleBasedCollator for this instance of CollatorSQLClob.

public DataValueDescriptor
getNewNull()

Overrides org.apache.derby.iapi.types.SQLClob.getNewNull.

Implements org.apache.derby.iapi.types.DataValueDescriptor.getNewNull.

Get a new null value of the same type as this data value.

public StringDataValue
getValue(RuleBasedCollator collatorForComparison)

Overrides org.apache.derby.iapi.types.SQLClob.getValue.

Implements org.apache.derby.iapi.types.StringDataValue.getValue.

We do not anticipate this method on collation sensitive DVD to be ever called in Derby 10.3 In future, when Derby will start supporting SQL standard COLLATE clause, this method might get called on the collation sensitive DVDs.

public int

Returns:

hash code
hashCode
()

Overrides org.apache.derby.iapi.types.SQLChar.hashCode.

Return a hash code that is consistent with stringCompare(SQLChar, SQLChar).

public boolean
hasSingleCollationElement()

Implements org.apache.derby.iapi.types.CollationElementsInterface.hasSingleCollationElement.

Check if this instance represents a value that has a single collation element.

public BooleanDataValue

Returns:

A SQL boolean value telling whether the first operand is like the second operand
like
(DataValueDescriptor
The pattern to use
pattern
)

Overrides org.apache.derby.iapi.types.SQLChar.like.

Implements org.apache.derby.iapi.types.StringDataValue.like.

This method implements the like function for char (with no escape value).

public BooleanDataValue

Returns:

A SQL boolean value telling whether the first operand is like the second operand
like
(DataValueDescriptor
The pattern to use
pattern
,
DataValueDescriptor
the escape character
escape
)

Overrides org.apache.derby.iapi.types.SQLChar.like.

Implements org.apache.derby.iapi.types.StringDataValue.like.

This method implements the like function for char with an escape value.

private void
setCollator(RuleBasedCollator collatorForCharacterDatatypes)

Set the RuleBasedCollator for this instance of CollatorSQLClob.

protected int
Inherited from org.apache.derby.iapi.types.SQLClob:
getBooleangetBytegetBytesgetDategetDoublegetFloatgetIntgetLengthgetLonggetObjectgetShortgetStreamHeaderGeneratorgetStreamWithDescriptorgetTimegetTimestampgetTraceStringgetTypeFormatIdgetTypeNamehasStreamnormalizereadExternalreadExternalFromArrayrestoreToNullsetBigDecimalsetObjectsetStreamsetStreamHeaderFormatsetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuetypePrecedencetypeToBigDecimalwriteExternal

Field Detail

holderForCollationSensitiveInfoback to summary
private WorkHorseForCollatorDatatypes holderForCollationSensitiveInfo

Constructor Detail

CollatorSQLClobback to summary
pack-priv CollatorSQLClob(RuleBasedCollator collatorForCharacterDatatypes)

Create SQL CLOB value initially set to NULL that performs collation according to collatorForCharacterDatatypes

CollatorSQLClobback to summary
pack-priv CollatorSQLClob(String val, RuleBasedCollator collatorForCharacterDatatypes)

Create SQL CLOB value initially set to value that performs collation according to collatorForCharacterDatatypes

CollatorSQLClobback to summary
pack-priv CollatorSQLClob(Clob val, RuleBasedCollator collatorForCharacterDatatypes)

Create SQL CLOB value initially set to value that performs collation according to collatorForCharacterDatatypes

Method Detail

cloneValueback to summary
public DataValueDescriptor cloneValue(boolean forceMaterialization)

Overrides org.apache.derby.iapi.types.SQLClob.cloneValue.

Implements org.apache.derby.iapi.types.DataValueDescriptor.cloneValue.

Doc from org.apache.derby.iapi.types.SQLClob.cloneValue.

Returns a clone of this CLOB value.

Unlike the other binary types, CLOBs can be very large. We try to clone the underlying stream when possible to avoid having to materialize the value into memory.

Parameters
forceMaterialization:boolean

any streams representing the data value will be materialized if true, the data value will be kept as a stream if possible if false

Returns:DataValueDescriptor

A clone of this CLOB value.

See Also
DataValueDescriptor#cloneValue
getCollatorForCollationback to summary
protected RuleBasedCollator getCollatorForCollation() throws StandardException

Overrides org.apache.derby.iapi.types.SQLChar.getCollatorForCollation.

Get the RuleBasedCollator for this instance of CollatorSQLClob. It will be used to do the collation.

Returns:RuleBasedCollator

The Collator object which should be used for collation operation on this object

getNewNullback to summary
public DataValueDescriptor getNewNull()

Overrides org.apache.derby.iapi.types.SQLClob.getNewNull.

Implements org.apache.derby.iapi.types.DataValueDescriptor.getNewNull.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.getNewNull.

Get a new null value of the same type as this data value.

See Also
DataValueDescriptor#getNewNull
getValueback to summary
public StringDataValue getValue(RuleBasedCollator collatorForComparison)

Overrides org.apache.derby.iapi.types.SQLClob.getValue.

Implements org.apache.derby.iapi.types.StringDataValue.getValue.

We do not anticipate this method on collation sensitive DVD to be ever called in Derby 10.3 In future, when Derby will start supporting SQL standard COLLATE clause, this method might get called on the collation sensitive DVDs.

See Also
StringDataValue#getValue(RuleBasedCollator)
hashCodeback to summary
public int hashCode()

Overrides org.apache.derby.iapi.types.SQLChar.hashCode.

Return a hash code that is consistent with stringCompare(SQLChar, SQLChar).

Returns:int

hash code

hasSingleCollationElementback to summary
public boolean hasSingleCollationElement() throws StandardException

Implements org.apache.derby.iapi.types.CollationElementsInterface.hasSingleCollationElement.

Doc from org.apache.derby.iapi.types.CollationElementsInterface.hasSingleCollationElement.

Check if this instance represents a value that has a single collation element.

Returns:boolean

true if the value has exactly one collation element, or false otherwise

Exceptions
StandardException:
if an error occurs when accessing the value
likeback to summary
public BooleanDataValue like(DataValueDescriptor pattern) throws StandardException

Overrides org.apache.derby.iapi.types.SQLChar.like.

Implements org.apache.derby.iapi.types.StringDataValue.like.

This method implements the like function for char (with no escape value). The difference in this method and the same method in superclass is that here we use special Collator object to do the comparison rather than using the Collator object associated with the default jvm locale.

Parameters
pattern:DataValueDescriptor

The pattern to use

Returns:BooleanDataValue

A SQL boolean value telling whether the first operand is like the second operand

Exceptions
StandardException:
Thrown on error
likeback to summary
public BooleanDataValue like(DataValueDescriptor pattern, DataValueDescriptor escape) throws StandardException

Overrides org.apache.derby.iapi.types.SQLChar.like.

Implements org.apache.derby.iapi.types.StringDataValue.like.

This method implements the like function for char with an escape value.

Parameters
pattern:DataValueDescriptor

The pattern to use

escape:DataValueDescriptor

Doc from org.apache.derby.iapi.types.StringDataValue.like.

the escape character

Returns:BooleanDataValue

A SQL boolean value telling whether the first operand is like the second operand

Exceptions
StandardException:
Thrown on error
setCollatorback to summary
private void setCollator(RuleBasedCollator collatorForCharacterDatatypes)

Set the RuleBasedCollator for this instance of CollatorSQLClob. It will be used to do the collation.

stringCompareback to summary
protected int stringCompare(SQLChar char1, SQLChar char2) throws StandardException

Overrides org.apache.derby.iapi.types.SQLChar.stringCompare.

Doc from org.apache.derby.iapi.types.SQLChar.stringCompare.

Compare two SQLChars.

Exceptions
StandardException:
Thrown on error
See Also
SQLChar#stringCompare(SQLChar, SQLChar)