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/06/24 20:08:49 UTC

svn commit: r201659 - /incubator/derby/code/branches/10.0/java/engine/org/apache/derby/impl/sql/GenericPreparedStatement.java

Author: bandaram
Date: Fri Jun 24 11:08:47 2005
New Revision: 201659

URL: http://svn.apache.org/viewcvs?rev=201659&view=rev
Log:
DERBY-388: Address intermittent failures when executing trigger statements caused by references to internal SQL formats. (Generated because of expanding OLD and/or NEW transition variables)

Submitted by Army Brown (qozinx@sbcglobal.net)

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

Modified: incubator/derby/code/branches/10.0/java/engine/org/apache/derby/impl/sql/GenericPreparedStatement.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/branches/10.0/java/engine/org/apache/derby/impl/sql/GenericPreparedStatement.java?rev=201659&r1=201658&r2=201659&view=diff
==============================================================================
--- incubator/derby/code/branches/10.0/java/engine/org/apache/derby/impl/sql/GenericPreparedStatement.java (original)
+++ incubator/derby/code/branches/10.0/java/engine/org/apache/derby/impl/sql/GenericPreparedStatement.java Fri Jun 24 11:08:47 2005
@@ -339,7 +339,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);