db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mamta Satoor" <msat...@gmail.com>
Subject Re: Collation implementation WAS Re: Should COLLATION attribute related code go in BasicDatabase?
Date Wed, 21 Mar 2007 06:55:02 GMT
Dan, why would we need to override the StringDataValue
getValue(RuleBasedCollator collation) method in CollatorSQLChar? I think it
will be sufficient to implement this method in SQLChar with following
pseudocode
StringDataValue getValue(RuleBasedCollator collation)
{
   if (collation == null)
   {
     // Just need UCS_BASIC collation, so just return myself.
     return this;
   }

    CollatorSQLChar s = new CollatorSQLChar();
    s.setValue(this);
    s.setCollator(collation);
    return s;
}


I see this method being called when store is trying to construct a template
row of DVDs based on the format ids and collation type that store is aware
of. Since the formatid for character types will always correspond to SQLChar
(the base class)(for simplicity, I am only talking in terms of SQL type
CHAR. Same logic applies for other SQL character types) , the only thing
that store might want is to use the super class CollatorSQLChar as DVD if
the collation type is 1(TERRITORY_BASED). When do you see the need for Derby
code wanting to go from CollatorSQLChar to SQLChar?

thanks,
Mamta

On 3/15/07, Daniel John Debrunner <djd@apache.org> wrote:
>
> Mamta Satoor wrote:
> > In the following snippet of Dan's comments, what does it mean to return
> > SQLChar with the value of CollateSQLChar? I am definitely not clear on
> > the new getValue method on StringDataValue and how it will function for
> > SQLChar and CollatorSQLChar. Dan, can you please elaborate more on it?
> >
> > For CollatorSQLChar
> >            getValue(null) would return a new SQLChar() with the value of
> > the CollateSQLChar
>
> Example code for CollatorSQLChar
>
> StringDataValue getValue(RuleBasedCollator collation)
> {
>    if (collation == null)
>    {
>      // Just need UCS_BASIC collation
>      SQLChar s = new SQLChar();
>      s.setValue(this);
>      return s;
>    }
>
>     setCollator(collation);
>     return this;
> }
>
> I'm assuming that this call is made once when an Activation is
> initialized and not for every compared value.
>
> Dan.
>
>

Mime
View raw message