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 dj...@apache.org on 2005/05/31 21:18:43 UTC

svn commit: r179262 - in /incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile: ConstantNode.java NumericConstantNode.java NumericTypeCompiler.java

Author: djd
Date: Tue May 31 12:18:41 2005
New Revision: 179262

URL: http://svn.apache.org/viewcvs?rev=179262&view=rev
Log:
Remove casting of input values for DECIMAL to java.lang.Number
or java.math.BigDecimal for J2ME as BigDecimal is not supported
and thus no input values for DECIMAL map to Number. DECIMAL values
from constants are passed to the DataValueFactory as Strings for J2ME.

Modified:
    incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConstantNode.java
    incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NumericConstantNode.java
    incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NumericTypeCompiler.java

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConstantNode.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConstantNode.java?rev=179262&r1=179261&r2=179262&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConstantNode.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConstantNode.java Tue May 31 12:18:41 2005
@@ -240,15 +240,8 @@
 										// usually a literal like 'hello'
 
 			acb.generateDataValue(mb, getTypeCompiler(), (LocalField) null);
-
-			setConstantWidth(acb, mb);
 		}
 	}
-
-	// temp
-	void setConstantWidth(ExpressionClassBuilder acb, MethodBuilder mb) {
-	}
-
 
 	/**
 	 * This generates the proper constant.  It is implemented

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NumericConstantNode.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NumericConstantNode.java?rev=179262&r1=179261&r2=179262&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NumericConstantNode.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NumericConstantNode.java Tue May 31 12:18:41 2005
@@ -29,6 +29,7 @@
 import org.apache.derby.iapi.error.StandardException;
 
 import org.apache.derby.iapi.services.compiler.MethodBuilder;
+import org.apache.derby.iapi.services.info.JVMInfo;
 
 import org.apache.derby.iapi.types.TypeId;
 import org.apache.derby.iapi.types.DataTypeUtilities;
@@ -234,9 +235,13 @@
 			mb.push(value.getShort());
 			break;
 		case C_NodeTypes.DECIMAL_CONSTANT_NODE:
-			mb.pushNewStart("java.math.BigDecimal");
+			// No java.math.BigDecimal class in J2ME so the constant
+			// from the input SQL is handled directly as a String.
+			if (!JVMInfo.J2ME)
+				mb.pushNewStart("java.math.BigDecimal");
 			mb.push(value.getString());
-			mb.pushNewComplete(1);
+			if (!JVMInfo.J2ME)
+				mb.pushNewComplete(1);
 			break;
 		case C_NodeTypes.DOUBLE_CONSTANT_NODE:
 			mb.push(value.getDouble());

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NumericTypeCompiler.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NumericTypeCompiler.java?rev=179262&r1=179261&r2=179262&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NumericTypeCompiler.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NumericTypeCompiler.java Tue May 31 12:18:41 2005
@@ -28,6 +28,7 @@
 
 import org.apache.derby.iapi.services.sanity.SanityManager;
 
+import org.apache.derby.iapi.services.info.JVMInfo;
 import org.apache.derby.iapi.services.io.StoredFormatIds;
 
 import org.apache.derby.iapi.error.StandardException;
@@ -540,9 +541,12 @@
 	public void generateDataValue(MethodBuilder mb,
 										LocalField field)
 	{
-		if (getTypeId().isDecimalTypeId())
+		if (!JVMInfo.J2ME && getTypeId().isDecimalTypeId())
 		{
-			// cast the value to an object for method resolution
+			// cast the value to a Number (from BigDecimal) for method resolution
+			// For J2ME there is no implementation of Number for DECIMAL
+			// so values are handled as thier original type, which is just
+			// a String for DECIMAL constants from the parser.
 			mb.upCast("java.lang.Number");
 		}