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/02/12 23:51:15 UTC

svn commit: r153571 - in incubator/derby/code/trunk/java/engine/org/apache/derby: ./ iapi/types/

Author: djd
Date: Sat Feb 12 14:51:10 2005
New Revision: 153571

URL: http://svn.apache.org/viewcvs?view=rev&rev=153571
Log:
Remove DatavalueDescriptor.getBigDecimal and completely isolate
java.math.BigDecimal from type system and J2ME code.
Make DataValueFactoryImpl abstract and add new J2SEDataValueFactory
as the concrete class that returns SQLDecimal as the DataValueDescriptor
implementation for the DECIMAL type.


Added:
    incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/J2SEDataValueFactory.java
Modified:
    incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataType.java
    incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueDescriptor.java
    incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactory.java
    incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactoryImpl.java
    incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLBoolean.java
    incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLChar.java
    incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLClob.java
    incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDecimal.java
    incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDouble.java
    incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLInteger.java
    incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLLongint.java
    incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLReal.java
    incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLSmallint.java
    incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLTinyint.java
    incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/UserType.java
    incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/build.xml
    incubator/derby/code/trunk/java/engine/org/apache/derby/modules.properties

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataType.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataType.java?view=diff&r1=153570&r2=153571
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataType.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataType.java Sat Feb 12 14:51:10 2005
@@ -20,30 +20,23 @@
 
 package org.apache.derby.iapi.types;
 
-import org.apache.derby.iapi.types.TypeId;
 import org.apache.derby.iapi.types.DataValueDescriptor;
 import org.apache.derby.iapi.types.DataTypeDescriptor;
 import org.apache.derby.iapi.types.BooleanDataValue;
 import org.apache.derby.iapi.types.CloneableObject;
-import org.apache.derby.iapi.types.RowLocation;
 import org.apache.derby.iapi.types.Orderable;
 
 import org.apache.derby.iapi.reference.SQLState;
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.services.i18n.MessageService;
 import org.apache.derby.iapi.services.sanity.SanityManager;
-import org.apache.derby.iapi.services.context.ContextService;
-
-import org.apache.derby.iapi.services.io.FormatableBitSet;
 
 import org.apache.derby.iapi.services.i18n.LocaleFinder;
 
-import java.io.IOException;
 import java.io.InputStream;
 import java.sql.Date;
 import java.sql.Time;
 import java.sql.Timestamp;
-import java.math.BigDecimal;
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
 import java.sql.ResultSet;
@@ -167,18 +160,6 @@
 		throw dataTypeConversion("double");
 	}
 
