db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r477420 - in /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile: CallStatementNode.java CursorNode.java DMLModStatementNode.java DMLStatementNode.java DeleteNode.java StatementNode.java
Date Tue, 21 Nov 2006 00:03:12 GMT
Author: djd
Date: Mon Nov 20 16:03:11 2006
New Revision: 477420

URL: http://svn.apache.org/viewvc?view=rev&rev=477420
Log:
DERBY-2096 (partial) Rename the optimize() method for StatementNode to optimizeStatement()
as a step
in switching the return type of a parse statement to StatementNode. Make optimizeStatement()
void
as no implementation ever switches the type and several implementations did not handle the
type switching anyway.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CallStatementNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CursorNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DMLModStatementNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DMLStatementNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/StatementNode.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CallStatementNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CallStatementNode.java?view=diff&rev=477420&r1=477419&r2=477420
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CallStatementNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CallStatementNode.java
Mon Nov 20 16:03:11 2006
@@ -189,12 +189,11 @@
 	 * Throws an exception if the tree is not bound, or if the binding
 	 * is out of date.
 	 *
-	 * @return	An optimized QueryTree
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
 
-	public QueryTreeNode optimize() throws StandardException
+	public void optimizeStatement() throws StandardException
 	{
 		DataDictionary dd = getDataDictionary();
 
@@ -211,7 +210,6 @@
 								(SubqueryList) null,
 								(PredicateList) null);
 
-		return this;
 	}
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CursorNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CursorNode.java?view=diff&rev=477420&r1=477419&r2=477420
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CursorNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CursorNode.java Mon
Nov 20 16:03:11 2006
@@ -509,12 +509,11 @@
 	 * Throws an exception if the tree is not bound, or if the binding
 	 * is out of date.
 	 *
-	 * @return	An optimized QueryTree
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
 
-	public QueryTreeNode optimize() throws StandardException
+	public void optimizeStatement() throws StandardException
 	{
 		// Push the order by list down to the ResultSet
 		if (orderByList != null)
@@ -529,7 +528,7 @@
 			resultSet.pushOrderByList(orderByList);
 			orderByList = null;
 		}
-		return super.optimize();
+		super.optimizeStatement();
 	}
 
 	/**

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?view=diff&rev=477420&r1=477419&r2=477420
==============================================================================
--- 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
Mon Nov 20 16:03:11 2006
@@ -1343,16 +1343,13 @@
    * Throws an exception if the tree is not bound, or if the binding
    * is out of date.
    *
-   * @return      An optimized QueryTree
    *
    * @exception StandardException         Thrown on failure
    */
-	public QueryTreeNode optimize() throws StandardException
+	public void optimizeStatement() throws StandardException
 	{
-		ResultSetNode originalRSNode = getResultSetNode();
-
 		/* First optimize the query */
-		QueryTreeNode retval = super.optimize();
+		super.optimizeStatement();
 
 		/* In language we always set it to row lock, it's up to store to
 		 * upgrade it to table lock.  This makes sense for the default read
@@ -1360,8 +1357,6 @@
 		 * Beetle 4133.
 		 */
 		lockMode = TransactionController.MODE_RECORD;
-
-		return retval;
 	}
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DMLStatementNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DMLStatementNode.java?view=diff&rev=477420&r1=477419&r2=477420
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DMLStatementNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DMLStatementNode.java
Mon Nov 20 16:03:11 2006
@@ -316,12 +316,10 @@
 	 * Throws an exception if the tree is not bound, or if the binding
 	 * is out of date.
 	 *
-	 * @return	An optimized QueryTree
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-
-	public QueryTreeNode optimize() throws StandardException
+	public void optimizeStatement() throws StandardException
 	{
 		resultSet = resultSet.preprocess(getCompilerContext().getNumTables(),
 										 null,
@@ -367,8 +365,6 @@
 				resultSet.setReferencedTableMap((JBitSet) siChild.getReferencedTableMap().clone());
 			}
 		}
-
-		return this;
 	}
 
 	/**

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?view=diff&rev=477420&r1=477419&r2=477420
==============================================================================
--- 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 Mon
Nov 20 16:03:11 2006
@@ -890,7 +890,7 @@
 	}
 
 
-	public QueryTreeNode optimize() throws StandardException
+	public void optimizeStatement() throws StandardException
 	{
 		if(cascadeDelete)
 		{
@@ -900,7 +900,7 @@
 			}
 		}
 
-		return super.optimize();
+		super.optimizeStatement();
 	}
 
     /**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/StatementNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/StatementNode.java?view=diff&rev=477420&r1=477419&r2=477420
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/StatementNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/StatementNode.java Mon
Nov 20 16:03:11 2006
@@ -125,6 +125,32 @@
 		bindStatement();
 		return this;
 	}
+	
+	/**
+	 * Generates an optimized statement from a bound StatementNode.  Actually,
+	 * it annotates the tree in place rather than generating a new tree.
+	 *
+	 * For non-optimizable statements (for example, CREATE TABLE),
+	 * return the bound tree without doing anything.  For optimizable
+	 * statements, this method will be over-ridden in the statement's
+	 * root node (DMLStatementNode in all cases we know about so far).
+	 *
+	 * Throws an exception if the tree is not bound, or if the binding
+	 * is out of date.
+	 *
+	 *
+	 * @exception StandardException		Thrown on error
+	 */
+	public void  optimizeStatement() throws StandardException
+	{
+		
+	}
+	// TEMP -RE_WORK for switching to StatementNode.
+	public final QueryTreeNode optimize() throws StandardException
+	{
+		optimizeStatement();
+		return this;
+	}
 
 	/**
 	 * create the outer shell class builder for the class we will



Mime
View raw message