db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r532082 - in /db/derby/code/trunk/java/engine/org/apache/derby: iapi/sql/compile/ impl/sql/compile/
Date Tue, 24 Apr 2007 21:06:23 GMT
Author: mamta
Date: Tue Apr 24 14:06:22 2007
New Revision: 532082

URL: http://svn.apache.org/viewvc?view=rev&rev=532082
Log:
DERBY-2583 This commit 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 


Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/compile/TypeCompiler.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseTypeCompiler.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CLOBTypeCompiler.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CastNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CharTypeCompiler.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CoalesceFunctionNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConcatenationOperatorNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConstantNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CurrentDatetimeOperatorNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CurrentRowLocationNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ExpressionClassBuilder.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JavaToSQLValueNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NotNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NumericTypeCompiler.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumn.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SpecialFunctionNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UnaryComparisonOperatorNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UserDefinedTypeCompiler.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UserTypeConstantNode.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/compile/TypeCompiler.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/compile/TypeCompiler.java?view=diff&rev=532082&r1=532081&r2=532082
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/compile/TypeCompiler.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/compile/TypeCompiler.java Tue
Apr 24 14:06:22 2007
@@ -27,7 +27,6 @@
 import org.apache.derby.iapi.services.compiler.LocalField;
 
 import org.apache.derby.iapi.types.DataTypeDescriptor;
-import org.apache.derby.iapi.types.DataValueDescriptor;
 import org.apache.derby.iapi.types.TypeId;
 
 import org.apache.derby.iapi.error.StandardException;
@@ -177,13 +176,16 @@
 	/**
 	 * Generate the code necessary to produce a SQL null of the appropriate
 	 * type. The stack must contain a DataValueFactory and a null or a value
-	   of the correct type (interfaceName()).
+	 * of the correct type (interfaceName()).
 	 *
 	 * @param mb	The method to put the expression in
-	 *
+	 * @param collationType For character DVDs, this will be used to determine
+	 *   what Collator should be associated with the DVD which in turn will 
+	 *   decide whether to generate CollatorSQLcharDVDs or SQLcharDVDs.
+	 * @param className name of the base class of the activation's hierarchy
 	 */
 
-	void			generateNull(MethodBuilder mb);
+	void generateNull(MethodBuilder mb, int collationType, String className);
 
 
 	/**
@@ -195,13 +197,19 @@
 	 *
 	 * If the type of the value is incorrect, the generated code will
 	 * not work.
-
-       The stack must contain
-			data value factory
-			value
-	 *
+	 * 
+	 * The stack must contain data value factory value.
+	 * 
+	 * @param mb	The method to put the expression in
+	 * @param collationType For character DVDs, this will be used to determine
+	 *   what Collator should be associated with the DVD which in turn will 
+	 *   decide whether to generate CollatorSQLcharDVDs or SQLcharDVDs. For 
+	 *   other types of DVDs, this parameter will be ignored.
+	 * @param className name of the base class of the activation's hierarchy
+	 * @param field LocalField
 	 */
-	void			generateDataValue(MethodBuilder eb, LocalField field);
+	void generateDataValue(MethodBuilder eb, int collationType, 
+			String className, LocalField field);
 
 	/**
 	 * Return the maximum width for this data type when cast to a char type.

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseTypeCompiler.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseTypeCompiler.java?view=diff&rev=532082&r1=532081&r2=532082
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseTypeCompiler.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseTypeCompiler.java
Tue Apr 24 14:06:22 2007
@@ -27,18 +27,14 @@
 import org.apache.derby.iapi.services.sanity.SanityManager;
 
 import org.apache.derby.iapi.error.StandardException;
-import org.apache.derby.iapi.sql.conn.ConnectionUtil;
 
 import org.apache.derby.iapi.sql.compile.TypeCompiler;
 
-import org.apache.derby.iapi.types.BitDataValue;
-import org.apache.derby.iapi.types.DataValueFactory;
-import org.apache.derby.iapi.types.DataValueDescriptor;
+import org.apache.derby.iapi.types.StringDataValue;
 import org.apache.derby.iapi.types.TypeId;
 
 import org.apache.derby.iapi.types.DataTypeDescriptor;
 
-import org.apache.derby.iapi.reference.SQLState;
 import org.apache.derby.iapi.reference.ClassName;
 
 import org.apache.derby.iapi.services.compiler.LocalField;
@@ -46,8 +42,6 @@
 
 import org.apache.derby.iapi.services.classfile.VMOpcode;
 
-import java.sql.Types;
-
 /**
  * This is the base implementation of TypeCompiler
  *
@@ -99,9 +93,9 @@
 										);
 	}
 
-	/** @see TypeCompiler#generateNull */
-
-	public void generateNull(MethodBuilder mb)
+	/** @see TypeCompiler#generateNull(MethodBuilder, int, String) */
+	public void generateNull(MethodBuilder mb, int collationType, 
+			String className)
 	{
 		mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null,
 									nullMethodName(),
@@ -109,9 +103,9 @@
 									1);
 	}
 
