db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r359572 - in /db/derby/code/trunk/java/engine/org/apache/derby: iapi/sql/ impl/jdbc/ impl/sql/ impl/sql/execute/
Date Wed, 28 Dec 2005 17:35:38 GMT
Author: djd
Date: Wed Dec 28 09:35:31 2005
New Revision: 359572

URL: http://svn.apache.org/viewcvs?rev=359572&view=rev
Log:
DERBY-776 ENsure some calls to DataValueDescriptor.setValue(Object) are made through the UserDataValue
interface as a step towards removing the DataValueDescriptor.setValue(Object) method. Use
the setBigDecimal
methods in some cases for JDBC update/setBigDecimal methods.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/ParameterValueSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedCallableStatement.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedCallableStatement20.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet20.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericParameterValueSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AggregateSortObserver.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericAggregator.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/ParameterValueSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/ParameterValueSet.java?rev=359572&r1=359571&r2=359572&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/ParameterValueSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/ParameterValueSet.java Wed Dec
28 09:35:31 2005
@@ -84,25 +84,6 @@
 	void registerOutParameter(int parameterIndex, int sqlType, int scale)
 		throws StandardException;
 
-
-    /**
-     * Get the value of a parameter as a Java object.
-     *
-     * <p>This method returns a Java object whose type coresponds to the SQL
-     * type that was registered for this parameter using registerOutParameter.
-     *
-     * <p>Note that this method may be used to read
-     * datatabase-specific, abstract data types. This is done by
-     * specifying a targetSqlType of java.sql.types.OTHER, which
-     * allows the driver to return a database-specific Java type.
-     *
-     * @param parameterIndex The first parameter is 1, the second is 2, ...
-     * @return A java.lang.Object holding the OUT parameter value.
-     * @exception StandardException if a database-access error occurs.
-     * @see java.sql.Types 
-     */
-    Object getObject(int parameterIndex) throws StandardException;
-
 	//////////////////////////////////////////////////////////////////
 	//
 	// MISC STATEMENT
@@ -147,7 +128,7 @@
 	public DataValueDescriptor getParameterForSet( int position ) throws StandardException;
 
 	/**
-		Set the value of this parameter to the passed in Object.
+		Set the value of this user defined parameter to the passed in Object.
 		
 		  @return	The parameter at the given position.
 		  @exception StandardException		Thrown on error

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedCallableStatement.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedCallableStatement.java?rev=359572&r1=359571&r2=359572&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedCallableStatement.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedCallableStatement.java
Wed Dec 28 09:35:31 2005
@@ -485,11 +485,11 @@
 	 * @see CallableStatement#getObject
      * @exception SQLException NoOutputParameters thrown.
      */