-	/**
-	 * Gets the value in the data value descriptor as a BigDecimal.
-	 * Throws an exception if the data value is not receivable as a BigDecimal.
-	 *
-	 * @return	The data value as a java.lang.BigDecimal.
-	 *
-	 * @exception StandardException		Thrown on error
-	 */
-	public BigDecimal	getBigDecimal() throws StandardException
-	{
-		throw dataTypeConversion("java.math.BigDecimal");
-	}
 	public int typeToBigDecimal() throws StandardException
 	{
 		throw dataTypeConversion("java.math.BigDecimal");

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueDescriptor.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueDescriptor.java?view=diff&r1=153570&r2=153571
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueDescriptor.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueDescriptor.java Sat Feb 12 14:51:10 2005
@@ -21,16 +21,13 @@
 package org.apache.derby.iapi.types;
 
 import org.apache.derby.iapi.services.io.ArrayInputStream;
-import org.apache.derby.iapi.services.io.FormatableBitSet;
 
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.types.Orderable;
-import org.apache.derby.iapi.types.RowLocation;
 import org.apache.derby.iapi.services.io.Storable;
 
 import java.io.InputStream;
 import java.io.IOException;
-import java.math.BigDecimal;
 import java.sql.Date;
 import java.sql.ResultSet;
 import java.sql.PreparedStatement;
@@ -198,16 +195,6 @@
 	 * @exception StandardException   Thrown on error
 	 */
 	double	getDouble() throws StandardException;
-
-	/**
-	 * Gets the value in the data value descriptor as a BigDecimal.
-	 * Throws an exception if the data value is not a BigDecimal.
-	 *
-	 * @return	The data value as a java.math.BigDecimal.
-	 *
-	 * @exception StandardException   Thrown on error
-	 */
-	BigDecimal	getBigDecimal() throws StandardException;
 	
 	/**
 	 * How should this value be obtained so that it can

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactory.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactory.java?view=diff&r1=153570&r2=153571
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactory.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactory.java Sat Feb 12 14:51:10 2005
@@ -20,20 +20,14 @@
 
 package org.apache.derby.iapi.types;
 
-import org.apache.derby.iapi.types.TypeId;
-
 import org.apache.derby.iapi.types.RowLocation;
 
 import org.apache.derby.iapi.error.StandardException;
 
-import org.apache.derby.iapi.services.io.FormatableBitSet;
-
-import java.math.BigDecimal;
 import java.sql.Date;
 import java.sql.Time;
 import java.sql.Timestamp;
 
-import java.util.Locale;
 
 /**
  * This interface is how we get constant data values of different types.

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactoryImpl.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactoryImpl.java?view=diff&r1=153570&r2=153571
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactoryImpl.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactoryImpl.java Sat Feb 12 14:51:10 2005
@@ -2,7 +2,7 @@
 
    Derby - Class org.apache.derby.iapi.types.DataValueFactoryImpl
 
-   Copyright 1999, 2004 The Apache Software Foundation or its licensors, as applicable.
+   Copyright 1999, 2005 The Apache Software Foundation or its licensors, as applicable.
 
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
@@ -20,8 +20,6 @@
 
 package org.apache.derby.iapi.types;
 
-import org.apache.derby.iapi.types.TypeId;
-
 import org.apache.derby.iapi.types.NumberDataValue;
 import org.apache.derby.iapi.types.BooleanDataValue;
 import org.apache.derby.iapi.types.BitDataValue;
@@ -39,36 +37,28 @@
 
 import org.apache.derby.iapi.services.sanity.SanityManager;
 
-import org.apache.derby.iapi.services.io.FormatableBitSet;
-
 import org.apache.derby.iapi.services.i18n.LocaleFinder;
 
-import org.apache.derby.iapi.types.*;
-
-import java.math.BigDecimal;
 import java.sql.Date;
 import java.sql.Time;
 import java.sql.Timestamp;
-import java.sql.Types;
-import java.util.Locale;
+
 
 import org.apache.derby.iapi.db.DatabaseContext;
 import org.apache.derby.iapi.services.context.ContextService;
 
 /**
- * This class implements DataValueFactory.
+ * Core implementation of DataValueFactory. Does not implement
+ * methods required to generate DataValueDescriptor implementations
+ * for the DECIMAL datatype. J2ME and J2SE require different implementations.
  *
  * @see DataValueFactory
  */
-public class DataValueFactoryImpl implements DataValueFactory
+abstract class DataValueFactoryImpl implements DataValueFactory
 {
         LocaleFinder localeFinder;
 
-        /**
-          *     Make the constructor public.
-          *
-          */
-    public      DataValueFactoryImpl()
+        DataValueFactoryImpl()
         {
         }
 
@@ -285,7 +275,7 @@
                 previous.setValue(value);
                 return previous;
         }
-        public NumberDataValue getDecimalDataValue(Number value)
+        public final NumberDataValue getDecimalDataValue(Number value)
 			throws StandardException
         {
 			NumberDataValue ndv = getNullDecimal((NumberDataValue) null);
@@ -293,7 +283,7 @@
 			return ndv;
         }
 
-        public NumberDataValue getDecimalDataValue(Number value, NumberDataValue previous)
+        public final NumberDataValue getDecimalDataValue(Number value, NumberDataValue previous)
                         throws StandardException
         {
                 if (previous == null)
@@ -302,24 +292,8 @@
                 previous.setValue(value);
                 return previous;
         }
-        public NumberDataValue getDecimalDataValue(Long value, NumberDataValue previous)
-                        throws StandardException
-        {
-                if (previous == null)
-                        previous = new SQLDecimal();
 
-                previous.setValue(value);
-                return previous;
-        }
-        public NumberDataValue getDecimalDataValue(String value) throws StandardException
-        {
-                if (value != null)
-                        return new SQLDecimal(value);
-                else
-                        return new SQLDecimal();
-        }
-
-        public NumberDataValue getDecimalDataValue(String value,
+        public final NumberDataValue getDecimalDataValue(String value,
                                                                                                 NumberDataValue previous)
                         throws StandardException
         {
@@ -699,19 +673,6 @@
                 if (dataValue == null)
                 {
                         return new SQLDouble();
-                }
-                else
-                {
-                        dataValue.setToNull();
-                        return dataValue;
-                }
-        }
-
-        public NumberDataValue getNullDecimal(NumberDataValue dataValue)
-        {
-                if (dataValue == null)
-                {
-                        return new SQLDecimal();
                 }
                 else
                 {

Added: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/J2SEDataValueFactory.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/J2SEDataValueFactory.java?view=auto&rev=153571
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/J2SEDataValueFactory.java (added)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/J2SEDataValueFactory.java Sat Feb 12 14:51:10 2005
@@ -0,0 +1,62 @@
+/*
+
+   Derby - Class org.apache.derby.iapi.types.J2SEDataValueFactory
+
+   Copyright 1999, 2005 The Apache Software Foundation or its licensors, as applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+
+package org.apache.derby.iapi.types;
+
+import org.apache.derby.iapi.error.StandardException;
+
+/**
+ * DataValueFactory implementation for J2SE.
+ * Uses SQLDecimal for DECIMAL which implements
+ * DECIMAL functionality using java.math.BigDecimal.
+ *
+ * @see DataValueFactory
+ */
+public class J2SEDataValueFactory extends DataValueFactoryImpl
+{
+	public J2SEDataValueFactory() {
+	}
+
+	public NumberDataValue getDecimalDataValue(Long value,
+			NumberDataValue previous) throws StandardException {
+		if (previous == null)
+			previous = new SQLDecimal();
+
+		previous.setValue(value);
+		return previous;
+	}
+
+	public NumberDataValue getDecimalDataValue(String value)
+			throws StandardException {
+		if (value != null)
+			return new SQLDecimal(value);
+		else
+			return new SQLDecimal();
+	}
+
+	public NumberDataValue getNullDecimal(NumberDataValue dataValue) {
+		if (dataValue == null) {
+			return new SQLDecimal();
+		} else {
+			dataValue.setToNull();
+			return dataValue;
+		}
+	}
+}

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLBoolean.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLBoolean.java?view=diff&r1=153570&r2=153571
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLBoolean.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLBoolean.java Sat Feb 12 14:51:10 2005
@@ -20,25 +20,20 @@
 
 package org.apache.derby.iapi.types;
 
-import org.apache.derby.iapi.reference.SQLState;
 
 import org.apache.derby.iapi.services.io.ArrayInputStream;
 
 import org.apache.derby.iapi.services.sanity.SanityManager;
 
-import org.apache.derby.iapi.services.io.FormatIdUtil;
 import org.apache.derby.iapi.services.io.Storable;
 import org.apache.derby.iapi.services.io.StoredFormatIds;
 
 import org.apache.derby.iapi.error.StandardException;
 
-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.types.BooleanDataValue;
-import org.apache.derby.iapi.types.DataValueDescriptor;
 
-import org.apache.derby.iapi.types.Orderable;
 
 import org.apache.derby.iapi.services.cache.ClassSize;
 import org.apache.derby.iapi.util.StringUtil;
@@ -47,8 +42,6 @@
 import java.io.ObjectInput;
 import java.io.IOException;
 
-import java.math.BigDecimal;
-
 import java.sql.ResultSet;
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
@@ -146,14 +139,6 @@
 		return (double) makeInt(value);
 	}
 
-	/** 
-	 * @see DataValueDescriptor#getBigDecimal 
-	 */
-	public BigDecimal	getBigDecimal()
-	{
-		if (isNull()) return null;
-		return BigDecimal.valueOf(makeInt(value));
-	}
 	/**
 	 * Implementation for BOOLEAN type. Convert to a BigDecimal using long
 	 */

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLChar.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLChar.java?view=diff&r1=153570&r2=153571
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLChar.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLChar.java Sat Feb 12 14:51:10 2005
@@ -24,28 +24,22 @@
 
 import org.apache.derby.iapi.services.sanity.SanityManager;
 
-import org.apache.derby.iapi.services.io.FormatIdUtil;
 import org.apache.derby.iapi.services.io.Storable;
 import org.apache.derby.iapi.services.io.StoredFormatIds;
 import org.apache.derby.iapi.services.io.StreamStorable;
 import org.apache.derby.iapi.services.io.FormatIdInputStream;
 
-import org.apache.derby.iapi.db.Database;
-
 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.types.StringDataValue;
 import org.apache.derby.iapi.types.NumberDataValue;
-import org.apache.derby.iapi.types.DataValueDescriptor;
 import org.apache.derby.iapi.types.BooleanDataValue;
 import org.apache.derby.iapi.types.ConcatableDataValue;
 import org.apache.derby.iapi.reference.SQLState;
 
 import org.apache.derby.iapi.error.StandardException;
 
-
-import org.apache.derby.iapi.services.io.FormatableBitSet;
 import org.apache.derby.iapi.services.cache.ClassSize;
 import org.apache.derby.iapi.services.io.ArrayInputStream;
 import org.apache.derby.iapi.util.StringUtil;
@@ -64,7 +58,6 @@
 import java.io.IOException;
 import java.io.UTFDataFormatException;
 import java.io.EOFException;
-import java.math.BigDecimal;
 import java.sql.Date;
 import java.sql.ResultSet;
 import java.sql.PreparedStatement;
@@ -75,10 +68,8 @@
 import java.text.RuleBasedCollator;
 import java.text.CollationKey;
 import java.text.DateFormat;
-import java.text.ParseException;
 import java.util.Locale;
 import java.util.Calendar;
-import java.util.GregorianCalendar;
 
 /**
  * SQLChar satisfies the DataValueDescriptor
@@ -224,19 +215,6 @@
 		}
 	}
 
-	/**
-	 * @see DataValueDescriptor#getBigDecimal
-	 * @exception StandardException thrown on failure to convert
-	 */
-	public BigDecimal	getBigDecimal() throws StandardException
-	{
-		if (isNull()) return null;
-		try {
-		    return new BigDecimal(getString().trim());
-		} catch (NumberFormatException nfe) {
-			throw StandardException.newException(SQLState.LANG_FORMAT_EXCEPTION, "java.math.BigDecimal");
-		}
-	}
 	/**
 	 * CHAR/VARCHAR/LONG VARCHAR implementation. Convert to a BigDecimal using getString.
 	 */

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLClob.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLClob.java?view=diff&r1=153570&r2=153571
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLClob.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLClob.java Sat Feb 12 14:51:10 2005
@@ -20,14 +20,10 @@
 
 package org.apache.derby.iapi.types;
 
-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.types.StringDataValue;
-import org.apache.derby.iapi.reference.SQLState;
 import org.apache.derby.iapi.error.StandardException;
 
-import org.apache.derby.iapi.services.io.FormatIdUtil;
 import org.apache.derby.iapi.services.io.StoredFormatIds;
 
 import org.apache.derby.iapi.services.sanity.SanityManager;
@@ -35,8 +31,6 @@
 import java.sql.Date;
 import java.sql.Time;
 import java.sql.Timestamp;
-import java.math.BigDecimal;
-
 import java.util.Calendar;
 
 
@@ -175,10 +169,6 @@
 	public double	getDouble() throws StandardException
 	{
 		throw dataTypeConversion("double");
-	}
-	public BigDecimal	getBigDecimal() throws StandardException
-	{
-		throw dataTypeConversion("java.math.BigDecimal");
 	}
 	public int typeToBigDecimal() throws StandardException
 	{

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDecimal.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDecimal.java?view=diff&r1=153570&r2=153571
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDecimal.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDecimal.java Sat Feb 12 14:51:10 2005
@@ -44,7 +44,6 @@
 import java.io.IOException;
 
 import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
 import java.sql.Types;
@@ -283,7 +282,7 @@
 		return value;
 	}
 
-	public BigDecimal	getBigDecimal()
+	private BigDecimal	getBigDecimal()
 	{
 		if ((value == null) && (rawData != null)) 
 		{
@@ -386,7 +385,7 @@
 	}
 	protected void setFrom(DataValueDescriptor theValue) throws StandardException {
 
-		setCoreValue(theValue.getBigDecimal());
+		setCoreValue(SQLDecimal.getBigDecimal(theValue));
 	}
 
 	public int	getLength()
@@ -523,7 +522,7 @@
 	/** @exception StandardException		Thrown on error */
 	protected int typeCompare(DataValueDescriptor arg) throws StandardException
 	{
-		BigDecimal otherValue = arg.getBigDecimal();
+		BigDecimal otherValue = SQLDecimal.getBigDecimal(arg);
 
 		return getBigDecimal().compareTo(otherValue);
 	}
@@ -751,7 +750,7 @@
 		int desiredScale = desiredType.getScale();
 		int desiredPrecision = desiredType.getPrecision();
 
-		setCoreValue(source.getBigDecimal());
+		setCoreValue(SQLDecimal.getBigDecimal(source));
 		setWidth(desiredPrecision, desiredScale, true);
 	}
 
@@ -790,7 +789,7 @@
 			return result;
 		}
 
-		result.setBigDecimal(addend1.getBigDecimal().add(addend2.getBigDecimal()));
+		result.setBigDecimal(SQLDecimal.getBigDecimal(addend1).add(SQLDecimal.getBigDecimal(addend2)));
 		return result;
 	}
 
@@ -823,7 +822,7 @@
 			return result;
 		}
 
