db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r189642 - in /incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types: BigIntegerDecimal.java BinaryDecimal.java CDCDataValueFactory.java
Date Wed, 08 Jun 2005 21:28:12 GMT
Author: djd
Date: Wed Jun  8 14:28:11 2005
New Revision: 189642

URL: http://svn.apache.org/viewcvs?rev=189642&view=rev
Log:
Fix BinaryDecimal to have a hashCode that matches the integer versions,
to ensure that hash joins work correctly.

Modified:
    incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/BigIntegerDecimal.java
    incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/BinaryDecimal.java
    incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CDCDataValueFactory.java

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/BigIntegerDecimal.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/BigIntegerDecimal.java?rev=189642&r1=189641&r2=189642&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/BigIntegerDecimal.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/BigIntegerDecimal.java
Wed Jun  8 14:28:11 2005
@@ -59,12 +59,14 @@
 		
 		BigInteger bi = new BigInteger(data2c);
 		
+		// If at any time we see that the value to be scaled down
+		// is within the range for a long, then we are guaranteed
+		// that the scaled down value is within the range for long.
 		boolean rangeOk = false;
 		if ((bi.compareTo(BigIntegerDecimal.MAXLONG_PLUS_ONE) < 0)
 			&& (bi.compareTo(BigIntegerDecimal.MINLONG_MINUS_ONE) > 0))
 			rangeOk = true;
 			
-		
 		for (int i = 0; i < sqlScale; i++)
 		{
 			bi = bi.divide(BigIntegerDecimal.TEN);
@@ -87,16 +89,13 @@
     {
 		if (isNull())
 			return 0.0f;
-		return Float.parseFloat(getString());
-
-		// TODO - correct implementation
+		return NumberDataType.normalizeREAL(Float.parseFloat(getString()));
 	}
 	public double getDouble() throws StandardException
     {
 		if (isNull())
 			return 0.0;
-		return Double.parseDouble(getString());
-		// TODO - correct implementation
+		return NumberDataType.normalizeDOUBLE(Double.parseDouble(getString()));
 	}	
 	
 
@@ -154,8 +153,6 @@
 				
 				String exponent = theValue.substring(expOffset);
 				
-				
-				//	TODO Need to handle a + sign in the exponent
 				scale = -1 * Integer.parseInt(exponent);
 				theValue = theValue.substring(0, ePosition);
 			}
@@ -196,7 +193,6 @@
 		if (isNull())
 			return null;
 		
-		// TODO - correct impl
 		String unscaled = new BigInteger(data2c).toString();
 				
 		if (sqlScale == 0)

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/BinaryDecimal.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/BinaryDecimal.java?rev=189642&r1=189641&r2=189642&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/BinaryDecimal.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/BinaryDecimal.java
Wed Jun  8 14:28:11 2005
@@ -695,7 +695,7 @@
 			return 0;
 
 		try {
-			return (int) Double.doubleToLongBits(getDouble());
+			return (int) getLong();
 		} catch (StandardException se)
 		{
 			return 0;

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CDCDataValueFactory.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CDCDataValueFactory.java?rev=189642&r1=189641&r2=189642&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CDCDataValueFactory.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CDCDataValueFactory.java
Wed Jun  8 14:28:11 2005
@@ -43,12 +43,6 @@
 	public CDCDataValueFactory() {
 	}
 	
-   	public void boot(boolean create, Properties properties) throws StandardException {
-   		System.out.println("WARNING - Experimental J2ME/CDC/Foundation/JSR 169 Derby implementation");
-   		System.out.println("WARNING - NOT FOR USE IN PRODUCTION");
-    	super.boot(create, properties);
-   	}
-	
 	/* (non-Javadoc)
 	 * @see org.apache.derby.iapi.services.monitor.ModuleSupportable#canSupport(java.util.Properties)
 	 */



Mime
View raw message