Package org.apache.derby.iapi.types
Class WorkHorseForCollatorDatatypes
- java.lang.Object
-
- org.apache.derby.iapi.types.WorkHorseForCollatorDatatypes
-
final class WorkHorseForCollatorDatatypes extends java.lang.Object
WorkHorseForCollatorDatatypes class holds on to RuleBasedCollator, and the base SQLChar object for the collation sensitive SQLChar, SQLVarchar, SQLLongvarchar and SQLClob. This class uses RuleBasedCollator and SQLChar object in the collation sensitive methods to do the comparison. The reason for encapsulating this here is that the collation version of SQLChar, SQLVarchar, SQLLongvarchar and SQLClob do not all have to duplicate the code for collation sensitive methods. Instead, they can simply delegate the work to methods defined in this class.
-
-
Field Summary
Fields Modifier and Type Field Description private java.text.RuleBasedCollator
collatorForCharacterDatatypes
Use this object for collation on character datatype.private SQLChar
stringData
collatorForCharacterDatatypes will be used on this SQLChar to determine collationElementsForString.
-
Constructor Summary
Constructors Constructor Description WorkHorseForCollatorDatatypes(java.text.RuleBasedCollator collatorForCharacterDatatypes, SQLChar stringData)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) java.text.RuleBasedCollator
getCollatorForCollation()
Get the RuleBasedCollator which is getting used for collation sensitive methods.(package private) boolean
hasSingleCollationElement()
Check if the string consists of a single collation element.(package private) BooleanDataValue
like(DataValueDescriptor pattern)
This method implements the like function for char (with no escape value).(package private) BooleanDataValue
like(DataValueDescriptor pattern, DataValueDescriptor escape)
This method implements the like function for char with an escape value.(package private) int
stringCompare(SQLChar str1, SQLChar str2)
-
-
-
Field Detail
-
collatorForCharacterDatatypes
private java.text.RuleBasedCollator collatorForCharacterDatatypes
Use this object for collation on character datatype. This collator object is passed as a parameter to the constructor.
-
stringData
private SQLChar stringData
collatorForCharacterDatatypes will be used on this SQLChar to determine collationElementsForString. The collationElementsForString is used by the like method to do Collator specific comparison. This SQLChar object is passed as a parameter to the constructor.
-
-
Constructor Detail
-
WorkHorseForCollatorDatatypes
WorkHorseForCollatorDatatypes(java.text.RuleBasedCollator collatorForCharacterDatatypes, SQLChar stringData)
-
-
Method Detail
-
stringCompare
int stringCompare(SQLChar str1, SQLChar str2) throws StandardException
- Throws:
StandardException
- See Also:
SQLChar.stringCompare(SQLChar, SQLChar)
-
like
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 SQLChar 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
- 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
BooleanDataValue like(DataValueDescriptor pattern, DataValueDescriptor escape) throws StandardException
This method implements the like function for char with an escape value.- 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
-
getCollatorForCollation
java.text.RuleBasedCollator getCollatorForCollation()
Get the RuleBasedCollator which is getting used for collation sensitive methods.
-
hasSingleCollationElement
boolean hasSingleCollationElement() throws StandardException
Check if the string consists of a single collation element.- Returns:
true
iff it's a single collation element- Throws:
StandardException
- See Also:
CollationElementsInterface.hasSingleCollationElement()
-
-