org.apache.derby.iapi.types
Class CollatorSQLClob

java.lang.Object
  extended by org.apache.derby.iapi.types.DataType
      extended by org.apache.derby.iapi.types.SQLChar
          extended by org.apache.derby.iapi.types.SQLVarchar
              extended by org.apache.derby.iapi.types.SQLClob
                  extended by org.apache.derby.iapi.types.CollatorSQLClob
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, java.lang.Comparable, Formatable, Storable, StreamStorable, TypedFormat, CollationElementsInterface, ConcatableDataValue, DataValueDescriptor, Orderable, StringDataValue, VariableSizeDataValue

 class CollatorSQLClob
extends SQLClob
implements CollationElementsInterface

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
private  WorkHorseForCollatorDatatypes holderForCollationSensitiveInfo
           
 
Fields inherited from class org.apache.derby.iapi.types.SQLChar
_clobValue, arg_passer, CHAR_HEADER_GENERATOR, RETURN_SPACE_THRESHOLD, stream
 
Fields inherited from interface org.apache.derby.iapi.types.StringDataValue
BOTH, COLLATION_DERIVATION_EXPLICIT, COLLATION_DERIVATION_IMPLICIT, COLLATION_DERIVATION_NONE, COLLATION_TYPE_TERRITORY_BASED, COLLATION_TYPE_TERRITORY_BASED_IDENTICAL, COLLATION_TYPE_TERRITORY_BASED_PRIMARY, COLLATION_TYPE_TERRITORY_BASED_SECONDARY, COLLATION_TYPE_TERRITORY_BASED_TERTIARY, COLLATION_TYPE_UCS_BASIC, LEADING, TRAILING
 
Fields inherited from interface org.apache.derby.iapi.types.DataValueDescriptor
UNKNOWN_LOGICAL_LENGTH
 
Fields inherited from interface org.apache.derby.iapi.types.Orderable
ORDER_OP_EQUALS, ORDER_OP_GREATEROREQUALS, ORDER_OP_GREATERTHAN, ORDER_OP_LESSOREQUALS, ORDER_OP_LESSTHAN
 
Fields inherited from interface org.apache.derby.iapi.types.VariableSizeDataValue
IGNORE_PRECISION
 
Constructor Summary
CollatorSQLClob(java.text.RuleBasedCollator collatorForCharacterDatatypes)
          Create SQL CLOB value initially set to NULL that performs collation according to collatorForCharacterDatatypes
CollatorSQLClob(java.lang.String val, java.text.RuleBasedCollator collatorForCharacterDatatypes)
          Create SQL CLOB value initially set to value that performs collation according to collatorForCharacterDatatypes
 
Method Summary
 DataValueDescriptor cloneValue(boolean forceMaterialization)
          Returns a clone of this CLOB value.
 int[] getCollationElementsForString()
          This method translates the string into a series of collation elements.
protected  java.text.RuleBasedCollator getCollatorForCollation()
          Get the RuleBasedCollator for this instance of CollatorSQLClob.
 int getCountOfCollationElements()
          This method returns the count of collation elements for this instance of CollationElementsInterface.
 DataValueDescriptor getNewNull()
          Get a new null value of the same type as this data value.
 StringDataValue getValue(java.text.RuleBasedCollator collatorForComparison)
          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.
 int hashCode()
          Return a hash code that is consistent with stringCompare(SQLChar, SQLChar).
 BooleanDataValue like(DataValueDescriptor pattern)
          This method implements the like function for char (with no escape value).
 BooleanDataValue like(DataValueDescriptor pattern, DataValueDescriptor escape)
          This method implements the like function for char with an escape value.
private  void setCollator(java.text.RuleBasedCollator collatorForCharacterDatatypes)
          Set the RuleBasedCollator for this instance of CollatorSQLClob.
protected  int stringCompare(SQLChar char1, SQLChar char2)
          Compare two SQLChars.
 
Methods inherited from class org.apache.derby.iapi.types.SQLClob
getBoolean, getByte, getBytes, getDate, getDouble, getFloat, getInt, getLength, getLong, getShort, getStreamHeaderGenerator, getStreamWithDescriptor, getTime, getTimestamp, getTraceString, getTypeFormatId, getTypeName, hasStream, normalize, readExternal, readExternalFromArray, restoreToNull, setBigDecimal, setObject, setStream, setStreamHeaderFormat, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, typePrecedence, typeToBigDecimal, writeExternal
 
Methods inherited from class org.apache.derby.iapi.types.SQLVarchar
growBy, normalize
 
Methods inherited from class org.apache.derby.iapi.types.SQLChar
ansiTrim, charLength, cloneHolder, compare, compare, concatenate, copyState, equals, estimateMemoryUsage, getCharArray, getCollationKey, getDate, getDateFormat, getDateFormat, getLocaleFinder, getNewVarchar, getObject, getStream, getString, getTime, getTimeFormat, getTimeFormat, getTimestamp, getTimestampFormat, getTimestampFormat, greaterOrEquals, greaterThan, hashCodeForCollation, hasNonBlankChars, isNull, lessOrEquals, lessThan, loadStream, locate, lower, notEquals, readExternal, readExternalClobFromArray, returnStream, setFrom, setInto, setLocaleFinder, setObjectForCast, setValue, setValue, setValue, setValueFromResultSet, setWidth, stringCompare, stringCompare, substring, throwStreamingIOException, toString, upper, writeClobUTF
 