-		result.setBigDecimal(left.getBigDecimal().subtract(right.getBigDecimal()));
+		result.setBigDecimal(SQLDecimal.getBigDecimal(left).subtract(SQLDecimal.getBigDecimal(right)));
 		return result;
 	}
 
@@ -856,7 +855,7 @@
 			return result;
 		}
 
-		result.setBigDecimal(left.getBigDecimal().multiply(right.getBigDecimal()));
+		result.setBigDecimal(SQLDecimal.getBigDecimal(left).multiply(SQLDecimal.getBigDecimal(right)));
 		return result;
 	}
 
@@ -913,13 +912,13 @@
 			return result;
 		}
 
-		BigDecimal divisorBigDecimal = divisor.getBigDecimal();
+		BigDecimal divisorBigDecimal = SQLDecimal.getBigDecimal(divisor);
 
 		if (divisorBigDecimal.compareTo(ZERO) == 0)
 		{
 			throw  StandardException.newException(SQLState.LANG_DIVIDE_BY_ZERO);
 		}
-		BigDecimal dividendBigDecimal = dividend.getBigDecimal();
+		BigDecimal dividendBigDecimal = SQLDecimal.getBigDecimal(dividend);
 
 		/*
 		** Set the result scale to be either the passed in scale, whcih was

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDouble.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDouble.java?view=diff&r1=153570&r2=153571
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDouble.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDouble.java Sat Feb 12 14:51:10 2005
@@ -24,7 +24,6 @@
 
 import org.apache.derby.iapi.services.io.ArrayInputStream;
 
-import org.apache.derby.iapi.services.io.FormatIdUtil;
 import org.apache.derby.iapi.services.io.StoredFormatIds;
 import org.apache.derby.iapi.services.io.Storable;
 
@@ -33,10 +32,8 @@
 import org.apache.derby.iapi.error.StandardException;
 
 import org.apache.derby.iapi.types.BooleanDataValue;
-import org.apache.derby.iapi.types.DataTypeDescriptor;
 import org.apache.derby.iapi.types.DataValueDescriptor;
 import org.apache.derby.iapi.types.NumberDataValue;
-import org.apache.derby.iapi.types.DataValueDescriptor;
 import org.apache.derby.iapi.types.TypeId;
 
 import org.apache.derby.iapi.services.cache.ClassSize;
@@ -44,8 +41,6 @@
 import org.apache.derby.iapi.types.NumberDataType;
 import org.apache.derby.iapi.types.SQLBoolean;
 
-import java.math.BigDecimal;
-
 import java.io.ObjectOutput;
 import java.io.ObjectInput;
 import java.io.IOException;
@@ -150,11 +145,6 @@
 		return value;
 	}
 
-	public BigDecimal	getBigDecimal()
-	{
-		if (isNull()) return null;
-		return new BigDecimal(Double.toString(value));
-	}
 	/**
 	 * DOUBLE implementation. Convert to a BigDecimal using getString.
 	 */

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLInteger.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLInteger.java?view=diff&r1=153570&r2=153571
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLInteger.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLInteger.java Sat Feb 12 14:51:10 2005
@@ -22,15 +22,12 @@
 
 import org.apache.derby.iapi.services.io.ArrayInputStream;
 
