db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1087189 - /db/derby/code/branches/10.7/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java
Date Thu, 31 Mar 2011 05:35:19 GMT
Author: mamta
Date: Thu Mar 31 05:35:18 2011
New Revision: 1087189

URL: http://svn.apache.org/viewvc?rev=1087189&view=rev
Log:
DERBY-5121 Data corruption when executing an UPDATE trigger

Backport engine changes from revision 1087049(trunk) into 10.7 codeline.


Modified:
    db/derby/code/branches/10.7/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java

Modified: db/derby/code/branches/10.7/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.7/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java?rev=1087189&r1=1087188&r2=1087189&view=diff
==============================================================================
--- db/derby/code/branches/10.7/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java
(original)
+++ db/derby/code/branches/10.7/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java
Thu Mar 31 05:35:18 2011
@@ -1087,57 +1087,30 @@ public final class UpdateNode extends DM
 		if (relevantTriggers.size() > 0)
 		{
 			needsDeferredProcessing[0] = true;
+			
+			boolean needToIncludeAllColumns = false;
 			Enumeration descs = relevantTriggers.elements();
 			while (descs.hasMoreElements())
 			{
 				TriggerDescriptor trd = (TriggerDescriptor) descs.nextElement();
 				
-				int[] referencedColsInTriggerAction = trd.getReferencedColsInTriggerAction();
-				int[] triggerCols = trd.getReferencedCols();
-				if (triggerCols == null || triggerCols.length == 0) {
-					for (int i=0; i < columnCount; i++) {
-						columnMap.set(i+1);
-					}
-					//no need to go through the test of the trigger because
-					//we have already decided to read all the columns 
-					//because no trigger action columns were found for the
-					//trigger that we are considering right now.
-					break; 
-				} else {
-					if (referencedColsInTriggerAction == null || 
-							referencedColsInTriggerAction.length == 0) {
-						//Does this trigger have REFERENCING clause defined on it
-						if (!trd.getReferencingNew() && !trd.getReferencingOld()) {
-							for (int ix = 0; ix < triggerCols.length; ix++)
-							{
-								columnMap.set(triggerCols[ix]);
-							}
-						} else {
-							for (int i=0; i < columnCount; i++) {
-								columnMap.set(i+1);
-							}							
-							//no need to go through the test of the trigger because
-							//we have already decided to read all the columns 
-							//because no trigger action columns were found for the
-							//trigger that we are considering right now.
-							break; 
-						}
-					} else {
-						for (int ix = 0; ix < triggerCols.length; ix++)
-						{
-							columnMap.set(triggerCols[ix]);
-						}
-						for (int ix = 0; ix < referencedColsInTriggerAction.length; ix++)
-						{
-							columnMap.set(referencedColsInTriggerAction[ix]);
-						}
-					}
-				}			
+				//Does this trigger have REFERENCING clause defined on it
+				if (!trd.getReferencingNew() && !trd.getReferencingOld())
+					continue;
+				else
+				{
+					needToIncludeAllColumns = true;
+					break;
+				}
+			}
 
+			if (needToIncludeAllColumns) {
+				for (int i = 1; i <= columnCount; i++)
+				{
+					columnMap.set(i);
+				}
 			}
 		}
-
-
 		return	columnMap;
 	}
 



Mime
View raw message