db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mamta Satoor" <msat...@gmail.com>
Subject Code generation for DERBY-1478 ie generating DVDs of type CollatorSQLxxx vs SQLxxx
Date Mon, 23 Apr 2007 16:56:15 GMT
Hi,

Currently, the DVD code generation is done by ExpressionClassBuilder using
the method
void generateDataValue(MethodBuilder mb, TypeCompiler tc, LocalField field)
{
  pushDataValueFactory(mb);
  mb.swap(); // need the dvf as the instance
  tc.generateDataValue(mb, field);
 }

When dealing with character types, we want to generate either CollatorSQLxxx
or SQLxxx (where xxx is Char, Longvarch, Varchar or Clob) depending on the
collation type, ie we want to generate code like following for character
types
DVD = new SQLxxx();
DVD = DVD.getValue(DVF.getCharacterCollator(collationType));
return DVD;

But currently, the collation type does not get passed to
ExpressionClassBuilder.generateDataValue and it is not available to
TypeCompiler. So, what I am proposing is change
ExpressionClassBuilder.generateDataValue to take collation type as parameter
as shown below and pass the collation type to TypeCompiler.generateDataValue
 void generateDataValue(MethodBuilder mb, TypeCompiler tc, int
collationType, LocalField field) {
  pushDataValueFactory(mb);
  mb.swap(); // need the dvf as the instance
  tc.generateDataValue(mb, collationType, field);
 }

CharTypeCompiler will be the only one which will utilize the collation type.
Currently, generateDataValue is implemented by BaseTypeCompiler only. Now,
CharTypeCompiler will overwrite generateDataValue and it will generate the
additional code for DVD.getValue(DVF.getCharacterCollator(collationType));

Please let me know if anyone has any thoughts on this approach. I will start
investigating further into this.

Thanks,
Mamta

Mime
View raw message