Methods inherited from class org.apache.derby.iapi.types.DataType
checkHostVariable, coalesce, compare, compare, compareTo, dataTypeConversion, equals, flip, genericSetObject, getNationalString, getTypeName, in, invalidFormat, isNotNull, isNullOp, outOfRange, recycle, setInto, setToNull, setValue, setValue, setValue, setValue, setValue, throwLangSetMismatch, throwLangSetMismatch
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.derby.iapi.types.DataValueDescriptor
checkHostVariable, coalesce, compare, compare, in, isNotNull, isNullOp, recycle, setInto, setToNull, setValue, setValue, setValue, setValue, setValue
 

Field Detail

holderForCollationSensitiveInfo

private WorkHorseForCollatorDatatypes holderForCollationSensitiveInfo
Constructor Detail

CollatorSQLClob

CollatorSQLClob(java.text.RuleBasedCollator collatorForCharacterDatatypes)
Create SQL CLOB value initially set to NULL that performs collation according to collatorForCharacterDatatypes


CollatorSQLClob

CollatorSQLClob(java.lang.String val,
                java.text.RuleBasedCollator collatorForCharacterDatatypes)
Create SQL CLOB value initially set to value that performs collation according to collatorForCharacterDatatypes

Method Detail

setCollator

private void setCollator(java.text.RuleBasedCollator collatorForCharacterDatatypes)
Set the RuleBasedCollator for this instance of CollatorSQLClob. It will be used to do the collation.


getCollatorForCollation

protected java.text.RuleBasedCollator getCollatorForCollation()
                                                       throws StandardException
Get the RuleBasedCollator for this instance of CollatorSQLClob. It will be used to do the collation.

Overrides:
getCollatorForCollation in class SQLChar
Returns:
The Collator object which should be used for collation operation on this object
Throws:
StandardException

getCollationElementsForString

public int[] getCollationElementsForString()
                                    throws StandardException
Description copied from interface: CollationElementsInterface
This method translates the string into a series of collation elements. These elements will get used in the like method.

Specified by:
getCollationElementsForString in interface CollationElementsInterface
Returns:
an array of collation elements for the string
Throws:
StandardException
See Also:
CollationElementsInterface.getCollationElementsForString()

getCountOfCollationElements

public int getCountOfCollationElements()
Description copied from interface: CollationElementsInterface
This method returns the count of collation elements for this instance of CollationElementsInterface. This method will return the correct value only if method getCollationElementsForString has been called previously on this instance of CollationElementsInterface.

Specified by:
getCountOfCollationElements in interface CollationElementsInterface
Returns:
count of collation elements for this instance of CollatorSQLChar
See Also:
CollationElementsInterface.getCountOfCollationElements()

cloneValue

public DataValueDescriptor cloneValue(boolean forceMaterialization)
Description copied from class: SQLClob
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.

Specified by:
cloneValue in interface DataValueDescriptor
Overrides:
cloneValue in class SQLClob
Parameters:
forceMaterialization - 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:
A clone of this CLOB value.
See Also:
DataValueDescriptor.cloneValue(boolean)

getNewNull

public DataValueDescriptor getNewNull()
Description copied from interface: DataValueDescriptor
Get a new null value of the same type as this data value.

Specified by:
getNewNull in interface DataValueDescriptor
Overrides:
getNewNull in class SQLClob
See Also:
DataValueDescriptor.getNewNull()

getValue

public StringDataValue getValue(java.text.RuleBasedCollator collatorForComparison)
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.

Specified by:
getValue in interface StringDataValue
Overrides:
getValue in class SQLClob
See Also:
StringDataValue.getValue(RuleBasedCollator)

stringCompare

protected int stringCompare(SQLChar char1,
                            SQLChar char2)
                     throws StandardException
Description copied from class: SQLChar
Compare two SQLChars.

Overrides:
stringCompare in class SQLChar
Throws:
StandardException - Thrown on error
See Also:
SQLChar.stringCompare(SQLChar, SQLChar)

hashCode

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

Overrides:
hashCode in class SQLChar
Returns:
hash code

like

public BooleanDataValue like(DataValueDescriptor pattern)
                      throws StandardException
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.

Specified by:
like in interface StringDataValue
Overrides:
like in class SQLChar
Parameters:
pattern - The pattern to use
Returns:
A SQL boolean value telling whether the first operand is like the second operand
Throws:
StandardException - Thrown on error

like

public BooleanDataValue like(DataValueDescriptor pattern,
                             DataValueDescriptor escape)
                      throws StandardException
This method implements the like function for char with an escape value.

Specified by:
like in interface StringDataValue
Overrides:
like in class SQLChar
Parameters:
pattern - The pattern to use
escape - the escape character
Returns:
A SQL boolean value telling whether the first operand is like the second operand
Throws:
StandardException - Thrown on error

Built on Thu 2011-03-10 11:54:14+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.