db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1449020 - in /db/derby/code/trunk/java/engine/org/apache/derby: iapi/sql/compile/ impl/sql/compile/
Date Fri, 22 Feb 2013 12:48:56 GMT
Author: kahatlen
Date: Fri Feb 22 12:48:55 2013
New Revision: 1449020

URL: http://svn.apache.org/r1449020
Log:
DERBY-6075: Use modern collections in impl/sql/compile

Change signatures of

  CompilerContext.setParameterList(Vector)
  CompilerContext.getParameterList()
  ResultColumnList.bindExpressions(FromList, SubqueryList, Vector)

to use List instead of Vector.

Also change overrides of those methods, as well as signatures of
local variables, fields and methods used by those methods.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/compile/CompilerContext.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CompilerContextImpl.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/DMLStatementNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromTable.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ParameterNode.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/SetRoleNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetSchemaNode.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/compile/CompilerContext.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/compile/CompilerContext.java?rev=1449020&r1=1449019&r2=1449020&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/compile/CompilerContext.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/compile/CompilerContext.java
Fri Feb 22 12:48:55 2013
@@ -27,10 +27,6 @@ import org.apache.derby.iapi.services.lo
 
 import org.apache.derby.iapi.error.StandardException;
 
-import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
-
-import org.apache.derby.iapi.sql.ParameterValueSet;
-
 import org.apache.derby.iapi.sql.dictionary.AliasDescriptor;
 import org.apache.derby.iapi.sql.dictionary.ColumnDescriptor;
 import org.apache.derby.iapi.sql.dictionary.SequenceDescriptor;
@@ -42,15 +38,12 @@ import org.apache.derby.iapi.sql.depend.
 import org.apache.derby.iapi.sql.depend.Provider;
 import org.apache.derby.iapi.sql.depend.ProviderList;
 
-import org.apache.derby.iapi.sql.compile.TypeCompilerFactory;
-
 import org.apache.derby.iapi.types.DataTypeDescriptor;
 
 import org.apache.derby.iapi.store.access.StoreCostController;
 import org.apache.derby.iapi.store.access.SortCostController;
 
 import java.util.List;
-import java.util.Vector;
 import java.sql.SQLWarning;
 
 /**
@@ -458,14 +451,14 @@ public interface CompilerContext extends
 	 *
 	 * @param parameterList	The parameter list.
 	 */
-	public void setParameterList(Vector parameterList);
+	public void setParameterList(List parameterList);
 
 	/**
 	 * Get the parameter list.
 	 *
 	 * @return	The parameter list.
 	 */
-	public Vector getParameterList();
+	public List getParameterList();
 
 	/**
 	 * If callable statement uses ? = form

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CompilerContextImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CompilerContextImpl.java?rev=1449020&r1=1449019&r2=1449020&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CompilerContextImpl.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CompilerContextImpl.java
Fri Feb 22 12:48:55 2013
@@ -48,7 +48,6 @@ import org.apache.derby.iapi.sql.diction
 import org.apache.derby.iapi.sql.dictionary.StatementRoutinePermission;
 import org.apache.derby.iapi.sql.dictionary.StatementRolePermission;
 
-import org.apache.derby.iapi.types.DataTypeDescriptor;
 
 import org.apache.derby.iapi.sql.compile.TypeCompilerFactory;
 
@@ -59,7 +58,6 @@ import org.apache.derby.iapi.error.Excep
 import org.apache.derby.iapi.sql.execute.ExecutionContext;
 
 import org.apache.derby.iapi.types.DataTypeDescriptor;
-import org.apache.derby.iapi.sql.ParameterValueSet;
 
 import org.apache.derby.iapi.store.access.StoreCostController;
 import org.apache.derby.iapi.store.access.SortCostController;
@@ -67,13 +65,10 @@ import org.apache.derby.iapi.store.acces
 import org.apache.derby.iapi.services.context.ContextManager;
 import org.apache.derby.iapi.services.loader.ClassFactory;
 import org.apache.derby.iapi.services.compiler.JavaFactory;
-import org.apache.derby.iapi.services.uuid.UUIDFactory;
-import org.apache.derby.iapi.services.monitor.Monitor;
 import org.apache.derby.iapi.services.io.FormatableBitSet;
 
 import org.apache.derby.iapi.error.StandardException;
 
-import org.apache.derby.iapi.reference.SQLState;
 
 import org.apache.derby.iapi.services.sanity.SanityManager;
 
@@ -85,8 +80,6 @@ import java.util.Vector;
 import java.util.Properties;
 import java.util.HashMap;
 import java.util.Iterator;
-import java.util.Map.Entry;
-import java.util.BitSet;
 import java.util.List;
 import java.util.Stack;
 import java.util.ArrayList;
@@ -585,7 +578,7 @@ public class CompilerContextImpl extends
 	/**
 	 * @see CompilerContext#setParameterList
 	 */
