db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1470478 - in /db/derby/code/trunk/java/engine/org/apache/derby: iapi/services/io/ iapi/sql/execute/ impl/sql/ impl/sql/compile/
Date Mon, 22 Apr 2013 12:39:47 GMT
Author: kahatlen
Date: Mon Apr 22 12:39:46 2013
New Revision: 1470478

URL: http://svn.apache.org/r1470478
Log:
DERBY-6169: Reduce visibility of classes and methods under impl/sql

- Remove the unused targetColumns fields in CursorInfo and
  GenericPreparedStatement

- Replace the getter for the updateColumns field in
  GenericPreparedStatement with more specific accessor methods that
  don't expose the underlying array

- Make CursorInfo.updateColumns a list instead of an array to take
  advantage of helper methods in java.util.List

- Make ArrayUtil.readStringArray() create one array rather than two

- Move QueryTreeNode.getCursorInfo() to StatementNode, since it's only
  called on nodes of that type

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/ArrayUtil.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/execute/ExecPreparedStatement.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/CursorInfo.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericPreparedStatement.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CurrentOfNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CursorNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/QueryTreeNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumn.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/StatementNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/ArrayUtil.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/ArrayUtil.java?rev=1470478&r1=1470477&r2=1470478&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/ArrayUtil.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/ArrayUtil.java Mon Apr
22 12:39:46 2013
@@ -344,18 +344,13 @@ public abstract class ArrayUtil
 	public static String[] readStringArray(ObjectInput in) 
 		throws IOException, ClassNotFoundException
 	{
-		Object[] objArray = readObjectArray(in);
-		int size = 0;
+        String[] stringArray = null;
 
-		if (objArray == null)
-			return null;
-
-		String[] stringArray = new String[size = objArray.length];
-
-		for (int i = 0; i < size; i++)
-		{
-			stringArray[i] = (String)objArray[i];
-		} 
+        int size = readArrayLength(in);
+        if (size > 0) {
+            stringArray = new String[size];
+            readArrayItems(in, stringArray);
+        }
 
 		return stringArray;
 	}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/execute/ExecPreparedStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/execute/ExecPreparedStatement.java?rev=1470478&r1=1470477&r2=1470478&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/execute/ExecPreparedStatement.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/execute/ExecPreparedStatement.java
Mon Apr 22 12:39:46 2013
@@ -28,7 +28,6 @@ import org.apache.derby.iapi.error.Stand
 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
 
 import org.apache.derby.iapi.sql.PreparedStatement;
-import org.apache.derby.iapi.sql.ResultColumnDescriptor;
 
 import java.util.List;
 
@@ -149,20 +148,16 @@ public interface ExecPreparedStatement 
 	 */
 	ExecCursorTableReference getTargetTable();
 
-	/**
-	 * the target columns of the cursor; this is a superset of
-	 * the updatable columns, describing the row available
-	 *
-	 * @return	target columns of the cursor as an array of column descriptors
-	 */
-	ResultColumnDescriptor[]	getTargetColumns();
+    /**
+     * Check if this prepared statement has a cursor with columns that
+     * can be updated.
+     */
+    boolean hasUpdateColumns();
 
-	/**
-	 * the update columns of the cursor
-	 *
-	 * @return	update columns of the cursor as a string of column names
-	 */
-	String[]	getUpdateColumns();
+    /**
+     * Check if the specified column name is one of the update columns.
+     */
+    boolean isUpdateColumn(String columnName);
 
 	/**
 	 * set this parepared statement to be valid

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/CursorInfo.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/CursorInfo.java?rev=1470478&r1=1470477&r2=1470478&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/CursorInfo.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/CursorInfo.java Mon Apr 22 12:39:46
2013
@@ -21,18 +21,20 @@
 
 package org.apache.derby.impl.sql;
 
-import org.apache.derby.iapi.sql.ResultColumnDescriptor;
 import org.apache.derby.iapi.sql.execute.ExecCursorTableReference;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 
 import org.apache.derby.iapi.services.io.ArrayUtil;
 import org.apache.derby.iapi.services.io.StoredFormatIds;
-import org.apache.derby.iapi.services.io.FormatIdUtil;
 import org.apache.derby.iapi.services.io.Formatable;
 
 import java.io.ObjectOutput;
 import java.io.ObjectInput;
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
 /**
  * A basic holder for information about cursors
  * for execution.
@@ -57,8 +59,7 @@ public class CursorInfo
 	********************************************************/
 
 	ExecCursorTableReference	targetTable; 
