You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by dj...@apache.org on 2007/03/09 05:01:41 UTC

svn commit: r516285 - in /db/derby/code/trunk/java/engine/org/apache/derby: iapi/sql/PreparedStatement.java impl/sql/GenericPreparedStatement.java impl/sql/compile/CurrentOfNode.java impl/sql/execute/CurrentOfResultSet.java

Author: djd
Date: Thu Mar  8 20:01:40 2007
New Revision: 516285

URL: http://svn.apache.org/viewvc?view=rev&rev=516285
Log:
DERBY-2380 (partial) Change language PreparedStatement to not implement the Provider
interface from the DependencyManager. This is a step to cleaning up the life-cycle
of a PreparedStatement so that it will act like a Java object, if one has a reference
to it then it can be used. Remove the single use of any object being dependent
on a PreparedStatement which was a PreparedStatement for a positioned delete/update
being dependent on the current statement the cursor maps to. This is already handled
in a more general case since the positioned statement must cope with the statement
for the cursor changing completely without any invalidation. Also the positioned
statement has its own dependency on the table being modified so will be recompiled
through that mechanism if the table changes in any way.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/PreparedStatement.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericPreparedStatement.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/execute/CurrentOfResultSet.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/PreparedStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/PreparedStatement.java?view=diff&rev=516285&r1=516284&r2=516285
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/PreparedStatement.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/PreparedStatement.java Thu Mar  8 20:01:40 2007
@@ -38,7 +38,7 @@
  *
  */
 public interface PreparedStatement
-	extends Dependent, Provider
+	extends Dependent
 {
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericPreparedStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericPreparedStatement.java?view=diff&rev=516285&r1=516284&r2=516285
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericPreparedStatement.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericPreparedStatement.java Thu Mar  8 20:01:40 2007
@@ -720,11 +720,6 @@
 
 			DependencyManager dm = lcc.getDataDictionary().getDependencyManager();
 
-			if (!alreadyInvalid)
-			{
-				dm.invalidateFor(this, action, lcc);
-			}
-
 			/* Clear out the old dependencies on this statement as we
 			 * will build the new set during the reprepare in makeValid().
 			 */

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?view=diff&rev=516285&r1=516284&r2=516285
==============================================================================
--- 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 Thu Mar  8 20:01:40 2007
@@ -165,18 +165,15 @@
 		throws StandardException {
 
 		// verify that the cursor exists
-		// and create a dependency on it
 
 		preStmt = getCursorStatement();
-		if (preStmt!=null) {
-			preStmt.rePrepare(getLanguageConnectionContext());
-		}
 
 		if (preStmt == null) {
 			throw StandardException.newException(SQLState.LANG_CURSOR_NOT_FOUND, 
 						cursorName);
 		}
 		
+        preStmt.rePrepare(getLanguageConnectionContext());
 
 		// verify that the cursor is updatable (UPDATE is responsible
 		// for checking that the right columns are updatable)
@@ -185,8 +182,6 @@
 			String printableString = (cursorName == null) ? "" : cursorName;
 			throw StandardException.newException(SQLState.LANG_CURSOR_NOT_UPDATABLE, printableString);
 		}
-
-		getCompilerContext().createDependency(preStmt);
 
 		ExecCursorTableReference refTab = preStmt.getTargetTable();
 		String schemaName = refTab.getSchemaName();

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CurrentOfResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CurrentOfResultSet.java?view=diff&rev=516285&r1=516284&r2=516285
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CurrentOfResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CurrentOfResultSet.java Thu Mar  8 20:01:40 2007
@@ -323,7 +323,7 @@
 		}
 
 		if (cursor == null || cursor.isClosed()) {
-			throw StandardException.newException(SQLState.LANG_CURSOR_CLOSED, cursorName);	
+			throw StandardException.newException(SQLState.LANG_CURSOR_NOT_FOUND, cursorName);	
 		}
 	}