db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1468317 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/
Date Tue, 16 Apr 2013 07:07:11 GMT
Author: kahatlen
Date: Tue Apr 16 07:07:10 2013
New Revision: 1468317

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

Changes under impl/sql/compile:

- Reduce visibility of some classes, fields and methods

- Remove some unused methods (including one actually used setter
  method where the field it sets is unused)

- Make last parameter of UnaryOperatorNode.init() a scalar rather
  than an array, since it's always a single value

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConstraintDefinitionNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateIndexNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateViewNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DMLModStatementNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NormalizeResultSetNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ParseException.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ProjectRestrictNode.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/ResultColumnList.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UnaryOperatorNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConstraintDefinitionNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConstraintDefinitionNode.java?rev=1468317&r1=1468316&r2=1468317&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConstraintDefinitionNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConstraintDefinitionNode.java
Tue Apr 16 07:07:10 2013
@@ -23,17 +23,13 @@ package	org.apache.derby.impl.sql.compil
 
 import org.apache.derby.iapi.sql.StatementType;
 
-import org.apache.derby.iapi.types.TypeId;
 import org.apache.derby.iapi.sql.dictionary.DataDictionary;
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.sql.depend.ProviderList;
 
-import org.apache.derby.impl.sql.compile.ActivationClassBuilder;
-
 import org.apache.derby.iapi.services.monitor.Monitor;
 
-import org.apache.derby.iapi.util.JBitSet;
 import org.apache.derby.iapi.util.ReuseFactory;
 
 import org.apache.derby.catalog.UUID;
@@ -59,7 +55,6 @@ public class ConstraintDefinitionNode ex
 
 	String			backingIndexName;
 	UUID			backingIndexUUID;
-	int[]			 checkColumnReferences;
 	ResultColumnList columnList;
 	String			 constraintText;
 	ValueNode		 checkCondition;