-	public void setParameterList(Vector parameterList)
+	public void setParameterList(List parameterList)
 	{
 		this.parameterList = parameterList;
 
@@ -601,7 +594,7 @@ public class CompilerContextImpl extends
 	/**
 	 * @see CompilerContext#getParameterList
 	 */
-	public Vector getParameterList()
+	public List getParameterList()
 	{
 		return parameterList;
 	}
@@ -1048,7 +1041,7 @@ public class CompilerContextImpl extends
 
 	private SortCostController	sortCostController;
 
-	private Vector parameterList;
+	private List parameterList;
 
 	/* Type descriptors for the ? parameters */
 	private DataTypeDescriptor[]	parameterDescriptors;

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=1449020&r1=1449019&r2=1449020&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 Fri
Feb 22 12:48:55 2013
@@ -22,7 +22,7 @@
 package	org.apache.derby.impl.sql.compile;
 
 import java.util.ArrayList;
-import java.util.Vector;
+import java.util.List;
 
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.reference.SQLState;
@@ -64,7 +64,7 @@ public class CursorNode extends DMLState
 	** There can only be a list of updatable columns when FOR UPDATE
 	** is specified as part of the cursor specification.
 	*/
-	private Vector	updatableColumns;
+	private List updatableColumns;
 	private FromTable updateTable;
 	private ResultColumnDescriptor[]	targetColumnDescriptors;
     /**
@@ -120,7 +120,7 @@ public class CursorNode extends DMLState
         this.hasJDBClimitClause = (hasJDBClimitClause == null) ? false : ((Boolean) hasJDBClimitClause).booleanValue();
 
 		this.updateMode = ((Integer) updateMode).intValue();
-		this.updatableColumns = (Vector) updatableColumns;
+		this.updatableColumns = (List) updatableColumns;
 
 		/*
 		** This is a sanity check and not an error since the parser
@@ -128,7 +128,7 @@ public class CursorNode extends DMLState
 		*/
 		if (SanityManager.DEBUG)
 		SanityManager.ASSERT(this.updatableColumns == null ||
-			this.updatableColumns.size() == 0 || this.updateMode == UPDATE,
+			this.updatableColumns.isEmpty() || this.updateMode == UPDATE,
 			"Can only have explicit updatable columns if update mode is UPDATE");
 	}
 
@@ -857,11 +857,7 @@ public class CursorNode extends DMLState
 			return (String[])null;
 		}
 
-		String[] names = new String[size];
-
-		updatableColumns.copyInto(names);
-
-		return names;
+        return (String[]) updatableColumns.toArray(new String[size]);
 	}
 	
 	public String getXML()

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DMLStatementNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DMLStatementNode.java?rev=1449020&r1=1449019&r2=1449020&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DMLStatementNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DMLStatementNode.java
Fri Feb 22 12:48:55 2013
@@ -21,18 +21,16 @@
 
 package	org.apache.derby.impl.sql.compile;
 
-import java.util.Vector;
+import java.util.List;
 
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.sql.ResultColumnDescriptor;
 import org.apache.derby.iapi.sql.ResultDescription;
 import org.apache.derby.iapi.sql.compile.C_NodeTypes;
