db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mamta A. Satoor (JIRA)" <j...@apache.org>
Subject [jira] Updated: (DERBY-2534) Add new api "public StringDataValue getValue(RuleBasedCollator)" on StringDataValue. This method will return either the base DVDs for char datatypes or it will return collation sensitive DVD for char datatypes.
Date Mon, 09 Apr 2007 07:44:32 GMT

     [ https://issues.apache.org/jira/browse/DERBY-2534?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Mamta A. Satoor updated DERBY-2534:

    Attachment: DERBY2534_getValue_On_StringDataValue_v1_stat.txt

I am attaching a patch DERBY2534_getValue_On_StringDataValue_v1_diff.txt to this Jira entry
which I plan to commit soon. The patch adds a new api to StringDataValue interface and the
new api looks as follows
public StringDataValue getValue(RuleBasedCollator collatorForComparison);

The new api will be needed in quite a few different places. 2 distinct uses that I can see
at this point are
1)Store will have a format id and collation type when it is trying to construct a DVD template.
Using the formatid, we will first always get the base class DVD for char datatypes namely
SQLChar, SQLVarchar, SQLLongvarchar or SQLClob. Next, if the collation type is not 0  ie it
is not UCS_BASIC, then we want to use Collation sensitive DVDs of base char DVDs because we
want to use the passed Collator for collation rather than the default UCS_BASIC Collator.
The collation sensitive DVDs of char datatypes are CollatorSQLChar, CollatorSQLVarchar, CollatorSQLLongvarchar
and CollatorSQLClob. In order to derive these collation sensitive DVDs of character datatypes,
we will use this new api called getValue on base character DVDs. The getValue method will
have the Collator object as parameter to it. If the Collator object is null, then we can continue
to use the base DVD. But if the Collator object is not null, then we want to construct collation
sensitive DVD. The new api on StringDataValue will help achieve this behavior.
2)Another place which I can envision using this new api is in DataTypeDescriptor.getNull()
method which returns a DVD. Currently, the implementation of this method looks as follows
	public DataValueDescriptor getNull() {
		return typeId.getNull();
So, if the typeid of DTD is character data type, this method will always return base char
DVD, no matter what is the collation type of the DTD. But, if the DTD has a territory based
collation set for it, then this method should return collation sensitive char DVD. This functionality
can be achieved by using the new api on StringDataValue.

I do not anticipate this new method ever getting called on collation sensitive DVDs 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 but for Derby 10.3, the new api in collation
sensitive DVDs is just a place holder.

Another change to note is I changed all the collation sensitive subclasses to have their method
setCollator changed from private to protected. This is so that the getValue method from their
correspoding base classes can call the setCollator method on subclasses.

The files changed by this patch are
svn stat -q
M      java\engine\org\apache\derby\iapi\types\SQLLongvarchar.java
M      java\engine\org\apache\derby\iapi\types\StringDataValue.java
M      java\engine\org\apache\derby\iapi\types\CollatorSQLChar.java
M      java\engine\org\apache\derby\iapi\types\CollatorSQLClob.java
M      java\engine\org\apache\derby\iapi\types\CollatorSQLVarchar.java
M      java\engine\org\apache\derby\iapi\types\SQLChar.java
M      java\engine\org\apache\derby\iapi\types\SQLClob.java
M      java\engine\org\apache\derby\iapi\types\SQLVarchar.java
M      java\engine\org\apache\derby\iapi\types\CollatorSQLLongvarchar.java

The code compiles ok with my changes. None of the tests should get impacted because currently,
this new api on StringDataValue is  not called by any other code in Derby.

> Add new api "public StringDataValue getValue(RuleBasedCollator)" on StringDataValue.
This method will return either the base DVDs for char datatypes or it will return collation
sensitive DVD for char datatypes.
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>                 Key: DERBY-2534
>                 URL: https://issues.apache.org/jira/browse/DERBY-2534
>             Project: Derby
>          Issue Type: New Feature
>          Components: SQL
>    Affects Versions:
>            Reporter: Mamta A. Satoor
>         Attachments: DERBY2534_getValue_On_StringDataValue_v1_diff.txt, DERBY2534_getValue_On_StringDataValue_v1_stat.txt
> In Derby 10.3, the collation of char datatypes can be different depending on what kind
of collation is requested by the user at the database create time through the optional JDBC
url attribute COLLATION. The collation type associated with the DTD will determine which kind
of DVD needs to be generated. (Note that, irrespective of what collation is used, the format
id of the char datatypes remain same.) In order to support this behavior of generating the
base DVD or the collation sensitive DVD for character datatypes, we need to add a new api
to StringDataValue which will look as follows
> 	/**
> 	 * Gets either SQLChar/SQLVarchar/SQLLongvarchar/SQLClob(base classes) or 
> 	 * CollatorSQLChar/CollatorSQLVarchar/CollatorSQLLongvarch/CollatorSQLClob
> 	 * (subclasses). Whether this method returns the base class or the subclass 
> 	 * depends on the value of the RuleBasedCollator. If RuleBasedCollator is 
> 	 * null, then the object returned would be baseclass otherwise it would be 
> 	 * subcalss.
> 	 */
> 	public StringDataValue getValue(RuleBasedCollator collatorForComparison);

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message