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-2583) At code generation time, look at collation type to determine what kind of DVD should get generated for character types.
Date Tue, 24 Apr 2007 08:05:15 GMT

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

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

    Attachment: DERBY2583_generate_right_DVD_for_character_DTD_v1_stat.txt
                DERBY2583_generate_right_DVD_for_character_DTD_v1_diff.txt

Attaching patch, DERBY2583_generate_right_DVD_for_character_DTD_v1_diff.txt, which is not
ready for commit yet because I am still running the tests but wanted to put it out for review.
The files impacted in this patch are as follows
svn stat -q
M      java\engine\org\apache\derby\impl\sql\compile\CastNode.java
M      java\engine\org\apache\derby\impl\sql\compile\NotNode.java
M      java\engine\org\apache\derby\impl\sql\compile\NumericTypeCompiler.java
M      java\engine\org\apache\derby\impl\sql\compile\ResultColumn.java
M      java\engine\org\apache\derby\impl\sql\compile\UserDefinedTypeCompiler.java
M      java\engine\org\apache\derby\impl\sql\compile\SpecialFunctionNode.java
M      java\engine\org\apache\derby\impl\sql\compile\UserTypeConstantNode.java
M      java\engine\org\apache\derby\impl\sql\compile\JavaToSQLValueNode.java
M      java\engine\org\apache\derby\impl\sql\compile\UnaryComparisonOperatorNode.java
M      java\engine\org\apache\derby\impl\sql\compile\CLOBTypeCompiler.java
M      java\engine\org\apache\derby\impl\sql\compile\CurrentDatetimeOperatorNode.java
M      java\engine\org\apache\derby\impl\sql\compile\ConstantNode.java
M      java\engine\org\apache\derby\impl\sql\compile\BaseTypeCompiler.java
M      java\engine\org\apache\derby\impl\sql\compile\CurrentRowLocationNode.java
M      java\engine\org\apache\derby\impl\sql\compile\CoalesceFunctionNode.java
M      java\engine\org\apache\derby\impl\sql\compile\ExpressionClassBuilder.java
M      java\engine\org\apache\derby\impl\sql\compile\ConcatenationOperatorNode.java
M      java\engine\org\apache\derby\impl\sql\compile\CharTypeCompiler.java
M      java\engine\org\apache\derby\impl\sql\compile\ResultColumnList.java
M      java\engine\org\apache\derby\iapi\sql\compile\TypeCompiler.java

The patch mainly addresses how code generation should account for collation type when generating
DVDs for character types. In the past, there was one to one correspondance between a character
DTD and the corresponding DVD that got generated for it. Starting Derby 10.3, a DTD associated
with a character type can generate one of the 2 different kinds of DVDs and the DVD chosen
will depend on the collation type of the DTD. Note that this applies only to character types.


Character types that will have a collation of UCS_BASIC associated with them will continue
to generate what was generated in Derby 10.2 ie SQLChar/SQLVarchar/SQLLongvarchar/SQLClob.
But the character types that will have collation type of territory based associated with them
will now generate CollatorSQLChar/CollatorSQLVarchar/CollatorSQLLongvarchar/CollatorSQLClob.
This dependency of DVD type on collation type will be handled in classes ExpressionClassBuilder
and in TypeCompiler implementations.

CastNode, ConstantNode, NotNode, ResultColumn, SpecialFunctionNode, JavaToSQLValueNode, UnaryComparisonOperatorNode,
UserTypeConstantNode,
CurrentDatetimeOperatorNode, CurrentRowLocationNode, CoalesceFunctionNode, ConcatenationOperatorNode,
ResultColumnList : All of 
these compile time classes require code generation of DVDs. These classes now need to pass
the collation type of the DTD for which a DVD needs to be generated. This collation type will
be used to generate code for correct DVD.

The actual changes for generating the correct DVD went into CLOBTypeCompiler and CharTypeCompiler.
These 2 classes will first generate a DVD for character types w/o taking the collation type
into consideration. Then it will call a new method which is defined on the base class BaseTypeCompiler
and that new method is called generateCollationSensitiveDataValue. This new method will check
if the collation type is UCS_BASIC and if yes, then it will simply return because we have
already generated code for DVD with collation type of UCS_BASIC. But if the collation type
is territory based, then it will generate the additional
code of 
DVDwithUCS_BASIC.getValue(DVF.getCharacterCollator(collationType));
This generated code will make sure that the DVD generated has territory based collator associated
with it and the new DVD class will be of type CollatorSQLChar/CollatorSQLVarchar/CollatorSQLLongvarchar/CollatorSQLClob.
In order to generate the additional code above, we need to have DVF on the stack. This pusing
of DVF on stack will be done by the private method pushDataValueFactory defined on BaseTypeCompiler

Once the tests finish successfully, I will commit this patch. But will appreciate anyone looking
at this change and providing feedback.

> At code generation time, look at collation type to determine what kind of DVD should
get generated for character types.
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2583
>                 URL: https://issues.apache.org/jira/browse/DERBY-2583
>             Project: Derby
>          Issue Type: New Feature
>          Components: SQL
>    Affects Versions: 10.3.0.0
>            Reporter: Mamta A. Satoor
>         Assigned To: Mamta A. Satoor
>         Attachments: DERBY2583_generate_right_DVD_for_character_DTD_v1_diff.txt, DERBY2583_generate_right_DVD_for_character_DTD_v1_stat.txt
>
>
> Currently, in Derby 10.2, we generate SQLChar/SQLVarchar/SQLLongvarchar/SQLClob for various
SQL character types. All these DVDs have the default collation of UCS_BASIC. 
> Starting 10.3, we should look at the collation type of the DTD before deciding what kind
of DVD gets generated for SQL character types.  If the collation type of the character type
is terriotry based collation, then we should generate CollatorSQLChar/CollatorSQLVarchar/CollatorSQLLongvarchar/CollatorSQLClob
rather than SQLChar/SQLVarchar/SQLLongvarchar/SQLClob. The CollatorSQLxxx DVDs will have the
territory based collator associated with them and hence the collation order of these DVDs
will be different than the DVDs with default collation of UCS_BASIC. 

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


Mime
View raw message