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

pack-priv Class CollatorSQLChar

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

CollatorSQLChar class differs from SQLChar based on how the 2 classes use different collations to collate their data. SQLChar 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
Inherited from org.apache.derby.iapi.types.SQLChar:
_clobValuearg_passerCHAR_HEADER_GENERATORRETURN_SPACE_THRESHOLDstream

Constructor Summary

AccessConstructor and Description
pack-priv
CollatorSQLChar(RuleBasedCollator collatorForCharacterDatatypes)

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

pack-priv
CollatorSQLChar(String val, RuleBasedCollator collatorForCharacterDatatypes)

Create SQL CHAR 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.SQLChar.cloneValue.

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

Clone this DataValueDescriptor.

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 CollatorSQLChar.

public DataValueDescriptor
getNewNull()

Overrides org.apache.derby.iapi.types.SQLChar.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.SQLChar.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 CollatorSQLChar.

protected int
Inherited from org.apache.derby.iapi.types.SQLChar:
ansiTrimcharLengthcloneHoldercomparecompareconcatenatecopyStateequalsestimateMemoryUsagegetBooleangetBytegetCharArraygetCollationKeygetDategetDategetDoublegetFloatgetIntgetLengthgetLocaleFindergetLonggetNewVarchargetObjectgetRawDataAndZeroItgetShortgetStreamgetStreamHeaderGeneratorgetStreamWithDescriptorgetStringgetTimegetTimegetTimestampgetTimestampgetTraceStringgetTypeFormatIdgetTypeNamegreaterOrEqualsgreaterThangrowByhashCodeForCollationhasNonBlankCharsisNulllessOrEqualslessThanloadStreamlocatelowernormalizenormalizenotEqualsreadExternalreadExternalreadExternalClobFromArrayreadExternalFromArrayrestoreToNullreturnStreamsetBigDecimalsetFromsetIntosetLocaleFindersetObjectForCastsetStreamsetStreamHeaderFormatsetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValueFromResultSetsetWidthstringComparestringComparesubstringthrowStreamingIOExceptiontoStringtypePrecedencetypeToBigDecimalupperwriteClobUTFwriteExternalzeroRawData

Field Detail

holderForCollationSensitiveInfoback to summary
private WorkHorseForCollatorDatatypes holderForCollationSensitiveInfo

Constructor Detail

CollatorSQLCharback to summary
pack-priv CollatorSQLChar(RuleBasedCollator collatorForCharacterDatatypes)

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

CollatorSQLCharback to summary
pack-priv CollatorSQLChar(String val, RuleBasedCollator collatorForCharacterDatatypes)

Create SQL CHAR 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.SQLChar.cloneValue.

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

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

Clone this DataValueDescriptor. Results in a new object that has the same value as this but can be modified independently.

Even though the objects can be modified independently regardless of the value of forceMaterialization, both the clone and the original may be dependent on the store state if forceMaterialization is set to false. An example is if you need to access the value you just read using cloneValue after the current transaction has ended, or after the source result set has been closed.

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 the DataValueDescriptor with the same initial value as this.

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 CollatorSQLChar. 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.SQLChar.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.SQLChar.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 CollatorSQLChar. 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)