Ok, so I spent some time trying to move COLLATION attribute code from
DataDictionaryImpl.boot to DataValueFactoryImpl.boot. I thought I could
simply put following piece of code in DataValueFactoryImpl.boot method and
the Property.COLLATION will get saved in the properties conglomerate. That
is not happening
if (create) {
String userDefinedCollation = properties.getProperty(
Attribute.COLLATION);
if (userDefinedCollation == null)
userDefinedCollation = Property.UCS_BASIC_COLLATION;
else {//Invalid value handling
if (!userDefinedCollation.equalsIgnoreCase(
Property.UCS_BASIC_COLLATION)
&& !userDefinedCollation.equalsIgnoreCase(
Property.TERRITORY_BASED_COLLATION))
throw StandardException.newException(SQLState.INVALID_COLLATION,
userDefinedCollation);
}
properties.setProperty(Property.COLLATION,userDefinedCollation);
}
I verified that property is not getting put in properties conglomerate by
trying following after database creation
VALUES SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('derby.database.collation')
The above sql returns null rather than returning UCS_BASIC or
TERRITORY_BASED_COLLATION. The other properties in Derby get saved by going
through TransactionControllerInstance.setProperty method but I can't use
that because Store module has not been booted yet and hence I get a
TransactionControllerInstance.
One way to get around this is to let BasicDatabase do the COLLATION
attribute reading and putting the property in PropertyConglomerate through
TransactionControllerInstance.setProperty. And then BaseDatabase can call a
method on DataValueFactory to set the collator which should be used for
collation if user has requested territory based collation, ie going back to
what I had proposed in my first mail in this thread.
Any feedback? May be there is another way to read COLLATION attibute and
save it in DataValueFactory.boot which I am not aware of.
thanks,
Mamta
On 3/13/07, Mamta Satoor <[EMAIL PROTECTED]> wrote:
That's right. The code to read COLLATION attribute can simply live in
DataValueFactory.boot rather than in BasicDatabase.boot method. I will
work on what's outline in this email thread.
thanks,
Mamta
On 3/13/07, Daniel John Debrunner <[EMAIL PROTECTED]> wrote:
>
> Mamta Satoor wrote:
> > Hi,
> >
> > Based on the discussion in DERBY-2336 (Enable collation based ordering
>
> > for CHAR data type.), we want to move towards making DataValueFactory
> > keep track of locale related stuff. In order to move in that
> direction,
> > I think the knowledge that user has requested territory based
> collation
> > should also go in DataValueFactory.
>
> I wonder if all the collation attribute related code should be self
> contained in DataValueFactory?
>
> Dan.
>
>
>