-	public Object getObject(int parameterIndex) throws SQLException 
+	public final Object getObject(int parameterIndex) throws SQLException 
 	{
 		checkStatus();
 		try {
-			Object v = getParms().getObject(parameterIndex-1);
+			Object v = getParms().getParameterForGet(parameterIndex-1).getObject();
 			wasNull = (v == null);
 			return v;
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedCallableStatement20.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedCallableStatement20.java?rev=359572&r1=359571&r2=359572&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedCallableStatement20.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedCallableStatement20.java
Wed Dec 28 09:35:31 2005
@@ -1040,7 +1040,7 @@
 		checkStatus();
 		try {
 			/* JDBC is one-based, DBMS is zero-based */
-			getParms().getParameterForSet(parameterIndex - 1).setValue(x);
+			getParms().getParameterForSet(parameterIndex - 1).setBigDecimal(x);
 
 		} catch (Throwable t) {
 			throw EmbedResultSet.noStateChangeException(t);

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java?rev=359572&r1=359571&r2=359572&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java Wed Dec
28 09:35:31 2005
@@ -41,6 +41,7 @@
 import org.apache.derby.iapi.sql.execute.CursorActivation;
 
 import org.apache.derby.iapi.types.DataValueDescriptor;
+import org.apache.derby.iapi.types.UserDataValue;
 import org.apache.derby.iapi.types.VariableSizeDataValue;
 import org.apache.derby.iapi.sql.ResultDescription;
 import org.apache.derby.iapi.services.io.StreamStorable;
@@ -2718,7 +2719,7 @@
 		int colType = getColumnType(columnIndex);
 		if (colType == org.apache.derby.iapi.reference.JDBC20Translation.SQL_TYPES_JAVA_OBJECT)
{
 			try {
-				getDVDforColumnToBeUpdated(columnIndex, "updateObject").setValue(x);
+				((UserDataValue) getDVDforColumnToBeUpdated(columnIndex, "updateObject")).setValue(x);
 				return;
 			} catch (StandardException t) {
 				throw noStateChangeException(t);

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet20.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet20.java?rev=359572&r1=359571&r2=359572&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet20.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet20.java Wed Dec
28 09:35:31 2005
@@ -167,7 +167,7 @@
     public void updateBigDecimal(int columnIndex, BigDecimal x)
     throws SQLException {
         try {
-            getDVDforColumnToBeUpdated(columnIndex, "updateBigDecimal").setValue(x);
+            getDVDforColumnToBeUpdated(columnIndex, "updateBigDecimal").setBigDecimal(x);
         } catch (StandardException t) {
             throw noStateChangeException(t);
         }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericParameterValueSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericParameterValueSet.java?rev=359572&r1=359571&r2=359572&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericParameterValueSet.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericParameterValueSet.java
Wed Dec 28 09:35:31 2005
@@ -29,6 +29,7 @@
 import org.apache.derby.iapi.types.DataTypeDescriptor;
 import org.apache.derby.iapi.types.DataValueFactory;
 import org.apache.derby.iapi.types.DataValueDescriptor;
+import org.apache.derby.iapi.types.UserDataValue;
 
 import org.apache.derby.iapi.reference.SQLState;
 
@@ -197,7 +198,7 @@
 
 	public void setParameterAsObject(int position, Object value) throws StandardException {
 
-		DataValueDescriptor dvd = getParameterForSet(position);
+		UserDataValue dvd = (UserDataValue) getParameterForSet(position);
 
 		GenericParameter gp = parms[position];
 		if (value != null && (gp.jdbcTypeId == Types.OTHER || gp.jdbcTypeId == org.apache.derby.iapi.reference.JDBC20Translation.SQL_TYPES_JAVA_OBJECT))
{
@@ -396,29 +397,6 @@
 	{
 		checkPosition(parameterIndex);
 		parms[parameterIndex].setOutParameter(sqlType, scale);
-	}
-
-    /**
-     * Get the value of a parameter as a Java object.
-     *
-     * <p>This method returns a Java object whose type coresponds to the SQL
-     * type that was registered for this parameter using registerOutParameter.
-     *
-     * <p>Note that this method may be used to read
-     * datatabase-specific, abstract data types. This is done by
-     * specifying a targetSqlType of java.sql.types.OTHER, which
-     * allows the driver to return a database-specific Java type.
-     *
-     * @param parameterIndex The first parameter is 1, the second is 2, ...
-     * @return A java.lang.Object holding the OUT parameter value.
-     * @exception StandardException if a database-access error occurs.
-     * @see Types 
-     */
-    public Object getObject(int parameterIndex) throws StandardException
-	{
-		DataValueDescriptor dvd = getParameterForGet(parameterIndex);
-
-		return dvd.getObject();
 	}
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AggregateSortObserver.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AggregateSortObserver.java?rev=359572&r1=359571&r2=359572&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AggregateSortObserver.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AggregateSortObserver.java
Wed Dec 28 09:35:31 2005
@@ -130,11 +130,10 @@
 		if (aggsToInitialize.length > 0 &&
 			((Storable)returnRow[firstAggregatorColumn]).isNull())
 		{
-			UserDataValue 		wrapper;	
 			for (int i = 0; i < aggsToInitialize.length; i++)
 			{
 				GenericAggregator aggregator = aggsToInitialize[i];
-				wrapper = ((UserDataValue)returnRow[aggregator.aggregatorColumnId]);
+				UserDataValue wrapper = ((UserDataValue)returnRow[aggregator.aggregatorColumnId]);
 				if (SanityManager.DEBUG)
 				{
 					if (!wrapper.isNull())

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericAggregator.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericAggregator.java?rev=359572&r1=359571&r2=359572&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericAggregator.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericAggregator.java
Wed Dec 28 09:35:31 2005
@@ -100,17 +100,14 @@
 	void initialize(ExecRow row)
 		throws StandardException
 	{
-		ExecAggregator		ua;
-		UserDataValue	aggregatorColumn;
-
 		if (SanityManager.DEBUG)
 		{
 			SanityManager.ASSERT(row != null, "row is null");
 		}
 
-		aggregatorColumn = (UserDataValue) row.getColumn(aggregatorColumnId + 1);
+		UserDataValue aggregatorColumn = (UserDataValue) row.getColumn(aggregatorColumnId + 1);
 
-		ua = (ExecAggregator) aggregatorColumn.getObject();
+		ExecAggregator ua = (ExecAggregator) aggregatorColumn.getObject();
 		if (ua == null)
 		{
 			ua = getAggregatorInstance();



Mime
View raw message