-	/** @see TypeCompiler#generateDataValue */
-	public void generateDataValue(MethodBuilder mb,
-										LocalField field)
+	/** @see TypeCompiler#generateDataValue(MethodBuilder, int, String, LocalField) */
+	public void generateDataValue(MethodBuilder mb, int collationType,
+			String className, LocalField field)
 	{
 		String				interfaceName = interfaceName();
 
@@ -130,7 +124,6 @@
 			mb.getField(field);
 		}
 
-
 		mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null,
 							dataValueMethodName(),
 							interfaceName,
@@ -143,6 +136,71 @@
 			 */
 			mb.putField(field);
 		}
+	}
+
+	/**
+	 * If the collation type is UCS_BASIC, then we have already generated the
+	 * code for the correct DVD and hence simply return from this method. 
+	 * 
+	 * But if the collation type is territory based and we are generating DVDs
+	 * for character types, then we need to generate CollatorSQLxxx type of 
+	 * DVD. This CollatorSQLxxx DVD will be provided by generating following 
+	 * code which works on top of the DVD that has been generated with 
+	 * UCS_BASIC collation.
+	 * DVDwithUCS_BASIC.getValue(DVF.getCharacterCollator(collationType));
+	 * 
+	 * This method will be called only by CharTypeCompiler and ClobTypeCompiler 
+	 * because those are the only type compilers who generate DVDs which are 
+	 * impacted by the collation. Rest of the TypeCompilers generate DVDs which
+	 * are collation in-sensitive.
+	 * 
+	 * @param mb The method to put the expression in
+	 * @param collationType For character DVDs, this will be used to determine
+	 *   what Collator should be associated with the DVD which in turn will 
+	 *   decide whether to generate CollatorSQLcharDVDs or SQLcharDVDs. For 
+	 *   other types of DVDs, this parameter will be ignored.
+	 * @param className name of the base class of the activation's hierarchy
+	 */
+	protected void generateCollationSensitiveDataValue(MethodBuilder mb, 
+			int collationType, String className){		
+		if (collationType == StringDataValue.COLLATION_TYPE_UCS_BASIC)
+			return; 
+		//In case of character DVDs, for territory based collation, we need to 
+		//generate DVDs with territory based RuleBasedCollator and hence we 
+		//need to generate CollatorSQLChar/CollatorSQLVarchar/
+		//CollatorSQLLongvarchar/CollatorSQLClob 
+		pushDataValueFactory(mb, className);
+		mb.push(collationType);
+		mb.callMethod(VMOpcode.INVOKEINTERFACE, null, "getCharacterCollator",
+				"java.text.RuleBasedCollator", 1);
+		mb.callMethod(VMOpcode.INVOKEINTERFACE, null, "getValue", interfaceName(), 1);
+	}
+	
+	private Object getDVF;
+	/**
+	 * This method will push a DVF on the stack. This DVF is required to get
+	 * the territory based collator using the collation type. In other words,
+	 * this DVF will be used to generate something like following
+	 * DVF.getCharacterCollator(collationType)
+	 * 
+	 * @param mb The method to put the expression in
+	 * @param className name of the base class of the activation's hierarchy
+	 */
+	private void pushDataValueFactory(MethodBuilder mb, String className)
+	{
+		// generates:
+		//	   getDataValueFactory()
+		//
+
+		if (getDVF == null) {
+			getDVF = mb.describeMethod(VMOpcode.INVOKEVIRTUAL,
+										className,
+										"getDataValueFactory",
+										ClassName.DataValueFactory);
+		}
+
+		mb.pushThis();
+		mb.callMethod(getDVF);
 	}
 
 	protected abstract String nullMethodName();

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CLOBTypeCompiler.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CLOBTypeCompiler.java?view=diff&rev=532082&r1=532081&r2=532082
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CLOBTypeCompiler.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CLOBTypeCompiler.java
Tue Apr 24 14:06:22 2007
@@ -21,17 +21,12 @@
 
 package org.apache.derby.impl.sql.compile;
 