-	ResultColumnDescriptor[]	targetColumns; 
-	String[] 					updateColumns; 
+    List                        updateColumns;
 	int 						updateMode;
 
 	/**
@@ -75,14 +76,13 @@ public class CursorInfo
 	(
 		int							updateMode,
 		ExecCursorTableReference	targetTable,
-		ResultColumnDescriptor[]	targetColumns,
-		String[]					updateColumns
+        List                        updateColumns
 	)
 	{
 		this.updateMode = updateMode;
 		this.targetTable = targetTable;
-		this.targetColumns = targetColumns;
-		this.updateColumns = updateColumns;
+        this.updateColumns = (updateColumns == null) ?
+                null : new ArrayList(updateColumns);
 	}
 
 	//////////////////////////////////////////////
@@ -101,8 +101,13 @@ public class CursorInfo
 	{
 		out.writeInt(updateMode);
 		out.writeObject(targetTable);
-		ArrayUtil.writeArray(out, targetColumns);
-		ArrayUtil.writeArray(out, updateColumns);
+
+        // For backwards compatibility. Used to write an array of
+        // target column descriptors here.
+        ArrayUtil.writeArray(out, (Object[]) null);
+
+        ArrayUtil.writeArray(out, updateColumns == null ?
+                null : updateColumns.toArray());
 	}
 
 	/**
@@ -118,18 +123,15 @@ public class CursorInfo
 	{
 		updateMode = in.readInt();
 		targetTable = (ExecCursorTableReference)in.readObject();
-		int len = ArrayUtil.readArrayLength(in);
-		if (len != 0)
-		{
-			targetColumns = new ResultColumnDescriptor[len];
-			ArrayUtil.readArrayItems(in, targetColumns);
-		}
-		len = ArrayUtil.readArrayLength(in);
-		if (len != 0)
-		{
-			updateColumns = new String[len];
-			ArrayUtil.readArrayItems(in, updateColumns);
-		}
+
+        // For backwards compatibility. Read and discard array that's no
+        // longer used.
+        ArrayUtil.readObjectArray(in);
+
+        int len = ArrayUtil.readArrayLength(in);
+        if (len > 0) {
+            updateColumns = Arrays.asList(ArrayUtil.readStringArray(in));
+        }
 	}
 	
 	/**
@@ -143,43 +145,10 @@ public class CursorInfo
 	{
 		if (SanityManager.DEBUG)
 		{
-			StringBuffer strbuf = new StringBuffer();
-		
-			strbuf.append("CursorInfo"+
+            return "CursorInfo" +
 				"\n\tupdateMode: "+updateMode+
 				"\n\ttargetTable: "+targetTable+
-				"\n\tupdateColumns: ");
-
-			if (updateColumns == null)
-			{
-				strbuf.append("NULL\n");
-			}
-			else
-			{
-				strbuf.append("{");
-				for (int i = 0; i < updateColumns.length; i++)
-				{
-					if (i > 0)
-						strbuf.append(",");
-					strbuf.append(updateColumns[i]);
-				}
-				strbuf.append(")\n");
-			}
-
-			strbuf.append("\tTargetColumnDescriptors: \n");
-			if (targetColumns == null)
-			{
-				strbuf.append("NULL");
-			}
-			else
-			{
-				for (int i = 0; i < targetColumns.length; i++)
-				{
-					strbuf.append(targetColumns[i]);
-				}
-				strbuf.append("\n");
-			}
-			return strbuf.toString();	
+                "\n\tupdateColumns: " + updateColumns + '\n';
 		}
 		else
 		{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericPreparedStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericPreparedStatement.java?rev=1470478&r1=1470477&r2=1470478&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericPreparedStatement.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericPreparedStatement.java
Mon Apr 22 12:39:46 2013
@@ -47,7 +47,6 @@ import org.apache.derby.iapi.sql.Paramet
 import org.apache.derby.iapi.sql.PreparedStatement;
 import org.apache.derby.iapi.sql.Statement;
 import org.apache.derby.iapi.types.DataTypeDescriptor;
-import org.apache.derby.iapi.sql.ResultColumnDescriptor;
 import org.apache.derby.iapi.sql.ResultDescription;
 import org.apache.derby.iapi.sql.ResultSet;
 import org.apache.derby.iapi.sql.Activation;
@@ -126,8 +125,7 @@ public class GenericPreparedStatement
 
 	// fields used for cursors
 	protected ExecCursorTableReference	targetTable; 
-	protected ResultColumnDescriptor[]	targetColumns; 
-	protected String[] 					updateColumns; 
+    protected List                      updateColumns;
 	protected int 						updateMode;
 
 	protected ConstantAction	executionConstants;
@@ -983,7 +981,6 @@ recompileOutOfDatePlan:
 			targetTable = null;
 			updateMode = 0;
 			updateColumns = null;
-			targetColumns = null;
 		}
 
 		// get the result description (null for non-cursor statements)
@@ -1000,14 +997,7 @@ recompileOutOfDatePlan:
 			/*
 				For cursors, we carry around some extra information.
 			 */