@@ -467,27 +462,6 @@ public class ConstraintDefinitionNode ex
 	}
 
 	/**
-	 * Get the array of 1-based column references for a check constraint.
-	 *
-	 * @return	The array of 1-based column references for a check constraint.
-	 */
-	public int[] getCheckColumnReferences()
-	{
-		return checkColumnReferences;
-	}
-
-	/**
-	 * Set the array of 1-based column references for a check constraint.
-	 *
-	 * @param checkColumnReferences	The array of 1-based column references
-	 *								for the check constraint.
-	 */
-	public void setCheckColumnReferences(int[] checkColumnReferences)
-	{
-		this.checkColumnReferences = checkColumnReferences;
-	}
-
-	/**
 	 * Return the behavior of this constriant (DropStatementNode.xxx)	
 	 *
 	 * @return the behavior

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateIndexNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateIndexNode.java?rev=1468317&r1=1468316&r2=1468317&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateIndexNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateIndexNode.java
Tue Apr 16 07:07:10 2013
@@ -25,7 +25,6 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Properties;
 
-import org.apache.derby.catalog.UUID;
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.reference.Limits;
 import org.apache.derby.iapi.reference.Property;
@@ -34,7 +33,6 @@ import org.apache.derby.iapi.services.pr
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.sql.compile.CompilerContext;
 import org.apache.derby.iapi.sql.dictionary.ColumnDescriptor;
-import org.apache.derby.iapi.sql.dictionary.DataDictionary;
 import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;
 import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
 import org.apache.derby.iapi.sql.execute.ConstantAction;
@@ -48,18 +46,16 @@ import org.apache.derby.iapi.types.DataT
 
 public class CreateIndexNode extends DDLStatementNode
 {
-	boolean				unique;
-	DataDictionary		dd = null;
-	Properties			properties;
-	String				indexType;
-	TableName			indexName;
-	TableName			tableName;
-	List				columnNameList;
-	String[]			columnNames = null;
-	boolean[]			isAscending;
-	int[]				boundColumnIDs;
-
-	TableDescriptor		td;
+    private boolean             unique;
+    private Properties          properties;
+    private String              indexType;
+    private TableName           indexName;
+    private TableName           tableName;
+    private List                columnNameList;
+    private String[]            columnNames;
+    private boolean[]           isAscending;
+    private int[]               boundColumnIDs;
+    private TableDescriptor     td;
 
 	/**
 	 * Initializer for a CreateIndexNode
@@ -121,19 +117,6 @@ public class CreateIndexNode extends DDL
 		return "CREATE INDEX";
 	}
 
-
-	public	boolean				getUniqueness() { return unique; }
-	public	String				getIndexType() { return indexType; }
-	public	TableName			getIndexName() { return indexName; }
-	public	UUID				getBoundTableID() { return td.getUUID(); }
-    public	Properties			getProperties() { return properties; }
-	public  TableName			getIndexTableName() {return tableName; }
-	public  String[]			getColumnNames() { return columnNames; }
-
-	// get 1-based column ids
-	public	int[]				getKeyColumnIDs() { return boundColumnIDs; }
-	public	boolean[]			getIsAscending() { return isAscending; }
-
 	// We inherit the generate() method from DDLStatementNode.
 
 	/**
@@ -247,8 +230,6 @@ public class CreateIndexNode extends DDL
 
 		int columnCount = columnNames.length;
 		int approxLength = 0;
-		boolean index_has_long_column = false;
-
 
 		// bump the page size for the index,
 		// if the approximate sizes of the columns in the key are

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateViewNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateViewNode.java?rev=1468317&r1=1468316&r2=1468317&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateViewNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateViewNode.java
Tue Apr 16 07:07:10 2013
@@ -167,12 +167,8 @@ public class CreateViewNode extends DDLS
 
 	// accessors
 
-	public	int				getCheckOption() { return checkOption; }
-
 	public	ProviderInfo[]	getProviderInfo() { return providerInfos; }
 
-	public	ColumnInfo[]	getColumnInfo() { return colInfos; }
-
 	// We inherit the generate() method from DDLStatementNode.
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DMLModStatementNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DMLModStatementNode.java?rev=1468317&r1=1468316&r2=1468317&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DMLModStatementNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DMLModStatementNode.java
Tue Apr 16 07:07:10 2013
@@ -1861,7 +1861,7 @@ abstract class DMLModStatementNode exten
 	}
 
 
-	public void setRefActionInfo(long fkIndexConglomId, 
+    void setRefActionInfo(long fkIndexConglomId,
 								 int[]fkColArray, 
 								 String parentResultSetId,
 								 boolean dependentScan)

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java?rev=1468317&r1=1468316&r2=1468317&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java Tue
Apr 16 07:07:10 2013
@@ -4800,9 +4800,9 @@ public class FromBaseTable extends FromT
 
 	/**
 	 * set the Information gathered from the parent table that is 
-	 * required to peform a referential action on dependent table.
+     * required to perform a referential action on dependent table.
 	 */