-import org.apache.derby.iapi.reference.SQLState;
-
 import org.apache.derby.iapi.services.loader.ClassFactory;
 import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.iapi.services.compiler.LocalField;
+import org.apache.derby.iapi.services.compiler.MethodBuilder;
 import org.apache.derby.iapi.services.io.StoredFormatIds;
 
-import org.apache.derby.iapi.error.StandardException;
-import org.apache.derby.iapi.sql.conn.ConnectionUtil;
-
-import org.apache.derby.iapi.types.BitDataValue;
-import org.apache.derby.iapi.types.DataValueFactory;
 import org.apache.derby.iapi.types.TypeId;
 
 import org.apache.derby.iapi.types.DataTypeDescriptor;
@@ -40,9 +35,6 @@
 
 import org.apache.derby.iapi.reference.ClassName;
 
-import java.sql.Types;
-import org.apache.derby.iapi.reference.JDBC20Translation;
-
 /**
  * This class implements TypeCompiler for the SQL LOB types.
  *
@@ -147,4 +139,20 @@
                     return null;
                 }
         }
+
+    	/** @see TypeCompiler#generateDataValue(MethodBuilder, int, String, LocalField) */
+    	public void generateDataValue(MethodBuilder mb, int collationType,
+    			String className, LocalField field)
+    	{
+    		super.generateDataValue(mb, collationType, className, field);
+    		generateCollationSensitiveDataValue(mb, collationType, className);
+    	}
+
+    	/** @see TypeCompiler#generateNull(MethodBuilder, int, String) */
+    	public void generateNull(MethodBuilder mb, int collationType, 
+    			String className)
+    	{
+    		super.generateNull(mb, collationType, className);
+    		generateCollationSensitiveDataValue(mb, collationType, className);
+    	}
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CastNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CastNode.java?view=diff&rev=532082&r1=532081&r2=532082
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CastNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CastNode.java Tue Apr
24 14:06:22 2007
@@ -909,7 +909,8 @@
 		** the object.
 		*/
 
-		acb.generateNull(acbConstructor, getTypeCompiler(destCTI));
+		acb.generateNull(acbConstructor, getTypeCompiler(destCTI), 
+				castTarget.getCollationType());
 		acbConstructor.setField(field);
 
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CharTypeCompiler.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CharTypeCompiler.java?view=diff&rev=532082&r1=532081&r2=532082
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CharTypeCompiler.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CharTypeCompiler.java
Tue Apr 24 14:06:22 2007
@@ -25,24 +25,16 @@
 
 import org.apache.derby.iapi.services.sanity.SanityManager;
 
+import org.apache.derby.iapi.services.compiler.LocalField;
+import org.apache.derby.iapi.services.compiler.MethodBuilder;
 import org.apache.derby.iapi.services.io.StoredFormatIds;
 
-import org.apache.derby.iapi.error.StandardException;
-
-import org.apache.derby.iapi.types.StringDataValue;
-import org.apache.derby.iapi.types.DataValueDescriptor;
 import org.apache.derby.iapi.types.TypeId;
 import org.apache.derby.iapi.types.DataTypeDescriptor;
 
 import org.apache.derby.iapi.sql.compile.TypeCompiler;
 
 import org.apache.derby.iapi.reference.ClassName;
