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/05 20:19:41 UTC

svn commit: r168365 - in /incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types: DataValueDescriptor.java NumberDataType.java SQLDecimal.java SQLDouble.java SQLInteger.java SQLLongint.java SQLReal.java

Author: djd
Date: Thu May  5 11:19:40 2005
New Revision: 168365

URL: http://svn.apache.org/viewcvs?rev=168365&view=rev
Log:
Provide common setValue(byte) and setValue(short) methods for
numeric types that simply convert using an int.


Modified:
    incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueDescriptor.java
    incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/NumberDataType.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

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?rev=168365&r1=168364&r2=168365&view=diff
==============================================================================
--- 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 Thu May  5 11:19:40 2005
@@ -271,17 +271,12 @@
 	 *								  cannot be received as a stream.
 	 */
 	InputStream	getStream() throws StandardException;
+
 	/**
-	 * <U>Shallow copy</U>. 
-	 * <p> 
-	 * Clone the DataValueDescriptor and copy its contents.
-	 * We clone the data value wrapper (e.g. SQLDecimal)
-	 * and reuse its contents (the underlying BigDecimal).
-	 * The resultant DataValueDescriptor will point to the same
-	 * value as the original DataValueDescriptor (unless the value
-	 * is a primitive type, e.g. SQLInteger/integer).
+	 * Clone this DataValueDescriptor. Results in a new object
+	 * that has the same value as this but can be modified independently.
 	 *
-	 * @return A clone of the DataValueDescriptor reusing its contents.
+	 * @return A clone of the DataValueDescriptor with the same initial value as this.
 	 */
 	public DataValueDescriptor getClone();
 

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/NumberDataType.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/NumberDataType.java?rev=168365&r1=168364&r2=168365&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/NumberDataType.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/NumberDataType.java Thu May  5 11:19:40 2005
@@ -362,7 +362,30 @@
      *          For positive values or null, return false.
      */
     protected abstract boolean isNegative();
-		
+    
+    /**
+     * Common code to handle converting a short to this value
+     * by using the int to this value conversion.
+     * Simply calls setValue(int).
+     * 
+     */
+	public void setValue(short theValue)
+		throws StandardException
+	{
+		setValue((int) theValue);
+	}
+
+    /**
+     * Common code to handle converting a byte to this value
+     * by using the int to this value conversion.
+     * Simply calls setValue(int).
+     * 
+     */
+	public void setValue(byte theValue)
+		throws StandardException
+	{
+		setValue((int) theValue);
+	}		
 	/**
 	   Common code to handle java.lang.Integer as a Number,
 	   used for TINYINT, SMALLINT, INTEGER

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?rev=168365&r1=168364&r2=168365&view=diff
==============================================================================
--- 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 Thu May  5 11:19:40 2005
@@ -686,24 +686,6 @@
 	}
 
 	/**
-	 * @see NumberDataValue#setValue
-	 *
-	 */
-	public void setValue(short theValue)
-	{
-		setValue((long)theValue);
-	}
-
-	/**
-	 * @see NumberDataValue#setValue
-	 *
-	 */
-	public void setValue(byte theValue)
-	{
-		setValue((long)theValue);
-	}
-
-	/**
 		Only to be called when the application sets a value using BigDecimal
 		through setBigDecimal calls.
 	*/

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?rev=168365&r1=168364&r2=168365&view=diff
==============================================================================
--- 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 Thu May  5 11:19:40 2005
@@ -445,18 +445,6 @@
 		isnull = false;
 	}
 
-	public void setValue(short theValue)
-	{
-		value = theValue; // no check needed
-		isnull = false;
-	}
-
-	public void setValue(byte theValue)
-	{
-		value = theValue; // no check needed
-		isnull = false;
-	}
-
 	public  void setValue(Number theValue) throws StandardException
 	{
 		if (objectNull(theValue)) 

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?rev=168365&r1=168364&r2=168365&view=diff
==============================================================================
--- 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 Thu May  5 11:19:40 2005
@@ -349,18 +349,6 @@
 		isnull = false;
 	}
 
-	public void setValue(short theValue)
-	{
-		value = theValue;
-		isnull = false;
-	}
-
-	public void setValue(byte theValue)
-	{
-		value = theValue;
-		isnull = false;
-	}
-
 	/**
 		@exception StandardException thrown on overflow
 	 */

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?rev=168365&r1=168364&r2=168365&view=diff
==============================================================================
--- 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 Thu May  5 11:19:40 2005
@@ -375,18 +375,6 @@
 		isnull = false;
 	}
 
-	public void setValue(short theValue)
-	{
-		value = theValue;
-		isnull = false;
-	}
-
-	public void setValue(byte theValue)
-	{
-		value = theValue;
-		isnull = false;
-	}
-
 	/**
 	 * @see NumberDataValue#setValue
 	 *

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?rev=168365&r1=168364&r2=168365&view=diff
==============================================================================
--- 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 Thu May  5 11:19:40 2005
@@ -426,21 +426,7 @@
 		isnull = false;
 	}
 
-	public void setValue(short theValue)
-	{
-		value = theValue;
-		isnull = false;
-
-	}
-
 	public void setValue(int theValue)
-	{
-		value = theValue;
-		isnull = false;
-
-	}
-
-	public void setValue(byte theValue)
 	{
 		value = theValue;
 		isnull = false;