-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.types.NumberDataValue;
-import org.apache.derby.iapi.types.DataValueDescriptor;
 import org.apache.derby.iapi.types.BooleanDataValue;
 import org.apache.derby.iapi.reference.SQLState;
 
-import org.apache.derby.iapi.services.io.FormatIdUtil;
 import org.apache.derby.iapi.services.io.StoredFormatIds;
 import org.apache.derby.iapi.services.io.Storable;
 
@@ -42,8 +39,6 @@
 import org.apache.derby.iapi.types.NumberDataType;
 import org.apache.derby.iapi.types.SQLBoolean;
 
-import java.math.BigDecimal;
-
 import java.io.ObjectOutput;
 import java.io.ObjectInput;
 import java.io.IOException;
@@ -122,12 +117,6 @@
 	public double	getDouble()
 	{
 		return (double) value;
-	}
-
-	public BigDecimal	getBigDecimal()
-	{
-		if (isNull()) return null;
-		return BigDecimal.valueOf(value);
 	}
 
     // for lack of a specification: 0 or null is false,

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLLongint.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLLongint.java?view=diff&r1=153570&r2=153571
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLLongint.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLLongint.java Sat Feb 12 14:51:10 2005
@@ -22,16 +22,12 @@
 
 import org.apache.derby.iapi.services.io.ArrayInputStream;
 
