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 ba...@apache.org on 2005/07/14 23:50:53 UTC

svn commit: r219115 - /incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericPreparedStatement.java

Author: bandaram
Date: Thu Jul 14 14:50:51 2005
New Revision: 219115

URL: http://svn.apache.org/viewcvs?rev=219115&view=rev
Log:
Port fix for DERBY-388 into 10.1 branch. Address intermittent failures when executing trigger statements caused by references to internal SQL formats.

Fix originally submitted to 10.0 branch by Army Brown (qozinx@sbcglobal.net)

Modified:
    incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericPreparedStatement.java

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericPreparedStatement.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericPreparedStatement.java?rev=219115&r1=219114&r2=219115&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericPreparedStatement.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericPreparedStatement.java Thu Jul 14 14:50:51 2005
@@ -353,7 +353,20 @@
 
 			/* put it in try block to unlock the PS in any case
 			 */
-			rePrepare(lccToUse);
+			if (!spsAction) {
+			// only re-prepare if this isn't an SPS for a trigger-action;
+			// if it _is_ an SPS for a trigger action, then we can't just
+			// do a regular prepare because the statement might contain
+			// internal SQL that isn't allowed in other statements (such as a
+			// static method call to get the trigger context for retrieval
+			// of "new row" or "old row" values).  So in that case we
+			// skip the call to 'rePrepare' and if the statement is out
+			// of date, we'll get a NEEDS_COMPILE exception when we try
+			// to execute.  That exception will be caught by the executeSPS()
+			// method of the GenericTriggerExecutor class, and at that time
+			// the SPS action will be recompiled correctly.
+				rePrepare(lccToUse);
+			}
 
 			StatementContext statementContext = lccToUse.pushStatementContext(
 				isAtomic, getSource(), pvs, rollbackParentContext, timeoutMillis);