-import org.apache.derby.iapi.reference.SQLState;
-
-import org.apache.derby.iapi.util.StringUtil;
-
-import java.sql.Types;
-import org.apache.derby.iapi.reference.JDBC20Translation;
 
 /**
  * This class implements TypeCompiler for the SQL char datatypes.
@@ -199,6 +191,22 @@
                                 return null;
                 }
         }
+
+    	/** @see TypeCompiler#generateDataValue(MethodBuilder, int, String, LocalField) */
+    	public void generateDataValue(MethodBuilder mb, int collationType,
+    			String className, LocalField field)
+    	{
+    		super.generateDataValue(mb, collationType, className, field);
+    		generateCollationSensitiveDataValue(mb, collationType, className);
+    	}
+
+    	/** @see TypeCompiler#generateNull(MethodBuilder, int, String) */
+    	public void generateNull(MethodBuilder mb, int collationType, 
+    			String className)
+    	{
+    		super.generateNull(mb, collationType, className);
+    		generateCollationSensitiveDataValue(mb, collationType, className);
+    	}
 
         protected String dataValueMethodName()
         {

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CoalesceFunctionNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CoalesceFunctionNode.java?view=diff&rev=532082&r1=532081&r2=532082
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CoalesceFunctionNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CoalesceFunctionNode.java
Tue Apr 24 14:06:22 2007
@@ -288,7 +288,7 @@
 		//Following is for the second arg. This arg will be used to pass the return value.
 		//COALESCE method expects this to be initialized to NULL SQLxxx type object.
 		LocalField field = acb.newFieldDeclaration(Modifier.PRIVATE, receiverType);
-		acb.generateNull(mb, getTypeCompiler());
+		acb.generateNull(mb, getTypeCompiler(), getTypeServices().getCollationType());
 		mb.upCast(ClassName.DataValueDescriptor);
 		mb.putField(field);
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConcatenationOperatorNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConcatenationOperatorNode.java?view=diff&rev=532082&r1=532081&r2=532082
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConcatenationOperatorNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConcatenationOperatorNode.java
Tue Apr 24 14:06:22 2007
@@ -494,7 +494,8 @@
 	throws StandardException
 	{
 		mb.conditionalIfNull();//get the field on the stack and if it is null
-			acb.generateNull(mb, getTypeCompiler());// yes, it is, hence create a NULL SQLxxx type
object and put that on stack
+			acb.generateNull(mb, getTypeCompiler(),
+					getTypeServices().getCollationType());// yes, it is, hence create a NULL SQLxxx type
object and put that on stack
 		mb.startElseCode(); //no, it is not null
 			mb.getField(resultField); //so put it back on the stack
 		mb.completeConditional(); //complete if else block

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConstantNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConstantNode.java?view=diff&rev=532082&r1=532081&r2=532082
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConstantNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConstantNode.java Tue
Apr 24 14:06:22 2007
@@ -22,28 +22,20 @@
 package	org.apache.derby.impl.sql.compile;
 
 import org.apache.derby.iapi.types.DataValueDescriptor;
-import org.apache.derby.iapi.types.TypeId;
-import org.apache.derby.iapi.sql.dictionary.DataDictionary;
 
 import org.apache.derby.iapi.error.StandardException;
 
 import org.apache.derby.iapi.services.compiler.MethodBuilder;
 import org.apache.derby.iapi.services.compiler.LocalField;
 
-import org.apache.derby.impl.sql.compile.ExpressionClassBuilder;
-
-import java.lang.reflect.Modifier;
-
 import org.apache.derby.iapi.services.sanity.SanityManager;
 
+import org.apache.derby.impl.sql.compile.ExpressionClassBuilder;
+
 import org.apache.derby.iapi.store.access.Qualifier;
 
 import org.apache.derby.iapi.util.ReuseFactory;
 
-import java.sql.Date;
-import java.sql.Time;
-import java.sql.Timestamp;
-
 import java.util.Vector;
 
 /**
@@ -228,14 +220,16 @@
 		/* Are we generating a SQL null value? */
 	    if (isNull())
 	    {
-			acb.generateNull(mb, getTypeCompiler());
+			acb.generateNull(mb, getTypeCompiler(), 
+					getTypeServices().getCollationType());
 		}
 		else
 		{
 			generateConstant(acb, mb);	// ask sub type to give a constant,
 										// usually a literal like 'hello'
 
-			acb.generateDataValue(mb, getTypeCompiler(), (LocalField) null);
+			acb.generateDataValue(mb, getTypeCompiler(), 
+					getTypeServices().getCollationType(), (LocalField) null);
 		}
 	}
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CurrentDatetimeOperatorNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CurrentDatetimeOperatorNode.java?view=diff&rev=532082&r1=532081&r2=532082
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CurrentDatetimeOperatorNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CurrentDatetimeOperatorNode.java
Tue Apr 24 14:06:22 2007
@@ -159,7 +159,8 @@
 				break;
 		}
 
-		acb.generateDataValue(mb, getTypeCompiler(), (LocalField)null);
+		acb.generateDataValue(mb, getTypeCompiler(), 
+				getTypeServices().getCollationType(), (LocalField)null);
 	}
 
 	/*

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CurrentRowLocationNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CurrentRowLocationNode.java?view=diff&rev=532082&r1=532081&r2=532082
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CurrentRowLocationNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CurrentRowLocationNode.java
Tue Apr 24 14:06:22 2007
@@ -142,7 +142,8 @@
 		mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null, "getRowLocation", ClassName.RowLocation,
0);
 
 
-		acb.generateDataValue(mb, getTypeCompiler(), field);
+		acb.generateDataValue(mb, getTypeCompiler(), 
+				getTypeServices().getCollationType(), field);
 
 		/*
 		** Store the result of the method call in the field, so we can re-use

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ExpressionClassBuilder.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ExpressionClassBuilder.java?view=diff&rev=532082&r1=532081&r2=532082
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ExpressionClassBuilder.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ExpressionClassBuilder.java
Tue Apr 24 14:06:22 2007
@@ -867,10 +867,10 @@
 		Nothing is required on the stack, a SQL null data value
 		is pushed.
 	*/