-			CursorInfo cursorInfo = (CursorInfo)qt.getCursorInfo();
-			if (cursorInfo != null)
-			{
-				targetTable = cursorInfo.targetTable;
-				targetColumns = cursorInfo.targetColumns;
-				updateColumns = cursorInfo.updateColumns;
-				updateMode = cursorInfo.updateMode;
-			}
+            setCursorInfo((CursorInfo) qt.getCursorInfo());
 		}
 		isValid = true;
 
@@ -1052,24 +1042,13 @@ recompileOutOfDatePlan:
 		return targetTable;
 	}
 
-	/**
-	 * the target columns of the cursor as a result column list
-	 *
-	 * @return	target columns of the cursor as a result column list
-	 */
-	public ResultColumnDescriptor[]	getTargetColumns() {
-		return targetColumns;
-	}
+    public boolean hasUpdateColumns() {
+        return updateColumns != null && !updateColumns.isEmpty();
+    }
 
-	/**
-	 * the update columns of the cursor as a update column list
-	 *
-	 * @return	update columns of the cursor as a array of strings
-	 */
-	public String[]	getUpdateColumns() 
-	{
-		return updateColumns;
-	}
+    public boolean isUpdateColumn(String columnName) {
+        return updateColumns != null && updateColumns.contains(columnName);
+    }
 
 	/**
 	 * Return the cursor info in a single chunk.  Used
@@ -1080,7 +1059,6 @@ recompileOutOfDatePlan:
 		return new CursorInfo(
 			updateMode,
 			targetTable, 
-			targetColumns,
 			updateColumns);
 	}
 
@@ -1090,7 +1068,6 @@ recompileOutOfDatePlan:
 		{
 			updateMode = cursorInfo.updateMode;
 			targetTable = cursorInfo.targetTable;
-			targetColumns = cursorInfo.targetColumns;
 			updateColumns = cursorInfo.updateColumns;
 		}
 	}
@@ -1194,7 +1171,6 @@ recompileOutOfDatePlan:
 		clone.isAtomic = isAtomic;
 		clone.sourceTxt = sourceTxt;
 		clone.targetTable = targetTable;
-		clone.targetColumns = targetColumns;
 		clone.updateColumns = updateColumns;
 		clone.updateMode = updateMode;	
 		clone.needsSavepoint = needsSavepoint;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CurrentOfNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CurrentOfNode.java?rev=1470478&r1=1470477&r2=1470478&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CurrentOfNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CurrentOfNode.java Mon
Apr 22 12:39:46 2013
@@ -339,9 +339,7 @@ public final class CurrentOfNode extends
 				// If so, verify that the column is updatable as well
 				notfound = 
 					(resultColumn.updatableByCursor() &&
-					!foundString(
-							preStmt.getUpdateColumns(), 
-							columnReference.getColumnName()));
+                     !preStmt.isUpdateColumn(columnReference.getColumnName()));
 			}
 			else 
 			{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CursorNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CursorNode.java?rev=1470478&r1=1470477&r2=1470478&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CursorNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CursorNode.java Mon
Apr 22 12:39:46 2013
@@ -28,7 +28,6 @@ import org.apache.derby.iapi.error.Stand
 import org.apache.derby.iapi.reference.SQLState;
 import org.apache.derby.iapi.services.compiler.MethodBuilder;
 import org.apache.derby.iapi.services.sanity.SanityManager;
-import org.apache.derby.iapi.sql.ResultColumnDescriptor;
 import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.sql.conn.Authorizer;
 import org.apache.derby.iapi.sql.dictionary.DataDictionary;
@@ -66,7 +65,6 @@ public class CursorNode extends DMLState
 	*/
 	private List updatableColumns;
 	private FromTable updateTable;
-	private ResultColumnDescriptor[]	targetColumnDescriptors;
     /**
      * List of {@code TableDescriptor}s for base tables whose associated
      * indexes should be checked for stale statistics.
@@ -550,17 +548,9 @@ public class CursorNode extends DMLState
 		if (updateTable.markAsCursorTargetTable()) {
 			/* Cursor is updatable - remember to generate the position code */
 			needTarget = true;
