db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel John Debrunner <...@apache.org>
Subject Re: how should store get an object based on format id and collation id?
Date Sun, 15 Apr 2007 00:34:26 GMT
Mamta Satoor wrote:
> Hi Dan,
> The problem we are trying to solve is provide a way to Store so that it 
> can call a method (say it's called 
> getInstanceGetterForFormatIDandCollationType) on DVF with format id & 
> collation type and get an InstanceGetter for that combination. 

Why use InstanceGetter here?

> Like Mike 
> mentioned in his earlier mail (in this same thread, dated April 12th, 
> 2nd mail from Mike) with point 3), Store will call this method once and 
> call getInstance on that InstanceGetter multiple times to get the right 
> DVD. If we don't change the InstanceGetter as I suggested, then that 
> would mean that we will be creating 2 DVD objects for every character 
> DVD through Store code. The worst part is we will be doing this 
> unnecessary creation of 2 DVDs even for databases which want default 
> collation. The 2 DVD creation I am talking about are first, through 
> InstanceGetter, we will get say SQLChar. Then at the time of actual 
> collation comparison, it will have to call something like 
> StringDataValue.getCollationValue(int collationType) to get another DVD 
> to make sure that the collation is being performed with write DVD.

It doesn't have to return another DVD, it can return itself if it is of 
the correct type, thus no additional overhead for UCS_BASIC collation. 
Thus this switch would happen once for the first collation, not every 
collation, and of course not happen at all if no collation is involved.

> What I am suggesting does not make InstanceGetter complicated. It is 
> pretty simple implementation. All I am proposing is to have special 
> InstanceGetter class for collation sensitive DVDs. This new 
> InstanceGetter class will have RuleBasedCollator (which will be set the 
> first time this InstanceGetter is created for the given database through 
> the DVF) and it will have collation type(this collation type will always 
> be set to whatever collation type the 
> getInstanceGetterForFormatIDandCollationType was called with. This 
> collation type will determine which kind of DVD to generate ie one with 
> default collation or one with terriotry based collation). You mentioned 
> in your mail that "I got a little lost in the details". Please let me 
> know where it was unclear and I can try to explain it better.

Could you show an example of how the store will be calling the code you 
are describing? Maybe that would help me out.

> As for your question about "does it take account of the fact that the 
> registered format ids are system wide and there can be databases with 
> different default collations in the same system?" My understanding is 
> that there is one DVF per database and these InstanceGetters will be 
> saved on DVF and hence I do not forsee any problems in having multiple 
> databases with different collations in same Derby system.


View raw message