-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.types.TypeId;
 import org.apache.derby.iapi.types.NumberDataValue;
-import org.apache.derby.iapi.types.DataValueDescriptor;
 import org.apache.derby.iapi.types.BooleanDataValue;
 import org.apache.derby.iapi.reference.SQLState;
 
-import org.apache.derby.iapi.services.io.FormatIdUtil;
 import org.apache.derby.iapi.services.io.StoredFormatIds;
 import org.apache.derby.iapi.services.io.Storable;
 
@@ -43,8 +39,6 @@
 import org.apache.derby.iapi.types.NumberDataType;
 import org.apache.derby.iapi.types.SQLBoolean;
 
-import java.math.BigDecimal;
-
 import java.io.ObjectOutput;
 import java.io.ObjectInput;
 import java.io.IOException;
@@ -129,12 +123,6 @@
 	public double	getDouble()
 	{
 		return (double) value;
-	}
-
-	public BigDecimal	getBigDecimal()
-	{
-		if (isNull()) return null;
-		return BigDecimal.valueOf(value);
 	}
 
     // for lack of a specification: 0 or null is false,

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLReal.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLReal.java?view=diff&r1=153570&r2=153571
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLReal.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLReal.java Sat Feb 12 14:51:10 2005
@@ -25,14 +25,11 @@
 import org.apache.derby.iapi.services.io.ArrayInputStream;
 
 import org.apache.derby.iapi.types.BooleanDataValue;