-
-			/* We must generate the target column list at bind time
-			 * because the optimizer may transform the FromBaseTable from
-			 * a table scan into an index scan.
-			 */
-			genTargetResultColList();
 		}
 
 
-
-
 		return UPDATE;
 	}
 
@@ -688,82 +678,6 @@ public class CursorNode extends DMLState
 	}
 
 	/**
-	 * Return String[] of names from the FOR UPDATE OF List
-	 *
-	 * @return	String[] of names from the FOR UPDATE OF list.
-	 */
-	private String[] getUpdatableColumns()
-	{
-		return (updatableColumns == null) ?
-				(String[])null :
-				getUpdateColumnNames();
-	}
-
-	/**
-		Positioned update needs to know what the target result set
-		looks like. This is generated from the UpdateColumnList
-		available for the cursor, to describe the rows coming from
-		the target result set under the cursor. This result set contains
-		a superset of the updatable columns; the caller must verify that
-		only those listed in the FOR UPDATE clause are used.
-
-		@return a result column list containing a description of
-		the target table (this may contain non-updatable columns).
-	 * @exception StandardException		Thrown on error
-	 */
-	private ResultColumnDescriptor[] genTargetResultColList()
-		throws StandardException
-	{
-		ResultColumnList newList;
-
-		/*
-		   updateTable holds the FromTable that is the target.
-		   copy its ResultColumnList, making BaseColumn references
-		   for use in the CurrentOfNode, which behaves as if it had
-		   base columns for the statement it is in.
-
-			updateTable is null if the cursor is not updatable.
-		 */
-		if (updateTable == null) return null;
-
-		if (targetColumnDescriptors != null) return targetColumnDescriptors;
-
-		newList = (ResultColumnList) getNodeFactory().getNode(
-										C_NodeTypes.RESULT_COLUMN_LIST,
-										getContextManager());
-		ResultColumnList rcl = updateTable.getResultColumns();
-		int rclSize = rcl.size();
-		for (int index = 0; index < rclSize; index++)
-		{
-			ResultColumn origCol, newCol;
-			ValueNode newNode;
-
-			origCol = (ResultColumn) rcl.elementAt(index);
-
-			// Build a ResultColumn/BaseColumnNode pair for the column
-			newNode = (ValueNode) getNodeFactory().getNode(
-							C_NodeTypes.BASE_COLUMN_NODE,
-							origCol.getName(),
-							makeTableName(origCol.getSchemaName(),
-										  origCol.getTableName()),								
-							origCol.getTypeServices(),
-							getContextManager());
-			newCol = (ResultColumn) getNodeFactory().getNode(
-									C_NodeTypes.RESULT_COLUMN,
-									origCol.columnDescriptor,
-									newNode,
-									getContextManager());
-
-			/* Build the ResultColumnList to return */
-			newList.addResultColumn(newCol);
-		}
-
-		// we save the result so we only do this once
-		targetColumnDescriptors = newList.makeResultDescriptors();
-		return targetColumnDescriptors;
-	}
-
-	/**
 	 * Returns whether or not this Statement requires a set/clear savepoint
 	 * around its execution.  The following statement "types" do not require them:
 	 *		Cursor	- unnecessary and won't work in a read only environment
@@ -795,8 +709,7 @@ public class CursorNode extends DMLState
 										getUpdateExposedTableName(),
 										getUpdateBaseTableName(),
 										getUpdateSchemaName()),
-								genTargetResultColList(),
-								getUpdatableColumns());
+                                updatableColumns);
 	}
 
 	/**
@@ -843,23 +756,6 @@ public class CursorNode extends DMLState
 		}
 	}
 
-	/**
-	 * Get an array of strings for each updatable column
-	 * in this list.
-	 *
-	 * @return an array of strings
-	 */
-	private String[] getUpdateColumnNames()
-	{
-		int size = updatableColumns.size();
-		if (size == 0)
-		{
-			return (String[])null;
-		}
-
-        return (String[]) updatableColumns.toArray(new String[size]);
-	}
-	
 	public String getXML()
 	{
 		return null;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/QueryTreeNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/QueryTreeNode.java?rev=1470478&r1=1470477&r2=1470478&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/QueryTreeNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/QueryTreeNode.java Mon
Apr 22 12:39:46 2013
@@ -803,23 +803,6 @@ public abstract class QueryTreeNode impl
 		return StatementType.UNKNOWN;
 	}
 