-import org.apache.derby.iapi.sql.compile.Visitable;
 import org.apache.derby.iapi.sql.compile.Visitor;
 import org.apache.derby.iapi.sql.conn.Authorizer;
 import org.apache.derby.iapi.sql.dictionary.DataDictionary;
-import org.apache.derby.iapi.sql.execute.ExecutionContext;
 import org.apache.derby.iapi.util.JBitSet;
 
 /**
@@ -267,12 +265,12 @@ abstract class DMLStatementNode extends 
 	 */
 	int activationKind()
 	{
-		Vector parameterList = getCompilerContext().getParameterList();
+		List parameterList = getCompilerContext().getParameterList();
 		/*
 		** We need rows for all types of DML activations.  We need parameters
 		** only for those that have parameters.
 		*/
-		if (parameterList != null && parameterList.size() > 0)
+		if (parameterList != null && !parameterList.isEmpty())
 		{
 			return StatementNode.NEED_PARAM_ACTIVATION;
 		}
@@ -392,13 +390,13 @@ abstract class DMLStatementNode extends 
 	void generateParameterValueSet(ActivationClassBuilder acb)
 		throws StandardException
 	{
-		Vector parameterList = getCompilerContext().getParameterList();
+		List parameterList = getCompilerContext().getParameterList();
 		int	numberOfParameters = (parameterList == null) ? 0 : parameterList.size();
 
 		if (numberOfParameters <= 0)
 			return;
 
-			ParameterNode.generateParameterValueSet
+        ParameterNode.generateParameterValueSet
 				( acb, numberOfParameters, parameterList);
 	}
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromTable.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromTable.java?rev=1449020&r1=1449019&r2=1449020&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromTable.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromTable.java Fri Feb
22 12:48:55 2013
@@ -24,8 +24,8 @@ package	org.apache.derby.impl.sql.compil
 
 import java.util.Enumeration;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Properties;
-import java.util.Vector;
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.reference.SQLState;
 import org.apache.derby.iapi.services.io.FormatableBitSet;
@@ -1410,7 +1410,7 @@ abstract class FromTable extends ResultS
 	 * @param updateColumns		A Vector representing the columns
 	 *							that can be updated.
 	 */
-	protected void markUpdatableByCursor(Vector updateColumns)
+	protected void markUpdatableByCursor(List updateColumns)
 	{
 		resultColumns.markUpdatableByCursor(updateColumns);
 	}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ParameterNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ParameterNode.java?rev=1449020&r1=1449019&r2=1449020&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ParameterNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ParameterNode.java Fri
Feb 22 12:48:55 2013
@@ -409,7 +409,7 @@ public class ParameterNode extends Value
 	 */
 	static public	void generateParameterValueSet(ExpressionClassBuilder	acb,
 								   int		numberOfParameters,
-								   Vector	parameterList)
+								   List     parameterList)
 		throws StandardException
 	{
 		if (numberOfParameters > 0)

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=1449020&r1=1449019&r2=1449020&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
Fri Feb 22 12:48:55 2013
@@ -25,9 +25,9 @@ import java.lang.reflect.Modifier;
 import java.sql.ResultSetMetaData;
 import java.sql.Types;
 import java.util.Hashtable;
-import java.util.Vector;
 import java.util.Map;
 import java.util.HashMap;
+import java.util.List;
 
 import org.apache.derby.catalog.types.DefaultInfoImpl;
 import org.apache.derby.iapi.error.StandardException;
@@ -817,7 +817,7 @@ public class ResultColumnList extends Qu
 	 */
 	public void bindExpressions(
 					FromList fromList, SubqueryList subqueryList,
-					Vector	aggregateVector)
+					List aggregateVector)
 				throws StandardException
 	{
 		/* First we expand the *'s in the result column list */
@@ -2871,7 +2871,7 @@ public class ResultColumnList extends Qu
 	 * @param updateColumns		A Vector representing the columns
 	 *							to be updated.
 	 */
-	void markColumnsInSelectListUpdatableByCursor(Vector updateColumns)
+	void markColumnsInSelectListUpdatableByCursor(List updateColumns)
 	{
 		commonCodeForUpdatableByCursor(updateColumns, true);
 	}
@@ -2887,7 +2887,8 @@ public class ResultColumnList extends Qu
 	 * In the eg above, we will find updatable column c11 in the select column
 	 * list but we will not find updatable column c12 in the select column list
 	 */
-	private void commonCodeForUpdatableByCursor(Vector updateColumns, boolean dealingWithSelectResultColumnList)
+    private void commonCodeForUpdatableByCursor(
+            List updateColumns, boolean dealingWithSelectResultColumnList)
 	{
 		/*
 		** If there is no update column list, or the list is empty, then it means that
@@ -2932,7 +2933,7 @@ public class ResultColumnList extends Qu
 	 * @param updateColumns		A Vector representing the columns
 	 *							to be updated.
 	 */
-	void markUpdatableByCursor(Vector updateColumns)
+	void markUpdatableByCursor(List updateColumns)
 	{
 		commonCodeForUpdatableByCursor(updateColumns, false);
 	}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetRoleNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetRoleNode.java?rev=1449020&r1=1449019&r2=1449020&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetRoleNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetRoleNode.java Fri
Feb 22 12:48:55 2013
@@ -21,6 +21,8 @@
 
 package     org.apache.derby.impl.sql.compile;
 
+import java.util.List;
+
 import org.apache.derby.iapi.reference.ClassName;
 import org.apache.derby.iapi.services.classfile.VMOpcode;
 import org.apache.derby.iapi.services.compiler.MethodBuilder;
@@ -28,7 +30,6 @@ import org.apache.derby.iapi.services.sa
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.sql.execute.ConstantAction;
 import org.apache.derby.iapi.sql.StatementType;
-import java.util.Vector;
 
 
 /**
@@ -132,7 +133,7 @@ public class SetRoleNode extends Miscell
     private void generateParameterValueSet(ActivationClassBuilder acb)
         throws StandardException
     {
-        Vector parameterList = getCompilerContext().getParameterList();
+        List parameterList = getCompilerContext().getParameterList();
         // parameter list size should be 1
         if (SanityManager.DEBUG) {
             SanityManager.ASSERT(parameterList != null &&
@@ -151,7 +152,6 @@ public class SetRoleNode extends Miscell
      */
     int activationKind()
     {
-        Vector parameterList = getCompilerContext().getParameterList();
         /*
         ** We need parameters only for those that have parameters.
         */

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetSchemaNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetSchemaNode.java?rev=1449020&r1=1449019&r2=1449020&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetSchemaNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetSchemaNode.java Fri
Feb 22 12:48:55 2013
@@ -21,23 +21,18 @@
 
 package	org.apache.derby.impl.sql.compile;
 
+import java.util.List;
+
 import org.apache.derby.iapi.reference.ClassName;
 import org.apache.derby.iapi.services.classfile.VMOpcode;
 
-import org.apache.derby.iapi.services.context.ContextManager;
 import org.apache.derby.iapi.services.compiler.MethodBuilder;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.sql.execute.ConstantAction;
-import org.apache.derby.iapi.sql.Activation;
-import org.apache.derby.iapi.sql.ResultSet;
 import org.apache.derby.iapi.sql.StatementType;
 
-import org.apache.derby.impl.sql.compile.ActivationClassBuilder;
-
-import java.util.Vector;
-
 
 /**
  * A SetSchemaNode is the root of a QueryTree that 
@@ -142,7 +137,7 @@ public class SetSchemaNode extends Misce
 	void generateParameterValueSet(ActivationClassBuilder acb)
 		throws StandardException
 	{
-		Vector parameterList = getCompilerContext().getParameterList();
+		List parameterList = getCompilerContext().getParameterList();
 		// parameter list size should be 1
 		if (SanityManager.DEBUG)
 			SanityManager.ASSERT(parameterList != null && parameterList.size() == 1);
@@ -160,7 +155,6 @@ public class SetSchemaNode extends Misce
 	 */
 	int activationKind()
 	{
-		Vector parameterList = getCompilerContext().getParameterList();
 		/*
 		** We need parameters 
 		** only for those that have parameters.



Mime
View raw message