You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ma...@apache.org on 2007/05/14 20:28:08 UTC

svn commit: r537940 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CharConstantNode.java

Author: mamta
Date: Mon May 14 11:28:07 2007
New Revision: 537940

URL: http://svn.apache.org/viewvc?view=rev&rev=537940
Log:
DERBY-2335
CharConstantNode (and every QueryTreeNode) has a getLanguageConnection() method that provides access to the current language connection. That call should get used in bindExpression rather than ConnectionUtil to get current language connection.



Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CharConstantNode.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CharConstantNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CharConstantNode.java?view=diff&rev=537940&r1=537939&r2=537940
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CharConstantNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CharConstantNode.java Mon May 14 11:28:07 2007
@@ -24,9 +24,6 @@
 import org.apache.derby.iapi.types.StringDataValue;
 import org.apache.derby.iapi.types.TypeId;
 
-import org.apache.derby.iapi.sql.conn.ConnectionUtil;
-import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
-
 import org.apache.derby.iapi.error.StandardException;
 
 import org.apache.derby.iapi.services.compiler.MethodBuilder;
@@ -36,7 +33,6 @@
 
 import org.apache.derby.iapi.util.ReuseFactory;
 
-import java.sql.Types;
 import java.util.Vector;
 
 public final class CharConstantNode extends ConstantNode
@@ -157,30 +153,23 @@
 			Vector	aggregateVector)
 	throws StandardException
 	{
-		try {
-			//The DTD for this character constant should get its collation type
-			//from the schema it is getting compiled in.
-			LanguageConnectionContext lcc = ConnectionUtil.getCurrentLCC();
-		    getTypeServices().setCollationType(lcc.getDefaultSchema().getCollationType());
-		    
-		    //Once we have the collation type, we should check if the value
-		    //associated with this node should change from 
-		    //SQLChar/SQLVarchar/SQLLongvarchar/SQLClob
-		    //to
-		    //CollatorSQLChar/CollatoSQLVarchar/CollatoSQLLongvarchar/CollatoSQLClob.
-		    //By default, the value associated with char constants are SQLxxx
-		    //kind because that is what is needed for UCS_BASIC collation. But
-		    //if at this bind time, we find that the char constant's collation
-		    //type is territory based, then we should change value from SQLxxx
-		    //to CollatorSQLxxx. That is what is getting done below.
-		    value = ((StringDataValue)value).getValue(
-		    		lcc.getDataValueFactory().getCharacterCollator(
-		    				getTypeServices().getCollationType()));
-		}
-		catch( java.sql.SQLException sqle)
-		{
-			throw StandardException.plainWrapException( sqle);
-		}
+		//The DTD for this character constant should get its collation type
+		//from the schema it is getting compiled in.
+		getTypeServices().setCollationType(
+				getLanguageConnectionContext().getDefaultSchema().getCollationType());
+	    //Once we have the collation type, we should check if the value
+	    //associated with this node should change from 
+	    //SQLChar/SQLVarchar/SQLLongvarchar/SQLClob
+	    //to
+	    //CollatorSQLChar/CollatoSQLVarchar/CollatoSQLLongvarchar/CollatoSQLClob.
+	    //By default, the value associated with char constants are SQLxxx
+	    //kind because that is what is needed for UCS_BASIC collation. But
+	    //if at this bind time, we find that the char constant's collation
+	    //type is territory based, then we should change value from SQLxxx
+	    //to CollatorSQLxxx. That is what is getting done below.
+	    value = ((StringDataValue)value).getValue(
+	    		getLanguageConnectionContext().getDataValueFactory().getCharacterCollator(
+	    				getTypeServices().getCollationType()));
 		return this;
 	}