-import org.apache.derby.iapi.types.DataTypeDescriptor;
 import org.apache.derby.iapi.types.DataValueDescriptor;
 import org.apache.derby.iapi.types.NumberDataValue;
-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.services.io.FormatIdUtil;
 import org.apache.derby.iapi.services.io.Storable;
 import org.apache.derby.iapi.services.io.StoredFormatIds;
 
@@ -44,8 +41,6 @@
 
 import org.apache.derby.iapi.services.cache.ClassSize;
 
-import java.math.BigDecimal;
-
 import java.io.ObjectOutput;
 import java.io.ObjectInput;
 import java.io.IOException;
@@ -155,14 +150,6 @@
 		return (double) value;
 	}
 
-	/** 
-	 * @see DataValueDescriptor#getBigDecimal 
-	 */
-	public BigDecimal	getBigDecimal()
-	{
-		if (isNull()) return null;
-		return new BigDecimal(Float.toString(value));
-	}
 	/**
 	 * DOUBLE implementation. Convert to a BigDecimal using getString.
 	 */

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLSmallint.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLSmallint.java?view=diff&r1=153570&r2=153571
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLSmallint.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLSmallint.java Sat Feb 12 14:51:10 2005
@@ -24,15 +24,11 @@
 
 import org.apache.derby.iapi.services.io.ArrayInputStream;
 