-	void generateNull(MethodBuilder mb, TypeCompiler tc) {
+	void generateNull(MethodBuilder mb, TypeCompiler tc, int collationType) {
 		pushDataValueFactory(mb);
 		mb.pushNull(tc.interfaceName());
-		tc.generateNull(mb);
+		tc.generateNull(mb, collationType, getBaseClassName());
 	}
 
 	/**
@@ -878,11 +878,12 @@
 		The express value is required on the stack and will be popped, a SQL null data value
 		is pushed.
 	*/
-	void generateNullWithExpress(MethodBuilder mb, TypeCompiler tc) {
+	void generateNullWithExpress(MethodBuilder mb, TypeCompiler tc, 
+			int collationType) {
 		pushDataValueFactory(mb);
 		mb.swap(); // need the dvf as the instance
 		mb.cast(tc.interfaceName());
-		tc.generateNull(mb);
+		tc.generateNull(mb, collationType, getBaseClassName());
 	}
 
 	/**
@@ -891,10 +892,11 @@
 		on the stack and will be popped, a SQL data value
 		is pushed.
 	*/
-	void generateDataValue(MethodBuilder mb, TypeCompiler tc, LocalField field) {
+	void generateDataValue(MethodBuilder mb, TypeCompiler tc, 
+			int collationType, LocalField field) {
 		pushDataValueFactory(mb);
 		mb.swap(); // need the dvf as the instance
-		tc.generateDataValue(mb, field);
+		tc.generateDataValue(mb, collationType, getBaseClassName(), field);
 	}
 
 	

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JavaToSQLValueNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JavaToSQLValueNode.java?view=diff&rev=532082&r1=532081&r2=532082
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JavaToSQLValueNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/JavaToSQLValueNode.java
Tue Apr 24 14:06:22 2007
@@ -142,7 +142,8 @@
 
 			mb.conditionalIfNull();
 			mb.getField(nullValueField);
-			acb.generateNullWithExpress(mb, getTypeCompiler());
+			acb.generateNullWithExpress(mb, getTypeCompiler(), 
+					getTypeServices().getCollationType());
 
 
 			/*
@@ -165,7 +166,8 @@
 		javaNode.generateExpression(acb, mb);
 
 		/* Generate the SQL value, which is always nullable */
-		acb.generateDataValue(mb, tc, field);
+		acb.generateDataValue(mb, tc, 
+				getTypeServices().getCollationType(), field);
 
 		/*
 		** If there was a receiver, the return value will be the result

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NotNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NotNode.java?view=diff&rev=532082&r1=532081&r2=532082
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NotNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NotNode.java Tue Apr
24 14:06:22 2007
@@ -120,7 +120,8 @@
 
 		// arg 2
 		mb.push(false);
-		acb.generateDataValue(mb, getTypeCompiler(), field);
+		acb.generateDataValue(mb, getTypeCompiler(), 
+				getTypeServices().getCollationType(), field);
 		mb.upCast(ClassName.DataValueDescriptor);
 
 		mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null, "equals", interfaceName, 2);

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NumericTypeCompiler.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NumericTypeCompiler.java?view=diff&rev=532082&r1=532081&r2=532082
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NumericTypeCompiler.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NumericTypeCompiler.java
Tue Apr 24 14:06:22 2007
@@ -530,8 +530,8 @@
 	}
 
 
-	public void generateDataValue(MethodBuilder mb,
-										LocalField field)
+	public void generateDataValue(MethodBuilder mb, int collationType,
+			String className, LocalField field)
 	{
 		if (!JVMInfo.J2ME && getTypeId().isDecimalTypeId())
 		{
@@ -542,7 +542,7 @@
 			mb.upCast("java.lang.Number");
 		}
 
-		super.generateDataValue(mb, field);
+		super.generateDataValue(mb, collationType, className, field);
 	}
 
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumn.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumn.java?view=diff&rev=532082&r1=532081&r2=532082
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumn.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumn.java Tue
Apr 24 14:06:22 2007
@@ -933,7 +933,7 @@
 		// generate expression of the form
 		// (DataValueDescriptor) columnSpace
 
-		acb.generateNull(mb, getTypeCompiler());
+		acb.generateNull(mb, getTypeCompiler(), getTypeServices().getCollationType());
 		mb.upCast(ClassName.DataValueDescriptor);
 	}
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java?view=diff&rev=532082&r1=532081&r2=532082
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
Tue Apr 24 14:06:22 2007
@@ -1169,8 +1169,8 @@
 				userExprFun.callMethod(VMOpcode.INVOKEINTERFACE, ClassName.Row, "getColumn",
 					ClassName.DataValueDescriptor, 1); // the express
 
-				acb.generateNullWithExpress(userExprFun, rc.getTypeCompiler());
-
+				acb.generateNullWithExpress(userExprFun, rc.getTypeCompiler(),
+						rc.getTypeServices().getCollationType());
 			}
 			else
 			{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SpecialFunctionNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SpecialFunctionNode.java?view=diff&rev=532082&r1=532081&r2=532082
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SpecialFunctionNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SpecialFunctionNode.java
Tue Apr 24 14:06:22 2007
@@ -206,7 +206,8 @@
 		String fieldType = getTypeCompiler().interfaceName();
 		LocalField field = acb.newFieldDeclaration(Modifier.PRIVATE, fieldType);
 
-		acb.generateDataValue(mb, getTypeCompiler(), field);
+		acb.generateDataValue(mb, getTypeCompiler(), 
+				getTypeServices().getCollationType(), field);
 	}
 
 	/*

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UnaryComparisonOperatorNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UnaryComparisonOperatorNode.java?view=diff&rev=532082&r1=532081&r2=532082
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UnaryComparisonOperatorNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UnaryComparisonOperatorNode.java
Tue Apr 24 14:06:22 2007
@@ -301,7 +301,8 @@
 												MethodBuilder mb)
 						throws StandardException
 	{
-		acb.generateNull(mb, operand.getTypeCompiler());
+		acb.generateNull(mb, operand.getTypeCompiler(), 
+				operand.getTypeServices().getCollationType());
 	}
 
 	/** @see RelationalOperator#getStartOperator */
@@ -349,7 +350,8 @@
 		MethodBuilder qualMethod = acb.newUserExprFun();
 
 		/* Generate a method that returns that expression */
-		acb.generateNull(qualMethod, operand.getTypeCompiler());
+		acb.generateNull(qualMethod, operand.getTypeCompiler(),
+				operand.getTypeServices().getCollationType());
 		qualMethod.methodReturn();
 		qualMethod.complete();
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UserDefinedTypeCompiler.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UserDefinedTypeCompiler.java?view=diff&rev=532082&r1=532081&r2=532082
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UserDefinedTypeCompiler.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UserDefinedTypeCompiler.java
Tue Apr 24 14:06:22 2007
@@ -118,13 +118,13 @@
 		return "getNullObject";
 	}
 
-	public void generateDataValue(MethodBuilder mb,
-										LocalField field)
+	public void generateDataValue(MethodBuilder mb, int collationType,
+			String className, LocalField field)
 	{
 		// cast the value to an object for method resolution
 		mb.upCast("java.lang.Object");
 
-		super.generateDataValue(mb, field);
+		super.generateDataValue(mb, collationType, className, field);
 	}
 
 		

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UserTypeConstantNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UserTypeConstantNode.java?view=diff&rev=532082&r1=532081&r2=532082
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UserTypeConstantNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UserTypeConstantNode.java
Tue Apr 24 14:06:22 2007
@@ -246,7 +246,7 @@
 		/* Are we generating a SQL null value? */
 	    if (value == null)
 	    {
-			acb.generateNull(mb, tc);
+			acb.generateNull(mb, tc, getTypeServices().getCollationType());
 	    }
         // The code generated here is invoked when the generated class is constructed. However
the prepared statement
         // is not set into the activation class when it is constructed, but later. So we
cannot use the getSavedObject
@@ -289,7 +289,7 @@
 
 			LocalField field = acb.newFieldDeclaration(Modifier.PRIVATE, fieldType);
 
-			acb.generateDataValue(mb, tc, field);
+			acb.generateDataValue(mb, tc, getTypeServices().getCollationType(), field);
 		}
 	}
 



Mime
View raw message