-	public boolean foundString(String[] list, String search)
-	{
-		if (list == null)
-		{
-			return false;
-		}
-
-		for (int i = 0; i < list.length; i++)
-		{
-			if (list[i].equals(search))
-			{	
-				return true;
-			}
-		}
-		return false;
-	}
-
 	/**
 	 * Get a ConstantNode to represent a typed null value. 
 	 *
@@ -1266,11 +1249,6 @@ public abstract class QueryTreeNode impl
 		return false;
 	}
 	
-	public Object getCursorInfo() throws StandardException
-	{
-		return null;
-	}
-
 	/**
 	 * Get the descriptor for the named table within the given schema.
 	 * If the schema parameter is NULL, it looks for the table in the

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumn.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumn.java?rev=1470478&r1=1470477&r2=1470478&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumn.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumn.java Mon
Apr 22 12:39:46 2013
@@ -1680,18 +1680,6 @@ public class ResultColumn extends ValueN
 	}
 
 	/**
-	 * Is this column in this array of strings?
-	 *
-	 * @param list the array of column names to compare
-	 *
-	 * @return true/false
-	 */
-	public boolean foundInList(String[] list)
-	{
-		return foundString(list, name);
-	}
-
-	/**
 	 * Verify that this RC is orderable.
 	 *
 	 * @exception StandardException		Thrown on error

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java?rev=1470478&r1=1470477&r2=1470478&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
Mon Apr 22 12:39:46 2013
@@ -50,6 +50,7 @@ import org.apache.derby.iapi.sql.diction
 import org.apache.derby.iapi.sql.dictionary.DataDictionary;
 import org.apache.derby.iapi.sql.dictionary.DefaultDescriptor;
 import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
+import org.apache.derby.iapi.sql.execute.ExecPreparedStatement;
 import org.apache.derby.iapi.sql.execute.ExecRow;
 import org.apache.derby.iapi.sql.execute.ExecRowBuilder;
 import org.apache.derby.iapi.store.access.ConglomerateController;
@@ -2267,12 +2268,13 @@ public class ResultColumnList extends Qu
 	 * Verify that all of the columns in the SET clause of a positioned update
 	 * appear in the cursor's FOR UPDATE OF list.
 	 *
-	 * @param ucl			The cursor's FOR UPDATE OF list.  (May be null.)
+     * @param cursorStmt the statement that owns the cursor
 	 * @param cursorName	The cursor's name.
 	 *
 	 * @exception StandardException			Thrown on error
 	 */
-	public void checkColumnUpdateability(String[] ucl, String cursorName) 
+    void checkColumnUpdateability(
+            ExecPreparedStatement cursorStmt, String cursorName)
 			throws StandardException
 	{
 		int size = size();
@@ -2282,7 +2284,7 @@ public class ResultColumnList extends Qu
 			ResultColumn resultColumn = (ResultColumn) elementAt(index);
 
 			if (resultColumn.updated() &&
-				! resultColumn.foundInList(ucl))
+                    !cursorStmt.isUpdateColumn(resultColumn.getName()))
 			{
 				throw StandardException.newException(SQLState.LANG_COLUMN_NOT_UPDATABLE_IN_CURSOR, 
 							resultColumn.getName(),

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/StatementNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/StatementNode.java?rev=1470478&r1=1470477&r2=1470478&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/StatementNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/StatementNode.java Mon
Apr 22 12:39:46 2013
@@ -136,6 +136,13 @@ public abstract class StatementNode exte
 		return null;
 	}
 
+    /**
+     * Get an object with information about the cursor if there is one.
+     */
+    public Object getCursorInfo() throws StandardException {
+        return null;
+    }
+
 	/**
 	 * Convert this object to a String. See comments in QueryTreeNode.java for
 	 * how this should be done for tree printing.

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java?rev=1470478&r1=1470477&r2=1470478&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java Mon
Apr 22 12:39:46 2013
@@ -390,13 +390,12 @@ public final class UpdateNode extends DM
 			}
 
 			ExecPreparedStatement	 cursorStmt = currentOfNode.getCursorStatement();
-			String[] ucl = cursorStmt.getUpdateColumns();
 
 			/*
 			** If there is no update column list, we need to build
 			** out the result column list to have all columns.
 			*/
-			if (ucl == null || (ucl.length == 0))
+            if (!cursorStmt.hasUpdateColumns())
 			{
 				/*
 				** Get the resultColumnList representing ALL of the columns in the 
@@ -426,8 +425,8 @@ public final class UpdateNode extends DM
 			else
 			{
 				/* Check the updatability */
-				resultSet.getResultColumns().checkColumnUpdateability(ucl,
-								currentOfNode.getCursorName());
+                resultSet.getResultColumns().checkColumnUpdateability(
+                        cursorStmt, currentOfNode.getCursorName());
 			}
 		}
 



Mime
View raw message