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

Mamta A. Satoor updated DERBY-2336:
-----------------------------------

    Attachment: DERBY_LocalFinder_CodeCleanup_stat_V01.txt
                DERBY_LocalFinder_CodeCleanup_diff_V01.txt

I am continuing to work on Language Based Ordering. One thing this feature 
requires is that character datatypes datatypes should have access to 
LocaleFinder to know what collation they need to use. Currently, this gets done 
by going through DatabaseContext (this code is in SQLChar's getLocalFinder 
method. For SQLTime, SQLTimestamp, SQLDate, the code is in setValue(String 
theValue) method). But the problem with this code is that during restart 
recovery time, the DatabaseContext will not be available and hence locale can't 
be determined at restart recovery time. In order to fix that problem, in my 
attached patch DERBY_LocalFinder_CodeCleanup_diff_V01.txt, I am removing the 
LocaleFinder related code from BasicDatabase and instead moving it into 
RawStore. This will make sure that during restart recovery time, LocaleFinder 
info will be available because store context is available on the context 
manager at that time.

Another change I am making in this patch is to have the ContextManager keep 
track of current LocaleFinder so that character datatypes could get LocalFinder 
information more quickly rather than having to go through the store context in 
ContextManager's stack of contexts.

In addition to the changes mentioned above, I have removed some imports that 
are not really used by the classes involved in this patch.

There are no visible end-user effects of any of the above mentioned changes but 
this groundwork will be required later on when the collation is enabled for 
SQLChar datatype.

svn stat -q output is as follows
M      java\engine\org\apache\derby\impl\db\BasicDatabase.java
M      java\engine\org\apache\derby\impl\store\raw\xact\XactFactory.java
M      java\engine\org\apache\derby\impl\store\raw\RawStore.java
M      java\engine\org\apache\derby\iapi\services\context\ContextManager.java
M      java\engine\org\apache\derby\iapi\types\SQLChar.java
M      java\engine\org\apache\derby\iapi\types\SQLDate.java
M      java\engine\org\apache\derby\iapi\types\SQLTime.java
M      java\engine\org\apache\derby\iapi\types\DataValueFactoryImpl.java
M      java\engine\org\apache\derby\iapi\types\SQLTimestamp.java
M      java\engine\org\apache\derby\iapi\db\Database.java
M      java\engine\org\apache\derby\iapi\store\raw\RawStoreFactory.java
M      java\engine\org\apache\derby\database\Database.java

The patch description per class wise is as follows
1)BasicDatabase - 
a)removed unused imports
b)removed code which was implementing LocalFinder methods because this class is 
not implementing LocaleFinder anymore. The LocaleFinder implementation will be 
provided at the store level. 
c)I didn't remove the getLocale method from this class becasue we have few 
tests that rely on this internal public Derby api. The use of this can be found 
in functionTests/conn/DefaultLocale.java's checkDatabaseLocale method. I will 
file a jira entry for this because I don't think our test should be going 
against internal Derby api. 
2)RawStore
a)This class now implements LocaleFinder interface so later in XactFactory, 
RawStore instance can be passed to the ContextManager. This way, LocaleFinder 
info will be available at Derby's restart recovery time.
b)also removed some unused import statements.
3)XactFactory
The change in this class passes the RawStore instance to ContextManager's 
setLocaleFinder info.
4)ContextManager
This class now provides a getLocalFinder method to return the local info. Prior 
to this, the callers had to go through the stack of contexts to find the 
database context to get the LocaleFinder info.
5)SQLChar, SQLDate, SQLTime, SQLTimestamp, DataValueFactoryImpl
All of these classes now get the LocaleFinder info by directly calling the 
getLocaleFinder method on ContextManager.
6)iapi/db/Database.java
This interface doesn't extend LocaleFinder interface anymore. Also, took out 
some unused import statements.
7)RawStoreFactory now extends LocaleFinder interface. Also, took out some 
unused import statements.
8)database/Database.java
The existing getLocale method now can throw exception because it goes through 
ContextManager to get the locale info. I will file a jira entry for this method 
because the only purpose of this method is to allow some existing tests to get 
the locale info by calling this internal api. 


> Enable collation based ordering for CHAR data type.
> ---------------------------------------------------
>
>                 Key: DERBY-2336
>                 URL: https://issues.apache.org/jira/browse/DERBY-2336
>             Project: Derby
>          Issue Type: Sub-task
>          Components: SQL
>    Affects Versions: 10.3.0.0
>            Reporter: Mamta A. Satoor
>         Attachments: DERBY_LocalFinder_CodeCleanup_diff_V01.txt, 
> DERBY_LocalFinder_CodeCleanup_stat_V01.txt
>
>
> I am breaking down the Parent task DERBY-1478 (Add built in language based 
> ordering and like processing to Derby) into multiple sub tasks. One of them 
> is to concentrate on enabling the collation based ordering on (hopefully the 
> simplest of all the character data types) CHAR data type. This task in itself 
> might need subtasks if it is later found that it can be subdivided into 
> multiple smaller steps.

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

Reply via email to