db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1563368 - in /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql: catalog/ compile/
Date Sat, 01 Feb 2014 03:08:49 GMT
Author: rhillegas
Date: Sat Feb  1 03:08:48 2014
New Revision: 1563368

URL: http://svn.apache.org/r1563368
Log:
DERBY-6464: Improve encapsulation of ResultColumn and ColumnReference; tests passed cleanly for me on derby-6464-01-aa-makeFieldsPrivate.diff.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AllResultColumn.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnReference.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/CurrentOfNode.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/DeleteNode.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/FromList.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/InsertNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MatchingClauseNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MergeNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrderByColumn.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PredicateList.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/SelectNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.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/catalog/DataDictionaryImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java?rev=1563368&r1=1563367&r2=1563368&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java Sat Feb  1 03:08:48 2014
@@ -4942,7 +4942,7 @@ public final class	DataDictionaryImpl
 			//usage of trigger action columns again in 10.9
             for (ColumnReference ref : refs)
 			{
-				TableName tableName = ref.getTableNameNode();
+				TableName tableName = ref.getQualifiedTableName();
 				if ((tableName == null) ||
 					((oldReferencingName == null || !oldReferencingName.equals(tableName.getTableName())) &&
 					(newReferencingName == null || !newReferencingName.equals(tableName.getTableName()))))
@@ -5033,7 +5033,7 @@ public final class	DataDictionaryImpl
 		//		(SELECT c FROM new TriggerOldTransitionTable OLD)
         for (ColumnReference ref : refs)
 		{
-			TableName tableName = ref.getTableNameNode();
+			TableName tableName = ref.getQualifiedTableName();
 			if ((tableName == null) ||
 				((oldReferencingName == null || !oldReferencingName.equals(tableName.getTableName())) &&
 				(newReferencingName == null || !newReferencingName.equals(tableName.getTableName()))))

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AllResultColumn.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AllResultColumn.java?rev=1563368&r1=1563367&r2=1563368&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AllResultColumn.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AllResultColumn.java Sat Feb  1 03:08:48 2014
@@ -70,7 +70,7 @@ class AllResultColumn extends ResultColu
 	{
 		if (SanityManager.DEBUG)
 		{
-			SanityManager.ASSERT(columnDescriptor == null,
+			SanityManager.ASSERT(getColumnDescriptor() == null,
 					"columnDescriptor is expected to be non-null");
 		}
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnReference.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnReference.java?rev=1563368&r1=1563367&r2=1563368&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnReference.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnReference.java Sat Feb  1 03:08:48 2014
@@ -42,14 +42,14 @@ import org.apache.derby.iapi.util.JBitSe
 
 public class ColumnReference extends ValueNode
 {
-	String	columnName;
+	private String	_columnName;
 
 	/*
 	** This is the user-specified table name.  It will be null if the
 	** user specifies a column without a table name.  Leave it null even
 	** when the column is bound as it is only used in binding.
 	*/
-	TableName	tableName;
+	private TableName	_qualifiedTableName;
 
     /**
      * The FromTable this column reference is bound to.
@@ -76,10 +76,10 @@ public class ColumnReference extends Val
     private ResultColumn source;
 
 	/* For unRemapping */
-	ResultColumn	origSource;
+	private ResultColumn	_origSource;
 	private String	origName;
-	int				origTableNumber = -1;
-	int				origColumnNumber = -1;
+	private int				_origTableNumber = -1;
+	private int				_origColumnNumber = -1;
 
     /* For remembering original (tn,cn) of this CR during join flattening. */
     private int tableNumberBeforeFlattening = -1;
@@ -123,8 +123,8 @@ public class ColumnReference extends Val
                     int            tokEndOffset,
                     ContextManager cm)  {
         super(cm);
-        this.columnName = columnName;
-        this.tableName = tableName;
+        _columnName = columnName;
+        _qualifiedTableName = tableName;
         this.setBeginOffset(tokBeginOffset);
         this.setEndOffset(tokEndOffset);
 		tableNumber = -1;
@@ -142,8 +142,8 @@ public class ColumnReference extends Val
                     TableName      tableName,
                     ContextManager cm) {
         super(cm);
-        this.columnName = columnName;
-        this.tableName = tableName;
+        _columnName = columnName;
+        _qualifiedTableName = tableName;
 		tableNumber = -1;
 		remaps = null;
 	}
@@ -159,14 +159,14 @@ public class ColumnReference extends Val
 	{
 		if (SanityManager.DEBUG)
 		{
-			return "columnName: " + columnName + "\n" +
+			return "columnName: " + _columnName + "\n" +
 				"tableNumber: " + tableNumber + "\n" +
 				"columnNumber: " + columnNumber + "\n" +
 				"replacesAggregate: " + replacesAggregate + "\n" +
 				"replacesWindowFunctionCall: " +
 				    replacesWindowFunctionCall + "\n" +
-				"tableName: " + ( ( tableName != null) ?
-								  tableName.toString() :
+				"tableName: " + ( ( _qualifiedTableName != null) ?
+								  _qualifiedTableName.toString() :
 								  "null") + "\n" +
 				"nestingLevel: " + nestingLevel + "\n" +
 				"sourceLevel: " + sourceLevel + "\n" +
@@ -209,9 +209,9 @@ public class ColumnReference extends Val
 		if (SanityManager.DEBUG)
 		{
 			SanityManager.ASSERT(nestingLevel != -1,
-				"nestingLevel on "+columnName+" is not expected to be -1");
+				"nestingLevel on "+_columnName+" is not expected to be -1");
 			SanityManager.ASSERT(sourceLevel != -1,
-				"sourceLevel on "+columnName+" is not expected to be -1");
+				"sourceLevel on "+_columnName+" is not expected to be -1");
 		}
 		return sourceLevel != nestingLevel;
 	}
@@ -325,7 +325,7 @@ public class ColumnReference extends Val
 		throws StandardException
 	{
         ColumnReference newCR =
-                new ColumnReference(columnName, tableName, getContextManager());
+                new ColumnReference(_columnName, _qualifiedTableName, getContextManager());
 
 		newCR.copyFields(this);
 		return newCR;
@@ -343,7 +343,7 @@ public class ColumnReference extends Val
 	{
 		super.copyFields(oldCR);
 
-		tableName = oldCR.getTableNameNode();
+		_qualifiedTableName = oldCR.getQualifiedTableName();
 		tableNumber = oldCR.getTableNumber();
 		columnNumber = oldCR.getColumnNumber();
 		source = oldCR.getSource();
@@ -388,7 +388,7 @@ public class ColumnReference extends Val
 
 		if (fromList.size() == 0)
 		{
-			throw StandardException.newException(SQLState.LANG_ILLEGAL_COLUMN_REFERENCE, columnName);
+			throw StandardException.newException(SQLState.LANG_ILLEGAL_COLUMN_REFERENCE, _columnName);
 		}
 
 		matchingRC = fromList.bindColumnReference(this);
@@ -413,10 +413,12 @@ public class ColumnReference extends Val
 
     String getSQLColumnName()
 	{
-		if (tableName == null)
-			return columnName;
+		if (_qualifiedTableName == null)
+        {
+			return _columnName;
+        }
 		
-		return tableName.toString() + "." + columnName;
+		return _qualifiedTableName.toString() + "." + _columnName;
 	}
 
 	/**
@@ -427,7 +429,7 @@ public class ColumnReference extends Val
     @Override
 	public String getColumnName()
 	{
-		return columnName;
+		return _columnName;
 	}
 
 	/**
@@ -469,7 +471,7 @@ public class ColumnReference extends Val
     @Override
     String getTableName()
 	{
-		return ( ( tableName != null) ? tableName.getTableName() : null );
+		return ( ( _qualifiedTableName != null) ? _qualifiedTableName.getTableName() : null );
 	}
 
 	/**
@@ -519,14 +521,14 @@ public class ColumnReference extends Val
 	  Return the table name as the node it is.
 	  @return the column's table name.
 	 */
-	public TableName getTableNameNode()
+	public TableName getQualifiedTableName()
 	{
-		return tableName;
+		return _qualifiedTableName;
 	}
 
-    void setTableNameNode(TableName tableName)
+    void setQualifiedTableName(TableName tableName)
 	{
-		this.tableName = tableName;
+		_qualifiedTableName = tableName;
 	}
 
 	/**
@@ -670,7 +672,7 @@ public class ColumnReference extends Val
 
 		if (SanityManager.DEBUG)
 		{
-			// SanityManager.ASSERT(origSource == null,
+			// SanityManager.ASSERT(_origSource == null,
 			// 		"Trying to remap ColumnReference twice without unremapping it.");
 		}
 
@@ -690,24 +692,24 @@ public class ColumnReference extends Val
 		 * have to keep track of the "orig" info for every remap
 		 * operation, not just for the most recent one.
 		 */
-		if (scoped && (origSource != null))
+		if (scoped && (_origSource != null))
 		{
 			if (remaps == null)
 				remaps = new java.util.ArrayList<RemapInfo>();
 			remaps.add(new RemapInfo(
-				columnNumber, tableNumber, columnName, source));
+				columnNumber, tableNumber, _columnName, source));
 		}
 		else
 		{
-			origSource = source;
-			origName = columnName;
-			origColumnNumber = columnNumber;
-			origTableNumber = tableNumber;
+			_origSource = source;
+			origName = _columnName;
+			_origColumnNumber = columnNumber;
+			_origTableNumber = tableNumber;
 		}
 
 		/* Find the matching ResultColumn */
 		source = getSourceResultColumn();
-		columnName = source.getName();
+		_columnName = source.getName();
         // Use the virtual column id if the ResultColumn's expression
         // is a virtual column (DERBY-5933).
         columnNumber = source.getExpression() instanceof VirtualColumnNode ?
@@ -732,23 +734,25 @@ public class ColumnReference extends Val
 
     void unRemapColumnReferences()
 	{
-		if (origSource == null)
+		if (_origSource == null)
+        {
 			return;
+        }
 
 		if (SanityManager.DEBUG)
 		{
-			// SanityManager.ASSERT(origSource != null,
+			// SanityManager.ASSERT(_origSource != null,
 			// 	"Trying to unremap a ColumnReference that was not remapped.");
 		}
 
         if ((remaps == null) || (remaps.isEmpty()))
 		{
-			source = origSource;
-			origSource = null;
-			columnName = origName;
+			source = _origSource;
+			_origSource = null;
+			_columnName = origName;
 			origName = null;
-			tableNumber = origTableNumber;
-			columnNumber = origColumnNumber;
+			tableNumber = _origTableNumber;
+			columnNumber = _origColumnNumber;
 		}
 		else
 		{
@@ -756,7 +760,7 @@ public class ColumnReference extends Val
 			// recent (and only the most recent) remap operation.
 			RemapInfo rI = remaps.remove(remaps.size() - 1);
 			source = rI.getSource();
-			columnName = rI.getColumnName();
+			_columnName = rI.getColumnName();
 			tableNumber = rI.getTableNumber();
 			columnNumber = rI.getColumnNumber();
             if (remaps.isEmpty())
@@ -772,7 +776,7 @@ public class ColumnReference extends Val
 	 */
 	protected boolean hasBeenRemapped()
 	{
-		return (origSource != null);
+		return (_origSource != null);
 	}
 
 	/*
@@ -837,14 +841,14 @@ public class ColumnReference extends Val
 			{
 				SanityManager.THROWASSERT(
 					"sourceRC is expected to be non-null for " +
-					columnName);
+					_columnName);
 			}
 
 			if ( ! sourceRC.isRedundant())
 			{
 				SanityManager.THROWASSERT(
 					"sourceRC is expected to be redundant for " +
-					columnName);
+					_columnName);
 			}
 		}
 
@@ -892,19 +896,19 @@ public class ColumnReference extends Val
                 ResultColumn ftRC = rcl.getResultColumn(
                     tableNumberBeforeFlattening,
                     columnNumberBeforeFlattening,
-                    columnName);
+                    _columnName);
 
                 if (ftRC == null) {
                     // The above lookup won't work for references to a base
                     // column, so fall back on column name, which is unique
                     // then.
-                    ftRC = rcl.getResultColumn(columnName);
+                    ftRC = rcl.getResultColumn(_columnName);
                 }
 
                 if (SanityManager.DEBUG) {
                     SanityManager.ASSERT(
                         ftRC != null,
-                        "Failed to find column '" + columnName +
+                        "Failed to find column '" + _columnName +
                         "' in the " + "RCL for '" + ft.getTableName() +
                         "'.");
                 }
@@ -1046,7 +1050,7 @@ public class ColumnReference extends Val
     @Override
     String getSchemaName()
 	{
-		return ( ( tableName != null) ? tableName.getSchemaName() : null );
+		return ( ( _qualifiedTableName != null) ? _qualifiedTableName.getSchemaName() : null );
 	}
 
 	/**
@@ -1199,7 +1203,7 @@ public class ColumnReference extends Val
 
 		ColumnReference other = (ColumnReference)o;
 		return (tableNumber == other.tableNumber 
-				&& columnName.equals(other.getColumnName()));
+				&& _columnName.equals(other.getColumnName()));
 	}
 
 	/**
@@ -1255,8 +1259,8 @@ public class ColumnReference extends Val
     void acceptChildren(Visitor v) throws StandardException {
         super.acceptChildren(v);
 
-        if (tableName != null) {
-            tableName = (TableName) tableName.accept(v);
+        if (_qualifiedTableName != null) {
+            _qualifiedTableName = (TableName) _qualifiedTableName.accept(v);
         }
     }
 }

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=1563368&r1=1563367&r2=1563368&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 Sat Feb  1 03:08:48 2014
@@ -348,7 +348,7 @@ class CreateViewNode extends DDLStatemen
 			// if we hit a generated column in what we think is the visible
 			// range.
 			if (SanityManager.DEBUG) {
-				if (rc.isGenerated)
+				if (rc.isGenerated())
 					SanityManager.THROWASSERT("Encountered generated column in expected visible range at rcl[" + index +"]");
 			}
 			//RESOLVEAUTOINCREMENT

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=1563368&r1=1563367&r2=1563368&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 Sat Feb  1 03:08:48 2014
@@ -293,7 +293,7 @@ public final class CurrentOfNode extends
 		ResultColumn	resultColumn = null;
 		TableName		columnsTableName;
 
-		columnsTableName = columnReference.getTableNameNode();
+		columnsTableName = columnReference.getQualifiedTableName();
 
         if(columnsTableName != null)
             if(columnsTableName.getSchemaName() == null && correlationName == null)

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=1563368&r1=1563367&r2=1563368&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 Sat Feb  1 03:08:48 2014
@@ -1916,7 +1916,7 @@ abstract class DMLModStatementNode exten
 				{
 					if ( synTableName.equals( crTableName ) )
 					{
-						reference.setTableNameNode( targetTableName );
+						reference.setQualifiedTableName( targetTableName );
 					}
 					else
 					{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java?rev=1563368&r1=1563367&r2=1563368&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java Sat Feb  1 03:08:48 2014
@@ -1015,7 +1015,7 @@ class DeleteNode extends DMLModStatement
 			{
 				ColumnReference	reference = (ColumnReference) expression;
 				
-				reference.setTableNameNode( correlationNameNode );
+				reference.setQualifiedTableName( correlationNameNode );
 			}
 		}
 		

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=1563368&r1=1563367&r2=1563368&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 Sat Feb  1 03:08:48 2014
@@ -2757,7 +2757,7 @@ class FromBaseTable extends FromTable
 		TableName		columnsTableName;
 		TableName		exposedTableName;
 
-		columnsTableName = columnReference.getTableNameNode();
+		columnsTableName = columnReference.getQualifiedTableName();
 
         if(columnsTableName != null) {
             if(columnsTableName.getSchemaName() == null && correlationName == null)

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromList.java?rev=1563368&r1=1563367&r2=1563368&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromList.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromList.java Sat Feb  1 03:08:48 2014
@@ -710,7 +710,7 @@ class FromList extends    QueryTreeNodeV
                     crtn = fbt.getExposedTableName();
                 }
             }
-            columnReference.setTableNameNode( crtn );
+            columnReference.setQualifiedTableName( crtn );
         }
         
 		return matchingRC;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java?rev=1563368&r1=1563367&r2=1563368&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java Sat Feb  1 03:08:48 2014
@@ -1100,7 +1100,7 @@ class FromVTI extends FromTable implemen
 		ResultColumn	resultColumn = null;
 		TableName		columnsTableName;
 
-		columnsTableName = columnReference.getTableNameNode();
+		columnsTableName = columnReference.getQualifiedTableName();
 
 		/*
 		** If the column did not specify a name, or the specified name

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/InsertNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/InsertNode.java?rev=1563368&r1=1563367&r2=1563368&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/InsertNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/InsertNode.java Sat Feb  1 03:08:48 2014
@@ -430,7 +430,7 @@ public final class InsertNode extends DM
 			for (int index = 0; index < targetSize; index++)
 			{
                 int position = targetColumnList.elementAt(index).
-												columnDescriptor.getPosition();
+                    getColumnDescriptor().getPosition();
 
 				if (index != position-1)
 				{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MatchingClauseNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MatchingClauseNode.java?rev=1563368&r1=1563367&r2=1563368&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MatchingClauseNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MatchingClauseNode.java Sat Feb  1 03:08:48 2014
@@ -317,7 +317,7 @@ public class MatchingClauseNode extends 
             {
                 mergeNode.getColumnsInExpression( drivingColumnMap, rc.getExpression() );
 
-                ColumnReference leftCR = new ColumnReference( rc.exposedName, targetTableName, getContextManager() );
+                ColumnReference leftCR = new ColumnReference( rc.getName(), targetTableName, getContextManager() );
                 mergeNode.addColumn( drivingColumnMap, leftCR );
             }
         }
@@ -535,7 +535,7 @@ public class MatchingClauseNode extends 
                     origRC.setExpression( cr );
 
                     // remove the column descriptor in order to turn off hasGenerationClause()
-                    origRC.columnDescriptor = null;
+                    origRC.setColumnDescriptor( null, null );
                 }
                 
                 continue;
@@ -834,7 +834,7 @@ public class MatchingClauseNode extends 
         for ( int i = 0; i <_insertValues.size(); i++ )
         {
             ResultColumn    rc = _insertValues.elementAt( i );
-            String          columnName = _insertColumns.elementAt( i ).exposedName;
+            String          columnName = _insertColumns.elementAt( i ).getName();
             ValueNode       expr = rc.getExpression();
             ColumnDescriptor    cd = td.getColumnDescriptor( columnName );
 
@@ -1402,7 +1402,7 @@ public class MatchingClauseNode extends 
         {
             ResultColumn    lastLeftJoinRC = leftJoinResult.elementAt( leftJoinResult.size() - 1 );
             ValueNode       value = lastLeftJoinRC.getExpression();
-            String              columnName = lastLeftJoinRC.exposedName;
+            String              columnName = lastLeftJoinRC.getName();
             ColumnReference rowLocationCR = new ColumnReference
                 ( columnName, hojn.getTableName(), getContextManager() );
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MergeNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MergeNode.java?rev=1563368&r1=1563367&r2=1563368&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MergeNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MergeNode.java Sat Feb  1 03:08:48 2014
@@ -352,7 +352,7 @@ public final class MergeNode extends DML
 
         for ( ColumnReference cr : colRefs )
         {
-            TableName   origTableName = cr.tableName;
+            TableName   origTableName = cr.getQualifiedTableName();
             if ( origTableName != null )
             {
                 if (
@@ -360,7 +360,7 @@ public final class MergeNode extends DML
                     correlationName.equals( origTableName.getTableName() )
                     )
                 {
-                    cr.setTableNameNode( newTableName );
+                    cr.setQualifiedTableName( newTableName );
                 }
             }
         }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrderByColumn.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrderByColumn.java?rev=1563368&r1=1563367&r2=1563368&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrderByColumn.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/OrderByColumn.java Sat Feb  1 03:08:48 2014
@@ -218,7 +218,7 @@ class OrderByColumn extends OrderedColum
 			if (addedColumnOffset >= 0 &&
 					target instanceof SelectNode &&
 					( (SelectNode)target ).hasDistinct())
-				throw StandardException.newException(SQLState.LANG_DISTINCT_ORDER_BY, cr.columnName);
+				throw StandardException.newException(SQLState.LANG_DISTINCT_ORDER_BY, cr.getColumnName());
 		}else if(isReferedColByNum(expression)){
 			
 			ResultColumnList targetCols = target.getResultColumns();
@@ -390,7 +390,7 @@ class OrderByColumn extends OrderedColum
 			ColumnReference cr = (ColumnReference) expression;
 
 			resultCol = targetCols.findResultColumnForOrderBy(
-                    cr.getColumnName(), cr.getTableNameNode());
+                    cr.getColumnName(), cr.getQualifiedTableName());
 
 			if(resultCol == null){
                resultCol = new ResultColumn(
@@ -474,8 +474,8 @@ class OrderByColumn extends OrderedColum
 			throw StandardException.newException(SQLState.LANG_QUALIFIED_COLUMN_NAME_NOT_ALLOWED, fullName);
 		}
 
-		if(cr.getTableNameNode() != null){
-			TableName tableNameNode = cr.getTableNameNode();
+		if(cr.getQualifiedTableName() != null){
+			TableName tableNameNode = cr.getQualifiedTableName();
 
 			FromTable fromTable = target.getFromTableByName(tableNameNode.getTableName(),
 									(tableNameNode.hasSchema() ?
@@ -487,7 +487,7 @@ class OrderByColumn extends OrderedColum
 								       tableNameNode.getSchemaName():null),
 								      false);
 				if(fromTable == null){
-					String fullName = cr.getTableNameNode().toString();
+					String fullName = cr.getQualifiedTableName().toString();
 					throw StandardException.newException(SQLState.LANG_EXPOSED_NAME_NOT_FOUND, fullName);
 				}
 			}
@@ -512,7 +512,7 @@ class OrderByColumn extends OrderedColum
 
         ResultColumn resCol = targetCols.getOrderByColumnToBind(
                             cr.getColumnName(),
-							cr.getTableNameNode(),
+							cr.getQualifiedTableName(),
 							sourceTableNumber,
 							this);
         /* Search targetCols before using addedColumnOffset because select list wildcards, '*',
@@ -524,7 +524,7 @@ class OrderByColumn extends OrderedColum
             resolveAddedColumn(target);
 							
         if (resCol == null || resCol.isNameGenerated()){
-			String errString = cr.columnName;
+			String errString = cr.getColumnName();
 			throw StandardException.newException(SQLState.LANG_ORDER_BY_COLUMN_NOT_FOUND, errString);
 		}
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java?rev=1563368&r1=1563367&r2=1563368&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java Sat Feb  1 03:08:48 2014
@@ -1479,7 +1479,7 @@ class PredicateList extends QueryTreeNod
                 }
 
 				// Remap this crNode to underlying column reference in the select, if possible.
-				ColumnReference newCRNode = select.findColumnReferenceInResult(crNode.columnName);
+				ColumnReference newCRNode = select.findColumnReferenceInResult(crNode.getColumnName());
 				if (newCRNode == null)
 					continue;
 

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=1563368&r1=1563367&r2=1563368&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 Sat Feb  1 03:08:48 2014
@@ -64,26 +64,26 @@ import org.apache.derby.iapi.util.String
 class ResultColumn extends ValueNode
                 implements ResultColumnDescriptor, Comparable<ResultColumn>
 {
-	/* name and exposedName should point to the same string, unless there is a
-	 * derived column list, in which case name will point to the underlying name
-	 * and exposedName will point to the name from the derived column list.
-	 */
-	String			name;
-	String			exposedName;
-	String			tableName;
-	String			sourceTableName;
+	/* _underlyingName and _derivedColumnName should point to the same string, unless there is a
+	 * derived column list, in which case _underlyingName will point to the underlying name
+	 * and _derivedColumnName will point to the name from the derived column list.
+	 */
+	private String			_underlyingName; // name from the actual data source
+	private String			_derivedColumnName;
+	private String			_unqualifiedTableName;
+	private String			_unqualifiedSourceTableName;
 	//Used by metadata api ResultSetMetaData.getSchemaName to get a column's table's schema.
-	String			sourceSchemaName;
-	ValueNode		expression;
-	ColumnDescriptor	columnDescriptor;
-	boolean			isGenerated;
-	boolean			isGeneratedForUnmatchedColumnInInsert;
-	boolean			isGroupingColumn;
-	boolean			isReferenced;
-	boolean			isRedundant;
-	boolean			isNameGenerated;
-	boolean			updated;
-	boolean			updatableByCursor;
+	private String			_sourceSchemaName;
+	private ValueNode		_expression;
+	private ColumnDescriptor	_columnDescriptor;
+	private boolean			_isGenerated;
+	private boolean			_isGeneratedForUnmatchedColumnInInsert;
+	private boolean			_isGroupingColumn;
+	private boolean			_isReferenced;
+	private boolean			_isRedundant;
+	private boolean			_isNameGenerated;
+	private boolean			_updated;
+	private boolean			_updatableByCursor;
 	private boolean defaultColumn;
     private boolean wasDefault;
     //Following 2 fields have been added for DERBY-4631. 
@@ -132,13 +132,13 @@ class ResultColumn extends ValueNode
      * @param cm context manager
      */
     ResultColumn(
-            String name,
+            String underlyingName,
             ValueNode expression,
             ContextManager cm) throws StandardException {
         super(cm);
         setTypeExpressionAndDefault(expression);
-        this.name = name;
-        this.exposedName = this.name;
+        _underlyingName = underlyingName;
+        _derivedColumnName = _underlyingName;
     }
 
     /**
@@ -153,8 +153,8 @@ class ResultColumn extends ValueNode
             ContextManager cm) throws StandardException {
         super(cm);
         setTypeExpressionAndDefault(expression);
-        this.name = cr.getColumnName();
-        this.exposedName = cr.getColumnName();
+        _underlyingName = cr.getColumnName();
+        _derivedColumnName = cr.getColumnName();
 
         // When we bind, we'll want to make sure the reference has the right
         // table name.
@@ -173,10 +173,10 @@ class ResultColumn extends ValueNode
             ContextManager cm) throws StandardException {
         super(cm);
         setTypeExpressionAndDefault(expression);
-        this.name = cd.getColumnName();
-        this.exposedName = name;
+        _underlyingName = cd.getColumnName();
+        _derivedColumnName = _underlyingName;
         setType(cd.getType());
-        this.columnDescriptor = cd;
+        _columnDescriptor = cd;
         this.autoincrement = cd.isAutoincrement();
     }
 
@@ -194,7 +194,7 @@ class ResultColumn extends ValueNode
         setTypeExpressionAndDefault(expression);
         setType(dtd);
 
-        if (expression instanceof ColumnReference) {
+        if (_expression instanceof ColumnReference) {
             reference = (ColumnReference)expression;
         }
     }
@@ -309,7 +309,7 @@ class ResultColumn extends ValueNode
 	 *
 	 * This function is used by ORDER BY column resolution. For the
 	 * ORDER BY clause, Derby will prefer to match on the column's
-	 * alias (exposedName), but will also successfully match on the
+	 * alias (_derivedColumnName), but will also successfully match on the
 	 * underlying column name. Thus the following statements are
 	 * treated equally:
 	 *  select name from person order by name;
@@ -319,8 +319,8 @@ class ResultColumn extends ValueNode
 	 */
 	boolean columnNameMatches(String columnName)
 	{
-		return columnName.equals(exposedName) ||
-			columnName.equals(name) ||
+		return columnName.equals(_derivedColumnName) ||
+			columnName.equals( _underlyingName ) ||
 			columnName.equals(getSourceColumnName());
 	}
 	
@@ -346,11 +346,17 @@ class ResultColumn extends ValueNode
 	String getUnderlyingOrAliasName() 
 	{
 		if (getSourceColumnName() != null)
+        {
 			return getSourceColumnName();
-		else if (name != null)
-			return name;
+        }
+		else if ( _underlyingName != null )
+        {
+			return _underlyingName;
+        }
 		else
-			return exposedName;
+        {
+			return _derivedColumnName;
+        }
 	}
 	
 	/**
@@ -359,8 +365,8 @@ class ResultColumn extends ValueNode
 	 */
 	String getSourceColumnName()
 	{
-		if (expression instanceof ColumnReference)
-			return ((ColumnReference)expression).getColumnName();
+		if (_expression instanceof ColumnReference)
+			return ((ColumnReference)_expression).getColumnName();
 		return null;
 	}
 	/**
@@ -370,20 +376,20 @@ class ResultColumn extends ValueNode
 
 	public String getName()
 	{
-		return exposedName;
+		return _derivedColumnName;
 	}
 
     @Override
     String getSchemaName() throws StandardException
 	{
-		if ((columnDescriptor!=null) &&
-			(columnDescriptor.getTableDescriptor() != null))
-			return columnDescriptor.getTableDescriptor().getSchemaName();
+		if ((_columnDescriptor!=null) &&
+			(_columnDescriptor.getTableDescriptor() != null))
+			return _columnDescriptor.getTableDescriptor().getSchemaName();
 		else
 		{
-			if (expression != null)
+			if (_expression != null)
 			// REMIND: could look in reference, if set.
-				return expression.getSchemaName();
+				return _expression.getSchemaName();
 			else
 				return null;
 		}
@@ -392,18 +398,18 @@ class ResultColumn extends ValueNode
     @Override
     String getTableName()
 	{
-		if (tableName != null)
+		if (_unqualifiedTableName != null)
 		{
-			return tableName;
+			return _unqualifiedTableName;
 		}
-		if ((columnDescriptor!=null) &&
-			(columnDescriptor.getTableDescriptor() != null))
+		if ((_columnDescriptor!=null) &&
+			(_columnDescriptor.getTableDescriptor() != null))
 		{
-			return columnDescriptor.getTableDescriptor().getName();
+			return _columnDescriptor.getTableDescriptor().getName();
 		}
 		else
 		{
-			return expression.getTableName();
+			return _expression.getTableName();
 		}
 	}
 
@@ -412,7 +418,7 @@ class ResultColumn extends ValueNode
 	 */
 	public String getSourceTableName()
 	{
-		return sourceTableName;
+		return _unqualifiedSourceTableName;
 	}
 
 	/**
@@ -420,7 +426,7 @@ class ResultColumn extends ValueNode
 	 */
 	public String getSourceSchemaName()
 	{
-		return sourceSchemaName;
+		return _sourceSchemaName;
 	}
 
 	/**
@@ -429,9 +435,9 @@ class ResultColumn extends ValueNode
 	 */
     void clearTableName()
 	{
-		if (expression instanceof ColumnReference)
+		if (_expression instanceof ColumnReference)
 		{
-			((ColumnReference) expression).setTableNameNode((TableName) null);
+			((ColumnReference) _expression).setQualifiedTableName( (TableName) null );
 		}
 	}
 
@@ -442,8 +448,8 @@ class ResultColumn extends ValueNode
 
 	public int getColumnPosition()
 	{
-		if (columnDescriptor!=null)
-			return columnDescriptor.getPosition();
+		if (_columnDescriptor!=null)
+			return _columnDescriptor.getPosition();
 		else
 			return virtualColumnId;
 
@@ -461,7 +467,7 @@ class ResultColumn extends ValueNode
 
     void setExpression(ValueNode expression)
 	{
-		this.expression = expression;
+		_expression = expression;
 	}
 
 	/**
@@ -472,7 +478,7 @@ class ResultColumn extends ValueNode
 
     ValueNode getExpression()
 	{
-		return expression;
+		return _expression;
 	}
 
 	/**
@@ -499,9 +505,9 @@ class ResultColumn extends ValueNode
 
     void setName(String name)
 	{
-		if (this.name == null)
+		if ( _underlyingName == null )
 		{
-			this.name = name;
+			_underlyingName = name;
 		}
 		else {
 			if (SanityManager.DEBUG)
@@ -510,7 +516,7 @@ class ResultColumn extends ValueNode
 				"don't change name from reference name");
 		}
 
-		this.exposedName = name;
+		_derivedColumnName = name;
 	}
 
 	/**
@@ -518,7 +524,7 @@ class ResultColumn extends ValueNode
 	 */
     boolean isNameGenerated()
 	{
-		return isNameGenerated;
+		return _isNameGenerated;
 	}
 
 	/**
@@ -526,7 +532,7 @@ class ResultColumn extends ValueNode
 	 */
     void setNameGenerated(boolean value)
 	{
-		isNameGenerated = value;
+		_isNameGenerated = value;
 	}
 
 	/**
@@ -600,7 +606,7 @@ class ResultColumn extends ValueNode
 	 */
     void collapseVirtualColumnIdGap(int removedColumnId)
 	{
-		if (columnDescriptor == null && virtualColumnId > removedColumnId)
+		if (_columnDescriptor == null && virtualColumnId > removedColumnId)
 			virtualColumnId--;
 	}
 
@@ -612,11 +618,11 @@ class ResultColumn extends ValueNode
 	 */
     void guaranteeColumnName() throws StandardException
 	{
-		if (exposedName == null)
+		if (_derivedColumnName == null)
 		{
 			/* Unions may also need generated names, if both sides name don't match */
-			exposedName ="SQLCol" + getCompilerContext().getNextColumnNumber();
-			isNameGenerated = true;
+			_derivedColumnName ="SQLCol" + getCompilerContext().getNextColumnNumber();
+			_isNameGenerated = true;
 		}
 	}
 
@@ -631,20 +637,20 @@ class ResultColumn extends ValueNode
 	{
 		if (SanityManager.DEBUG)
 		{
-			return "exposedName: " + exposedName + "\n" +
-				"name: " + name + "\n" +
-				"tableName: " + tableName + "\n" +
+			return "derivedColumnName: " + _derivedColumnName + "\n" +
+				"underlyingName: " + _underlyingName + "\n" +
+				"tableName: " + _unqualifiedTableName + "\n" +
 				"isDefaultColumn: " + defaultColumn + "\n" +
 				"wasDefaultColumn: " + wasDefault + "\n" +
-				"isNameGenerated: " + isNameGenerated + "\n" +
-				"sourceTableName: " + sourceTableName + "\n" +
+				"isNameGenerated: " + _isNameGenerated + "\n" +
+				"sourceTableName: " + _unqualifiedSourceTableName + "\n" +
 				"type: " + getTypeServices() + "\n" +
-				"columnDescriptor: " + columnDescriptor + "\n" +
-				"isGenerated: " + isGenerated + "\n" +
-				"isGeneratedForUnmatchedColumnInInsert: " + isGeneratedForUnmatchedColumnInInsert + "\n" +
-				"isGroupingColumn: " + isGroupingColumn + "\n" +
-				"isReferenced: " + isReferenced + "\n" +
-				"isRedundant: " + isRedundant + "\n" +
+				"columnDescriptor: " + _columnDescriptor + "\n" +
+				"isGenerated: " + _isGenerated + "\n" +
+				"isGeneratedForUnmatchedColumnInInsert: " + _isGeneratedForUnmatchedColumnInInsert + "\n" +
+				"isGroupingColumn: " + _isGroupingColumn + "\n" +
+				"isReferenced: " + _isReferenced + "\n" +
+				"isRedundant: " + _isRedundant + "\n" +
 				"rightOuterJoinUsingClause: " + rightOuterJoinUsingClause + "\n" +
 				"joinResultSet: " + joinResultSet + "\n" +
 				"virtualColumnId: " + virtualColumnId + "\n" +
@@ -669,10 +675,10 @@ class ResultColumn extends ValueNode
 		if (SanityManager.DEBUG)
 		{
 			super.printSubNodes(depth);
-			if (expression != null)
+			if (_expression != null)
 			{
 				printLabel(depth, "expression: ");
-				expression.treePrint(depth + 1);
+				_expression.treePrint(depth + 1);
 			}
 			if (reference != null)
 			{
@@ -709,11 +715,11 @@ class ResultColumn extends ValueNode
 		** Don't do it if this result column doesn't have a type yet.
 		** This can happen if the parameter is part of a table constructor.
 		*/
-		if (expression.requiresTypeFromContext())
+		if (_expression.requiresTypeFromContext())
 		{
 			if (getTypeServices() != null)
 			{
-				expression.setType(getTypeServices());
+				_expression.setType(getTypeServices());
 			}
 		}
 
@@ -727,16 +733,16 @@ class ResultColumn extends ValueNode
 		// JoinResultSet with it. eg
 		//      select c from t1 right join t2 using (c)
 		// Here, we are talking about column c as in "select c"
-		if (expression.getTableName() == null) {
+		if (_expression.getTableName() == null) {
 			fromList.isJoinColumnForRightOuterJoin(this);
 		}
 
-		setExpression( expression.bindExpression(fromList, subqueryList,
+		setExpression( _expression.bindExpression(fromList, subqueryList,
                                                  aggregates) );
 
-		if (expression instanceof ColumnReference)
+		if (_expression instanceof ColumnReference)
 		{
-			autoincrement = ((ColumnReference)expression).getSource().isAutoincrement();
+			autoincrement = ((ColumnReference)_expression).getSource().isAutoincrement();
 		}
 			
 
@@ -815,7 +821,7 @@ class ResultColumn extends ValueNode
 	{
         ColumnDescriptor    colDesc;
 
-        colDesc = tableDescriptor.getColumnDescriptor(exposedName);
+        colDesc = tableDescriptor.getColumnDescriptor(_derivedColumnName);
 
         if (colDesc == null)
 		{
@@ -828,7 +834,7 @@ class ResultColumn extends ValueNode
 				errorString += schemaName + ".";
 			errorString += tableDescriptor.getName();
 
-			throw StandardException.newException(SQLState.LANG_COLUMN_NOT_FOUND_IN_TABLE, exposedName, errorString);
+			throw StandardException.newException(SQLState.LANG_COLUMN_NOT_FOUND_IN_TABLE, _derivedColumnName, errorString);
 		}
 
         setColumnDescriptor(tableDescriptor, colDesc);
@@ -854,17 +860,17 @@ class ResultColumn extends ValueNode
 			throw StandardException.newException(SQLState.LANG_NULL_IN_VALUES_CLAUSE);
 		}
 
-        if( expression instanceof UntypedNullConstantNode)
+        if( _expression instanceof UntypedNullConstantNode)
         	//since we don't know the type of such a constant node, we just
         	//use the default values for collation type and derivation.
         	//eg insert into table1 values(1,null)
         	//When this method is executed for the sql above, we don't know
         	//the type of the null at this point.
             setExpression( getNullNode(bindingRC.getTypeServices()) );
-        else if( ( expression instanceof ColumnReference) && expression.getTypeServices() == null)
+        else if( ( _expression instanceof ColumnReference) && _expression.getTypeServices() == null)
         {
             // The expression must be a reference to a null column in a values table.
-            expression.setType( bindingRC.getType());
+            _expression.setType( bindingRC.getType());
         }
 	}
 
@@ -887,13 +893,8 @@ class ResultColumn extends ValueNode
 	void setColumnDescriptor(TableDescriptor tableDescriptor,
 				ColumnDescriptor columnDescriptor) throws StandardException
 	{
-		/* Callers are responsible for verifying that the column exists */
-		if (SanityManager.DEBUG)
-	    SanityManager.ASSERT(columnDescriptor != null,
-					"Caller is responsible for verifying that column exists");
-
-		setType(columnDescriptor.getType());
-		this.columnDescriptor = columnDescriptor;
+		if ( columnDescriptor != null ) { setType(columnDescriptor.getType()); }
+		_columnDescriptor = columnDescriptor;
 
 		/*
 			If the node was created using a reference, the table name
@@ -901,13 +902,13 @@ class ResultColumn extends ValueNode
 		 */
 		if (reference != null && reference.getTableName() != null) 
 		{
-			if (! tableDescriptor.getName().equals(
+			if ( (tableDescriptor != null) && ! tableDescriptor.getName().equals(
 					reference.getTableName()) ) 
 			{
 				/* REMIND: need to have schema name comparison someday as well...
 				** left out for now, lots of null checking needed...
 				** || ! tableDescriptor.getSchemaName().equals(
-				**	reference.getTableNameNode().getSchemaName())) {
+				**	reference.getQualifiedTableName().getSchemaName())) {
 				*/
 				String realName = tableDescriptor.getName();
 				String refName = reference.getTableName();
@@ -934,14 +935,14 @@ class ResultColumn extends ValueNode
 		** is used in the expression.  It is probably not
 		** necessary to clone the object here.
 		*/
-		setType(expression.getTypeServices());
+		setType(_expression.getTypeServices());
 
-		if (expression instanceof ColumnReference)
+		if (_expression instanceof ColumnReference)
 		{
-			ColumnReference cr = (ColumnReference) expression;
-			tableName = cr.getTableName();
-			sourceTableName = cr.getSourceTableName();
-			sourceSchemaName = cr.getSourceSchemaName();
+			ColumnReference cr = (ColumnReference) _expression;
+			_unqualifiedTableName = cr.getTableName();
+			_unqualifiedSourceTableName = cr.getSourceTableName();
+			_sourceSchemaName = cr.getSourceSchemaName();
 		}
 	}
 
@@ -951,7 +952,7 @@ class ResultColumn extends ValueNode
 	 * @param t The source table name
 	 */
     void setSourceTableName(String t) {
-		sourceTableName = t;
+		_unqualifiedSourceTableName = t;
 	}
 
 	/**
@@ -959,7 +960,7 @@ class ResultColumn extends ValueNode
 	 * @param s The source schema name
 	 */
     void setSourceSchemaName(String s) {
-		sourceSchemaName = s;
+		_sourceSchemaName = s;
 	}
 
 	/**
@@ -984,9 +985,9 @@ class ResultColumn extends ValueNode
 								PredicateList outerPredicateList) 
 					throws StandardException
 	{
-		if (expression == null)
+		if (_expression == null)
 			return this;
-		setExpression( expression.preprocess(numTables, outerFromList,
+		setExpression( _expression.preprocess(numTables, outerFromList,
 										   outerSubqueryList,
                                            outerPredicateList) );
 		return this;
@@ -1053,7 +1054,7 @@ class ResultColumn extends ValueNode
     void generateExpression(ExpressionClassBuilder ecb, MethodBuilder mb)
 									throws StandardException
 	{
-        expression.generateExpression(ecb, mb);
+        _expression.generateExpression(ecb, mb);
 	}
 
 	/**
@@ -1162,7 +1163,7 @@ class ResultColumn extends ValueNode
 		** case.
 		*/
 		if ((otherExpression != null) && (otherExpression.requiresTypeFromContext()) ||
-			(expression.requiresTypeFromContext()))
+			(_expression.requiresTypeFromContext()))
 		{
 			return false;
 		}
@@ -1285,7 +1286,7 @@ class ResultColumn extends ValueNode
 	 */
     boolean isGenerated()
 	{
-		return (isGenerated == true);
+		return (_isGenerated == true);
 	}
 
 	/**
@@ -1295,7 +1296,7 @@ class ResultColumn extends ValueNode
 	 */
     boolean isGeneratedForUnmatchedColumnInInsert()
 	{
-		return (isGeneratedForUnmatchedColumnInInsert == true);
+		return (_isGeneratedForUnmatchedColumnInInsert == true);
 	}
 
 	/**
@@ -1303,9 +1304,9 @@ class ResultColumn extends ValueNode
 	 */
     void markGenerated()
 	{
-		isGenerated = true;
+		_isGenerated = true;
 		/* A generated column is a referenced column */
-		isReferenced = true;
+		_isReferenced = true;
 	}
 
 	/**
@@ -1313,9 +1314,9 @@ class ResultColumn extends ValueNode
 	 */
     void markGeneratedForUnmatchedColumnInInsert()
 	{
-		isGeneratedForUnmatchedColumnInInsert = true;
+		_isGeneratedForUnmatchedColumnInInsert = true;
 		/* A generated column is a referenced column */
-		isReferenced = true;
+		_isReferenced = true;
 	}
 
 	/**
@@ -1325,7 +1326,7 @@ class ResultColumn extends ValueNode
 	 */
     boolean isReferenced()
 	{
-		return isReferenced;
+		return _isReferenced;
 	}
 
 	/**
@@ -1333,7 +1334,7 @@ class ResultColumn extends ValueNode
 	 */
     void setReferenced()
 	{
-		isReferenced = true;
+		_isReferenced = true;
 	}
 
     /**
@@ -1345,7 +1346,7 @@ class ResultColumn extends ValueNode
         if( isReferenced())
             return;
         
-        for( ValueNode expr = expression; expr != null && (expr instanceof VirtualColumnNode);)
+        for( ValueNode expr = _expression; expr != null && (expr instanceof VirtualColumnNode);)
         {
             VirtualColumnNode vcn = (VirtualColumnNode) expr;
             ResultColumn src = vcn.getSourceColumn();
@@ -1363,7 +1364,7 @@ class ResultColumn extends ValueNode
 	 */
     void setUnreferenced()
 	{
-		isReferenced = false;
+		_isReferenced = false;
 	}
 
 	/**
@@ -1374,7 +1375,7 @@ class ResultColumn extends ValueNode
 	{
 		setReferenced();
 
-		ValueNode vn = expression;
+		ValueNode vn = _expression;
 
 		while (vn instanceof VirtualColumnNode)
 		{
@@ -1392,7 +1393,7 @@ class ResultColumn extends ValueNode
 	 */
     boolean isRedundant()
 	{
-		return isRedundant;
+		return _isRedundant;
 	}
 
 	/**
@@ -1400,7 +1401,7 @@ class ResultColumn extends ValueNode
 	 */
     void setRedundant()
 	{
-		isRedundant = true;
+		_isRedundant = true;
 	}
 
 	/**
@@ -1408,7 +1409,7 @@ class ResultColumn extends ValueNode
 	 */
     void markAsGroupingColumn()
 	{
-		isGroupingColumn = true;
+		_isGroupingColumn = true;
 	}
 
 	/**
@@ -1421,7 +1422,7 @@ class ResultColumn extends ValueNode
 
 	void rejectParameter() throws StandardException
 	{
-		if ((expression != null) && (expression.isParameterNode()))
+		if ((_expression != null) && (_expression.isParameterNode()))
 			throw StandardException.newException(SQLState.LANG_PARAM_IN_SELECT_LIST);
 	}
 
@@ -1440,7 +1441,7 @@ class ResultColumn extends ValueNode
 	 */
 	void markUpdated()
 	{
-		updated = true;
+		_updated = true;
 	}
 
 	/**
@@ -1449,7 +1450,7 @@ class ResultColumn extends ValueNode
 	 */
 	void markUpdatableByCursor()
 	{
-		updatableByCursor = true;
+		_updatableByCursor = true;
 	}
 
 	/**
@@ -1459,7 +1460,7 @@ class ResultColumn extends ValueNode
 	 */
 	boolean updated()
 	{
-		return updated;
+		return _updated;
 	}
 
 	/**
@@ -1470,7 +1471,7 @@ class ResultColumn extends ValueNode
     @Override
 	public boolean updatableByCursor()
 	{
-		return updatableByCursor;
+		return _updatableByCursor;
 	}
 
 	/**
@@ -1492,20 +1493,20 @@ class ResultColumn extends ValueNode
 		 * The SELECT generated for the HAVING needs its own copy
 		 * of the ColumnReferences.
 		 */
-		if (expression instanceof ColumnReference)
+		if (_expression instanceof ColumnReference)
 		{
-			cloneExpr = ((ColumnReference) expression).getClone();
+			cloneExpr = ((ColumnReference) _expression).getClone();
 		}
 		else
 		{
-			cloneExpr = expression;
+			cloneExpr = _expression;
 		}
 
 		/* If a columnDescriptor exists, then we must propagate it */
-		if (columnDescriptor != null)
+		if (_columnDescriptor != null)
 		{
             newResultColumn = new ResultColumn(
-                    columnDescriptor, expression, getContextManager());
+                    _columnDescriptor, _expression, getContextManager());
 			newResultColumn.setExpression(cloneExpr);
 		}
 		else
@@ -1620,8 +1621,8 @@ class ResultColumn extends ValueNode
         int expType;
         if (isAutoincrementGenerated()) {
             expType = Qualifier.VARIANT;
-        } else if (expression != null) {
-            expType = expression.getOrderableVariantType();
+        } else if (_expression != null) {
+            expType = _expression.getOrderableVariantType();
         } else {
             expType = Qualifier.CONSTANT;
         }
@@ -1653,9 +1654,9 @@ class ResultColumn extends ValueNode
 	{
 		super.acceptChildren(v);
 	
-		if (expression != null)
+		if (_expression != null)
 		{
-			setExpression( (ValueNode)expression.accept(v) );
+			setExpression( (ValueNode)_expression.accept(v) );
 		}
 	}
 
@@ -1685,7 +1686,7 @@ class ResultColumn extends ValueNode
 	  get the column descriptor for the column in the table.
 	  Otherwise return null.
 	  */
-	ColumnDescriptor getTableColumnDescriptor() {return columnDescriptor;}
+	ColumnDescriptor getTableColumnDescriptor() {return _columnDescriptor;}
 
 	/**
 	 * Returns true if this result column is a placeholder for a generated
@@ -1716,10 +1717,10 @@ class ResultColumn extends ValueNode
   		autoincrement = true;
   	}
         
-        public boolean isGroupingColumn()
-        {
-        	return isGroupingColumn;
-        }
+    public boolean isGroupingColumn()
+    {
+        return _isGroupingColumn;
+    }
         
 	/**
 	 * @exception StandardException		Thrown on error
@@ -1787,6 +1788,9 @@ class ResultColumn extends ValueNode
 
 	/* Get the wrapped reference if any */
 	public	ColumnReference	getReference() { return reference; }
+
+    /** Get the column descriptor */
+    ColumnDescriptor    getColumnDescriptor() { return _columnDescriptor; }
 	
 	/**
 	 * Get the source BaseColumnNode for this result column. The
@@ -1797,10 +1801,10 @@ class ResultColumn extends ValueNode
 	 *   or null if a BaseColumnNode cannot be found
 	 */
     BaseColumnNode getBaseColumnNode() {
-		ValueNode vn = expression;
+		ValueNode vn = _expression;
 		while (true) {
 			if (vn instanceof ResultColumn) {
-				vn = ((ResultColumn) vn).expression;
+				vn = ((ResultColumn) vn)._expression;
 			} else if (vn instanceof ColumnReference) {
 				vn = ((ColumnReference) vn).getSource();
 			} else if (vn instanceof VirtualColumnNode) {
@@ -1834,11 +1838,11 @@ class ResultColumn extends ValueNode
     int getTableNumber()
 		throws StandardException
 	{
-		if (expression instanceof ColumnReference)
-			return ((ColumnReference)expression).getTableNumber();
-		else if (expression instanceof VirtualColumnNode)
+		if (_expression instanceof ColumnReference)
+			return ((ColumnReference)_expression).getTableNumber();
+		else if (_expression instanceof VirtualColumnNode)
 		{
-			VirtualColumnNode vcn = (VirtualColumnNode)expression;
+			VirtualColumnNode vcn = (VirtualColumnNode)_expression;
 
 			// If the VCN points to a FromBaseTable, just get that
 			// table's number.
@@ -1862,8 +1866,8 @@ class ResultColumn extends ValueNode
 	{
         if (isSameNodeKind(o)) {
         	ResultColumn other = (ResultColumn)o;
-        	if (expression != null) {
-        		return expression.isEquivalent(other.expression);
+        	if (_expression != null) {
+        		return _expression.isEquivalent(other._expression);
         	}
         }
 
@@ -1876,7 +1880,7 @@ class ResultColumn extends ValueNode
 	 */
 	public boolean hasGenerationClause()
 	{
-        if ( (columnDescriptor != null) && columnDescriptor.hasGenerationClause() ) { return true; }
+        if ( (_columnDescriptor != null) && _columnDescriptor.hasGenerationClause() ) { return true; }
         else { return false; }
 	}
     

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=1563368&r1=1563367&r2=1563368&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 Sat Feb  1 03:08:48 2014
@@ -589,14 +589,18 @@ class ResultColumnList extends QueryTree
 						continue;
 
                 ColumnReference cr = (ColumnReference) rcExpr;
-                if( (! tableName.equals( cr.getTableNameNode())) && tableNumber != cr.getTableNumber())
+                if( (! tableName.equals( cr.getQualifiedTableName())) && tableNumber != cr.getTableNumber())
+                {
                     continue;
+                }
 				columnNameMatches =
 					columnName.equals( resultColumn.getSourceColumnName() );
 			}
 			else
+            {
 				columnNameMatches =
 					resultColumn.columnNameMatches(columnName);
+            }
 
 
 			/* We finally got past the qualifiers, now see if the column
@@ -715,8 +719,10 @@ class ResultColumnList extends QueryTree
                     continue;
                 }
 				ColumnReference cr = (ColumnReference) rcExpr;
-                if( ! tableName.equals( cr.getTableNameNode()))
+                if( ! tableName.equals( cr.getQualifiedTableName()))
+                {
                     continue;
+                }
 				columnNameMatches =
 					columnName.equals( resultColumn.getSourceColumnName() );
 			}
@@ -1984,11 +1990,16 @@ class ResultColumnList extends QueryTree
             ResultColumn resultColumn = elementAt(index);
 
 			/* Vectors are 0-based, VirtualColumnIds are 1-based */
-            resultColumn.expression = new VirtualColumnNode(
-                    sourceResultSet,
-                    sourceResultColumnList.elementAt(index),
-                    index + 1,
-                    getContextManager());
+            resultColumn.setExpression
+                (
+                 new VirtualColumnNode
+                 (
+                  sourceResultSet,
+                  sourceResultColumnList.elementAt(index),
+                  index + 1,
+                  getContextManager()
+                  )
+                 );
 
 			/* Mark the ResultColumn as being referenced */
 			if (markReferenced)

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SelectNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SelectNode.java?rev=1563368&r1=1563367&r2=1563368&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SelectNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SelectNode.java Sat Feb  1 03:08:48 2014
@@ -394,7 +394,7 @@ class SelectNode extends ResultSetNode
 
 			ColumnReference crNode = (ColumnReference) rc.getExpression();
 
-			if (crNode.columnName.equals(colName))
+			if (crNode.getColumnName().equals(colName))
 				return (ColumnReference) crNode.getClone();
 		}
 

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=1563368&r1=1563367&r2=1563368&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 Sat Feb  1 03:08:48 2014
@@ -1477,7 +1477,7 @@ public final class UpdateNode extends DM
 
 			if ( (reference != null) && correlationName.equals( reference.getTableName() ) )
 			{
-				reference.setTableNameNode( tableNameNode );
+				reference.setQualifiedTableName( tableNameNode );
 			}
 		}
 		

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=1563368&r1=1563367&r2=1563368&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 Sat Feb  1 03:08:48 2014
@@ -5334,7 +5334,7 @@ derivedColumn(ResultColumnList resultCol
 		*/
 		if ((columnName == null) && (columnExpression instanceof ColumnReference))
 		{
-			columnName = ((ColumnReference) columnExpression).columnName;
+			columnName = ((ColumnReference) columnExpression).getColumnName();
 		}
 
        return new ResultColumn(
@@ -12115,7 +12115,7 @@ renameColumnStatement() throws StandardE
 	<COLUMN> oldColumnReference = columnReference()
 		<TO> newColumnName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true)
 	{
-        if (oldColumnReference.getTableNameNode() == null) {
+        if (oldColumnReference.getQualifiedTableName() == null) {
 			throw StandardException.newException(
 				SQLState.LANG_OBJECT_DOES_NOT_EXIST,
 				"RENAME COLUMN",
@@ -12123,7 +12123,7 @@ renameColumnStatement() throws StandardE
         }
 
         return new RenameNode(
-			oldColumnReference.getTableNameNode(),
+			oldColumnReference.getQualifiedTableName(),
 			oldColumnReference.getColumnName(),
 			newColumnName,
             false,



Mime
View raw message