-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.types.DataValueDescriptor;
 import org.apache.derby.iapi.types.NumberDataValue;
-import org.apache.derby.iapi.types.DataValueDescriptor;
 import org.apache.derby.iapi.types.BooleanDataValue;
 
-import org.apache.derby.iapi.services.io.FormatIdUtil;
 import org.apache.derby.iapi.services.io.StoredFormatIds;
 import org.apache.derby.iapi.services.io.Storable;
 
@@ -44,8 +40,6 @@
 import org.apache.derby.iapi.types.NumberDataType;
 import org.apache.derby.iapi.types.SQLBoolean;
 
-import java.math.BigDecimal;
-
 import java.io.ObjectOutput;
 import java.io.ObjectInput;
 import java.io.IOException;
@@ -134,15 +128,6 @@
 	public double	getDouble()
 	{
 		return (double) value;
-	}
-
-	/** 
-	 * @see DataValueDescriptor#getBigDecimal 
-	 */
-	public BigDecimal	getBigDecimal()
-	{
-		if (isNull()) return null;
-		return BigDecimal.valueOf(value);
 	}
 
     // for lack of a specification: 0 or null is false,

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLTinyint.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLTinyint.java?view=diff&r1=153570&r2=153571
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLTinyint.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLTinyint.java Sat Feb 12 14:51:10 2005
@@ -25,17 +25,14 @@
 import org.apache.derby.iapi.services.io.ArrayInputStream;
 
 import org.apache.derby.iapi.services.sanity.SanityManager;
-import org.apache.derby.iapi.services.io.FormatIdUtil;
 import org.apache.derby.iapi.services.io.StoredFormatIds;
 import org.apache.derby.iapi.services.io.Storable;
 
 import org.apache.derby.iapi.error.StandardException;
 
 import org.apache.derby.iapi.types.BooleanDataValue;
-import org.apache.derby.iapi.types.DataTypeDescriptor;
 import org.apache.derby.iapi.types.DataValueDescriptor;
 import org.apache.derby.iapi.types.NumberDataValue;
-import org.apache.derby.iapi.types.DataValueDescriptor;
 import org.apache.derby.iapi.types.TypeId;
 
 import org.apache.derby.iapi.services.cache.ClassSize;
@@ -43,8 +40,6 @@
 import org.apache.derby.iapi.types.NumberDataType;
 import org.apache.derby.iapi.types.SQLBoolean;
 
-import java.math.BigDecimal;
-
 import java.io.ObjectOutput;
 import java.io.ObjectInput;
 import java.io.IOException;
