db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r719760 - in /db/derby/code/trunk/java: engine/org/apache/derby/iapi/sql/dictionary/ engine/org/apache/derby/iapi/util/ engine/org/apache/derby/impl/sql/compile/ engine/org/apache/derby/impl/sql/execute/ testing/org/apache/derbyTesting/func...
Date Sat, 22 Nov 2008 00:21:24 GMT
Author: rhillegas
Date: Fri Nov 21 16:21:23 2008
New Revision: 719760

URL: http://svn.apache.org/viewvc?rev=719760&view=rev
Log:
DERBY-481: Cleanup based on comments from Dag and Knut.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/util/StringUtil.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DDLStatementNode.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/GenerationClauseNode.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/TableElementList.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/execute/NoRowsResultSetImpl.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsHelper.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java?rev=719760&r1=719759&r2=719760&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java
Fri Nov 21 16:21:23 2008
@@ -413,6 +413,8 @@
 	/**
 	 * Given a list of columns in the table, construct a bit  map of those
 	 * columns' ids.
+     *
+     * @param cdl list of columns whose positions we want to record in the bit map
 	 */
 	public FormatableBitSet makeColumnMap( ColumnDescriptorList cdl )
 	{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/util/StringUtil.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/util/StringUtil.java?rev=719760&r1=719759&r2=719760&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/util/StringUtil.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/util/StringUtil.java Fri Nov 21
16:21:23 2008
@@ -496,7 +496,8 @@
     }
 
     /**
-     * Turn an array of ints into a printable string.
+     * Turn an array of ints into a printable string. Returns what's returned
+     * in Java 5 by java.util.Arrays.toString(int[]).
      */
     public  static  String  stringify( int[] raw )
     {

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DDLStatementNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DDLStatementNode.java?rev=719760&r1=719759&r2=719760&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DDLStatementNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DDLStatementNode.java
Fri Nov 21 16:21:23 2008
@@ -434,6 +434,8 @@
 	  *	Make a from list for binding query fragments in a CREATE/ALTER TABLE
       *     statement.
       *
+      * @param dd  Metadata.
+      * @param tableElementList the parenthesized list of columns and constraints in a CREATE/ALTER
TABLE statement
       * @param creatingTable true if this is for CREATE TABLE. false if this is for ALTER
TABLE
       */
 	FromList	makeFromList( DataDictionary dd, TableElementList tableElementList, boolean creatingTable
)

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=719760&r1=719759&r2=719760&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
Fri Nov 21 16:21:23 2008
@@ -415,6 +415,10 @@
      * phase. For an update, addedGeneratedColumns will be non-null and we will
      * use this list to pass through the generated columns which have already
      * been added to the update list.
+     *
+     * @param targetRCL  the row in the table being INSERTed or UPDATEd
+     * @param forUpdate  true if this is an UPDATE. false otherwise.
+     * @param addedGeneratedColumns generated columns which the compiler added earlier on
      */
     void forbidGenerationOverrides( ResultColumnList targetRCL, boolean forUpdate, ColumnDescriptorList
addedGeneratedColumns )
         throws StandardException
@@ -485,6 +489,13 @@
     
     /**
      * Parse and bind the generating expressions of computed columns.
+     *
+     * @param dataDictionary    metadata
+     * @param targetTableDescriptor metadata for the table that has the generated columns
+     * @param sourceRCL  the tuple stream which drives the INSERT or UPDATE
+     * @param targetRCL  the row in the table that's being INSERTed or UPDATEd
+     * @param forUpdate true if this is an UPDATE. false otherwise.
+     * @param updateResultSet more information on the tuple stream driving the UPDATE
      */
 	void parseAndBindGenerationClauses
 	(
@@ -1569,6 +1580,11 @@
 	  *	are generation clauses, this routine builds an Activation method which
 	  *	evaluates the generation clauses and fills in the computed columns.
       *
+      * @param rcl  describes the row of expressions to be put into the bas table
+      * @param resultSetNumber  index of base table into array of ResultSets
+      * @param ecb code generation state variable
+      * @param mb the method being generated
+      *
 	  * @exception StandardException		Thrown on error
 	  */
 	public	void	generateGenerationClauses
@@ -1586,9 +1602,6 @@
 
 		for (int index = 0; index < size; index++)
 		{
-		    // generate statements of the form
-			// fieldX.setColumn(columnNumber, (DataValueDescriptor) columnExpr);
-			// and add them to exprFun.
 			rc = (ResultColumn) rcl.elementAt(index);
 
             //
@@ -1599,7 +1612,7 @@
 			if ( rc.hasGenerationClause() )
             {
                 hasGenerationClauses = true;
-                continue;
+                break;
             }
         }
 
@@ -1635,8 +1648,13 @@
 
 	/**
 	  *	Generate a method to compute all of the generation clauses in a row.
+      *
+      * @param rcl  describes the row of expressions to be put into the bas table
+      * @param rsNumber  index of base table into array of ResultSets
+      * @param ecb code generation state variable
+      *
 	  */
-	public	MethodBuilder	generateGenerationClauses
+	private	MethodBuilder	generateGenerationClauses
 	(
         ResultColumnList            rcl,
         int                                 rsNumber,

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GenerationClauseNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GenerationClauseNode.java?rev=719760&r1=719759&r2=719760&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GenerationClauseNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/GenerationClauseNode.java
Fri Nov 21 16:21:23 2008
@@ -149,7 +149,7 @@
 	 */
 	public String toString()
     {
-        return "GENERATED ALWAYS( " + _expressionText + " )";
+        return "GENERATED ALWAYS AS ( " + _expressionText + " )";
 	}
         
     ///////////////////////////////////////////////////////////////////////////////////

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=719760&r1=719759&r2=719760&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 Fri
Nov 21 16:21:23 2008
@@ -1533,6 +1533,7 @@
      * Common code for the 2 checkReliability functions.  Always throws StandardException.
      *
      * @param fragmentType Type of fragment as a string, for inclusion in error messages.
+     * @param fragmentBitMask Describes the kinds of expressions we ar suspicious of
      * @exception StandardException        Throws an error, always.
      */
     private void throwReliabilityException( String fragmentType, int fragmentBitMask ) throws
StandardException

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=719760&r1=719759&r2=719760&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
Fri Nov 21 16:21:23 2008
@@ -751,9 +751,9 @@
 
             generationClauseNode = cdn.getGenerationClauseNode();
 
-			// bind the check condition
-			// verify that it evaluates to a boolean
+			// bind the generation clause
 			final int previousReliability = cc.getReliability();
+            ProviderList prevAPL = cc.getCurrentAuxiliaryProviderList();
 			try
 			{
 				/* Each generation clause can have its own set of dependencies.
@@ -766,7 +766,6 @@
 				 */
 				ProviderList apl = new ProviderList();
 
-				ProviderList prevAPL = cc.getCurrentAuxiliaryProviderList();
 				cc.setCurrentAuxiliaryProviderList(apl);
 
 				// Tell the compiler context to forbid subqueries and
@@ -820,11 +819,11 @@
 					generationClauseNode.setAuxiliaryProviderList(apl);
 				}
 
-				// Restore the previous AuxiliaryProviderList
-				cc.setCurrentAuxiliaryProviderList(prevAPL);
 			}
 			finally
 			{
+				// Restore previous compiler state
+				cc.setCurrentAuxiliaryProviderList(prevAPL);
 				cc.setReliability(previousReliability);
 			}
 

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=719760&r1=719759&r2=719760&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 Fri
Nov 21 16:21:23 2008
@@ -39,7 +39,6 @@
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.sql.compile.CompilerContext;
-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;
 
@@ -576,8 +575,9 @@
 								
  			if (hasCheckConstraints(dataDictionary, targetTableDescriptor) || hasGenerationClauses(
targetTableDescriptor ) )
  			{
- 				/* Get and bind all check constraints on the columns
-	 			 * being updated.  We want to bind the check constraints against
+ 				/* Get and bind all check constraints and generated columns on the columns
+	 			 * being updated.  We want to bind the check constraints and
+	 			 * generated columns against
 	 			 * the after columns.  We need to bind against the portion of the
 	 			 * resultColumns in the new NormalizeResultSet that point to 
 	 			 * afterColumns.  Create an RCL composed of just those RCs in

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NoRowsResultSetImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NoRowsResultSetImpl.java?rev=719760&r1=719759&r2=719760&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NoRowsResultSetImpl.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NoRowsResultSetImpl.java
Fri Nov 21 16:21:23 2008
@@ -589,7 +589,14 @@
 	}
 
 	/**
-	  * Compute the generation clauses on the current row in order to fill in computed columns.
+	  * Compute the generation clauses on the current row in order to fill in
+	  * computed columns.
+      *
+      * @param generationClauses    the generated method which evaluates generation clauses
+      * @param activation               the thread-specific instance of the generated class
+      * @param source                   the tuple stream driving this INSERT/UPDATE
+      * @param newRow                   the base row being stuffed
+      * @param isUpdate                 true if this is an UPDATE. false otherwise.
 	  */
 	public	void	evaluateGenerationClauses
 	(

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsHelper.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsHelper.java?rev=719760&r1=719759&r2=719760&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsHelper.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsHelper.java
Fri Nov 21 16:21:23 2008
@@ -165,6 +165,7 @@
         PreparedStatement   ps = chattyPrepare( conn, query );
 
         assertStatementError( sqlState, ps );
+        ps.close();
     }
 
     /**



Mime
View raw message