-	public void setRefActionInfo(long fkIndexConglomId, 
+    void setRefActionInfo(long fkIndexConglomId,
 								 int[]fkColArray, 
 								 String parentResultSetId,
 								 boolean dependentScan)

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NormalizeResultSetNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NormalizeResultSetNode.java?rev=1468317&r1=1468316&r2=1468317&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NormalizeResultSetNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NormalizeResultSetNode.java
Tue Apr 16 07:07:10 2013
@@ -655,9 +655,9 @@ public class NormalizeResultSetNode exte
 
 	/**
 	 * set the Information gathered from the parent table that is 
-	 * required to peform a referential action on dependent table.
+     * required to perform a referential action on dependent table.
 	 */
-	public void setRefActionInfo(long fkIndexConglomId, 
+    void setRefActionInfo(long fkIndexConglomId,
 								 int[]fkColArray, 
 								 String parentResultSetId,
 								 boolean dependentScan)

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ParseException.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ParseException.java?rev=1468317&r1=1468316&r2=1468317&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ParseException.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ParseException.java
Tue Apr 16 07:07:10 2013
@@ -30,7 +30,7 @@ package org.apache.derby.impl.sql.compil
  * You can modify this class to customize your error reporting
  * mechanisms so long as you retain the public fields.
  */
-public class ParseException extends Exception {
+class ParseException extends Exception {
 
   /**
    * This constructor is used by the method "generateParseException"

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ProjectRestrictNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ProjectRestrictNode.java?rev=1468317&r1=1468316&r2=1468317&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ProjectRestrictNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ProjectRestrictNode.java
Tue Apr 16 07:07:10 2013
@@ -1860,9 +1860,9 @@ public class ProjectRestrictNode extends
 
 	/**
 	 * set the Information gathered from the parent table that is 
-	 * required to peform a referential action on dependent table.
+     * required to perform a referential action on dependent table.
 	 */
-	public void setRefActionInfo(long fkIndexConglomId, 
+    void setRefActionInfo(long fkIndexConglomId,
 								 int[]fkColArray, 
 								 String parentResultSetId,
 								 boolean dependentScan)

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=1468317&r1=1468316&r2=1468317&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 Tue
Apr 16 07:07:10 2013
@@ -1527,9 +1527,9 @@ public abstract class QueryTreeNode impl
 
 	/**
 	 * set the Information gathered from the parent table that is 
-	 * required to peform a referential action on dependent table.
+     * required to perform a referential action on dependent table.
 	 */
-	public void setRefActionInfo(long fkIndexConglomId, 
+    void setRefActionInfo(long fkIndexConglomId,
 								 int[]fkColArray, 
 								 String parentResultSetId,
 								 boolean dependentScan)

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=1468317&r1=1468316&r2=1468317&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
Tue Apr 16 07:07:10 2013
@@ -4409,12 +4409,12 @@ public class ResultColumnList extends Qu
     }
 
 
-    public class ColumnMapping {
+    static class ColumnMapping {
 
-        public final int[] mapArray;
-        public final boolean[] cloneMap;
+        final int[] mapArray;
+        final boolean[] cloneMap;
 
-        public ColumnMapping(int[] mapArray, boolean[] cloneMap) {
+        private ColumnMapping(int[] mapArray, boolean[] cloneMap) {
             this.mapArray = mapArray;
             this.cloneMap = cloneMap;
         }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java?rev=1468317&r1=1468316&r2=1468317&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java
Tue Apr 16 07:07:10 2013
@@ -678,20 +678,13 @@ public class TableElementList extends Qu
 				cc.setReliability(previousReliability);
 			}
 	
-			/* We have a valid check constraint, now build an array of
-			 * 1-based columnIds that the constraint references.
-			 */
-			ResultColumnList rcl = table.getResultColumns();
-			int		numReferenced = rcl.countReferencedColumns();
-			int[]	checkColumnReferences = new int[numReferenced];
-
-			rcl.recordColumnReferences(checkColumnReferences, 1);
-			cdn.setCheckColumnReferences(checkColumnReferences);
-
-			/* Now we build a list with only the referenced columns and
+            /* We have a valid check constraint.
+             * Now we build a list with only the referenced columns and
 			 * copy it to the cdn.  Thus we can build the array of
 			 * column names for the referenced columns during generate().
 			 */
+            ResultColumnList rcl = table.getResultColumns();
+            int numReferenced = rcl.countReferencedColumns();
 			ResultColumnList refRCL =
 						(ResultColumnList) getNodeFactory().getNode(
 												C_NodeTypes.RESULT_COLUMN_LIST,

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UnaryOperatorNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UnaryOperatorNode.java?rev=1468317&r1=1468316&r2=1468317&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UnaryOperatorNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UnaryOperatorNode.java
Tue Apr 16 07:07:10 2013
@@ -110,9 +110,11 @@ public class UnaryOperatorNode extends O
 		ClassName.XMLDataValue			// XMLSerialize
 	};
 
-	// Array to hold Objects that contain primitive
-	// args required by the operator method call.
-	private Object [] additionalArgs;
+    /** Target type for XMLSerialize operator. */
+    private DataTypeDescriptor targetType;
+
+    /** Whether or not an XMLParse operator should preserve whitespace. */
+    private boolean preserveWhitespace;
 
 	/**
 	 * Initializer for a UnaryOperatorNode.
@@ -146,8 +148,8 @@ public class UnaryOperatorNode extends O
 			if (SanityManager.DEBUG) {
 				SanityManager.ASSERT(
 					((operatorOrOpType instanceof Integer) &&
-						((methodNameOrAddedArgs == null) ||
-						(methodNameOrAddedArgs instanceof Object[]))),
+                      ((methodNameOrAddedArgs instanceof DataTypeDescriptor) ||
+                       (methodNameOrAddedArgs instanceof Boolean))),
 					"Init params in UnaryOperator node have the " +
 					"wrong type.");
 			}
@@ -156,7 +158,15 @@ public class UnaryOperatorNode extends O
 			this.methodName = UnaryMethodNames[this.operatorType];
 			this.resultInterfaceType = UnaryResultTypes[this.operatorType];
 			this.receiverInterfaceType = UnaryArgTypes[this.operatorType];
-			this.additionalArgs = (Object[])methodNameOrAddedArgs;
+            if (operatorType == XMLSERIALIZE_OP) {
+                targetType = (DataTypeDescriptor) methodNameOrAddedArgs;
+            } else if (operatorType == XMLPARSE_OP) {
+                preserveWhitespace =
+                    ((Boolean) methodNameOrAddedArgs).booleanValue();
+            } else if (SanityManager.DEBUG) {
+                SanityManager.THROWASSERT(
+                    "Don't know how to handle operator type " + operatorType);
+            }
 		}
 	}
 
@@ -401,13 +411,10 @@ public class UnaryOperatorNode extends O
         // it from there.
         if (SanityManager.DEBUG) {
             SanityManager.ASSERT(
-                ((additionalArgs != null) && (additionalArgs.length > 0)),
+                (targetType != null),
                 "Failed to locate target type for XMLSERIALIZE operator");
         }
 
-        DataTypeDescriptor targetType =
-            (DataTypeDescriptor)additionalArgs[0];
-
         TypeId targetTypeId = targetType.getTypeId();
         switch (targetTypeId.getJDBCTypeId())
         {
@@ -739,8 +746,6 @@ public class UnaryOperatorNode extends O
         // StringDataValue, then we should use the collation to
         // decide whether we need to generate collation sensitive
         // StringDataValue.
-            DataTypeDescriptor targetType =
-                (DataTypeDescriptor)additionalArgs[0];
             mb.push(targetType.getJDBCTypeId());
             mb.push(targetType.getMaximumWidth());
             mb.push(getSchemaDescriptor(null, false).getCollationType());
@@ -763,7 +768,7 @@ public class UnaryOperatorNode extends O
         mb.swap();
 
         // Push whether or not we want to preserve whitespace.
-        mb.push(((Boolean)additionalArgs[0]).booleanValue());
+        mb.push(preserveWhitespace);
 
         // Push the SqlXmlUtil instance as the next argument.
         pushSqlXmlUtil(acb, mb, null, null);

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj?rev=1468317&r1=1468316&r2=1468317&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj Tue Apr
16 07:07:10 2013
@@ -7050,7 +7050,7 @@ ValueNode
 					C_NodeTypes.XML_PARSE_OPERATOR_NODE,
 					value,
 					ReuseFactory.getInteger(UnaryOperatorNode.XMLPARSE_OP),
-					new Object[] {(wsOption ? Boolean.TRUE : Boolean.FALSE)},
+					Boolean.valueOf(wsOption),
 					getContextManager());
 	}
 }
@@ -7117,7 +7117,7 @@ ValueNode
 					C_NodeTypes.XML_SERIALIZE_OPERATOR_NODE,
 					value,
 					ReuseFactory.getInteger(UnaryOperatorNode.XMLSERIALIZE_OP),
-					new Object[] {targetType},
+					targetType,
 					getContextManager());
 	}
 }



Mime
View raw message