@@ -173,16 +168,6 @@
 	public double	getDouble()
 	{
 		return (double) value;
-	}
-
-	/** 
-	 * @see DataValueDescriptor#getBigDecimal 
-	 */
-	public BigDecimal	getBigDecimal()
-	{
-		return (isNull()) ?
-					null :
-					BigDecimal.valueOf(value);
 	}
 
 	/** 

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/UserType.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/UserType.java?view=diff&r1=153570&r2=153571
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/UserType.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/UserType.java Sat Feb 12 14:51:10 2005
@@ -26,33 +26,23 @@
 
 import org.apache.derby.iapi.services.io.ArrayInputStream;
 
-import org.apache.derby.iapi.services.loader.ClassFactory;
 import org.apache.derby.iapi.services.loader.ClassInspector;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.services.io.StoredFormatIds;
 
 import org.apache.derby.iapi.error.StandardException;
 
-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.types.DataValueDescriptor;
 import org.apache.derby.iapi.types.BooleanDataValue;
-import org.apache.derby.iapi.types.DataValueDescriptor;
-import org.apache.derby.iapi.types.NumberDataValue;
 import org.apache.derby.iapi.types.UserDataValue;
 
-import org.apache.derby.iapi.types.Orderable;
-import org.apache.derby.iapi.types.*;
-
 import org.apache.derby.iapi.services.cache.ClassSize;
 
 import java.sql.Date;
 import java.sql.Time;
 import java.sql.Timestamp;
-import java.sql.Types;
-import java.math.BigDecimal;
 
 import java.io.ObjectOutput;
 import java.io.ObjectInput;
@@ -184,20 +174,6 @@
 			// REMIND: check for overflow
 			if (value instanceof Number) return ((Number)value).doubleValue();
 		return super.getDouble();
-	}
-
-	/**
-	 * @exception StandardException thrown on failure to convert
-	 */
-	public BigDecimal getBigDecimal() throws StandardException
-	{
-		if (! isNull()) {
-			if (value instanceof BigDecimal) return ((BigDecimal)value);
-
-			if (value instanceof Number)
-				return new BigDecimal(Double.toString(((Number) value).doubleValue()));
-		}
-		return super.getBigDecimal();
 	}
 
 	/**

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/build.xml
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/build.xml?view=diff&r1=153570&r2=153571
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/build.xml (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/build.xml Sat Feb 12 14:51:10 2005
@@ -34,6 +34,25 @@
         <pathelement path="${compile.classpath}"/>
       </classpath>
       <include name="${derby.dir}/iapi/types/*.java"/>
+      <exclude name="${derby.dir}/iapi/types/SQLDecimal.java"/>
+      <exclude name="${derby.dir}/iapi/types/J2SEDataValueFactory.java"/>
+    </javac>
+    <javac
+      bootclasspath="${empty}"
+      nowarn="on"
+      debug="${debug}"
+      depend="${depend}"
+      deprecation="${deprecation}"
+      optimize="${optimize}"
+      proceed="${proceed}"
+      verbose="${verbose}"
+      srcdir="${derby.engine.src.dir}"
+      destdir="${out.dir}">
+      <classpath>
+        <pathelement path="${java13compile.classpath}"/>
+      </classpath>
+      <include name="${derby.dir}/iapi/types/SQLDecimal.java"/>
+      <include name="${derby.dir}/iapi/types/J2SEDataValueFactory.java"/>
     </javac>
   </target>
 

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/modules.properties
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/modules.properties?view=diff&r1=153570&r2=153571
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/modules.properties (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/modules.properties Sat Feb 12 14:51:10 2005
@@ -140,12 +140,14 @@
 #
 derby.module.jdbcJ2=org.apache.derby.jdbc.Driver20
 derby.env.jdk.jdbcJ2=2
+derby.env.classes.jdbcJ2=java.sql.Driver
 cloudscape.config.jdbcJ2=derby
 
 # jdbc30 - requires JDK 1.4
 #
 derby.module.jdbcJ4=org.apache.derby.jdbc.Driver30
 derby.env.jdk.jdbcJ4=4
+derby.env.classes.jdbcJ4=java.sql.Driver
 cloudscape.config.jdbcJ4=derby
 
 # resourceAdapter - requires JDK 1.2, JTA classes and JDBC20X classes
@@ -287,6 +289,7 @@
 
 
 # DataValueFactory implementations
-derby.module.dvfJ2=org.apache.derby.iapi.types.DataValueFactoryImpl
+derby.module.dvfJ2=org.apache.derby.iapi.types.J2SEDataValueFactory
 derby.env.dvfJ2=2
+derby.env.classes.dvfJ2=java.math.BigDecimal
 cloudscape.config.dvfJ2=derby