db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1044553 - in /db/derby/code/branches/10.3: ./ java/engine/org/apache/derby/impl/sql/compile/ java/testing/org/apache/derbyTesting/functionTests/tests/lang/ java/testing/org/apache/derbyTesting/functionTests/tests/memory/
Date Sat, 11 Dec 2010 00:29:14 GMT
Author: mamta
Date: Sat Dec 11 00:29:13 2010
New Revision: 1044553

URL: http://svn.apache.org/viewvc?rev=1044553&view=rev
Log:
Backporting into 10.5 codeline
1)DERBY-4538 If the CREATE TRIGGER does not have the REFERENCING clause, then there is no
need to keep before and after values for the triggering table
2)And the test added by DERBY-1482 Update triggers on tables with blob columns stream blobs
into memory even when the blobs are not referenced/accessed.


Added:
    db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/memory/TriggerTests.java
      - copied, changed from r915177, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/memory/TriggerTests.java
Modified:
    db/derby/code/branches/10.3/   (props changed)
    db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java
    db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java
    db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
    db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/memory/_Suite.java

Propchange: db/derby/code/branches/10.3/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Dec 11 00:29:13 2010
@@ -1 +1 @@
-/db/derby/code/trunk:552046,586313,586317,788436,793588,794303,796316,796372,798347,798742,800523,803548,816536,882732,946794,958163
+/db/derby/code/trunk:552046,586313,586317,788436,793588,794303,796316,796372,798347,798742,800523,803548,816536,882732,915177,917771,946794,958163

Modified: db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java?rev=1044553&r1=1044552&r2=1044553&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java
(original)
+++ db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/compile/DeleteNode.java
Sat Dec 11 00:29:13 2010
@@ -33,6 +33,7 @@ import org.apache.derby.iapi.sql.diction
 import org.apache.derby.iapi.sql.dictionary.GenericDescriptorList;
 import org.apache.derby.iapi.sql.dictionary.ColumnDescriptor;
 import org.apache.derby.iapi.sql.dictionary.ColumnDescriptorList;
+import org.apache.derby.iapi.sql.dictionary.TriggerDescriptor;
 
 
 import org.apache.derby.iapi.sql.ResultSet;
@@ -70,6 +71,8 @@ import org.apache.derby.impl.sql.execute
 import java.lang.reflect.Modifier;
 import org.apache.derby.iapi.services.classfile.VMOpcode;
 import org.apache.derby.iapi.services.io.FormatableProperties;
+
+import java.util.Enumeration;
 import java.util.Vector;
 import java.util.Hashtable;
 import java.util.Properties;
@@ -906,7 +909,15 @@ public class DeleteNode extends DMLModSt
 	  *	3)	adds the index descriptors to a list of conglomerate
 	  *		descriptors.
 	  *	4)	finds all DELETE triggers on the table
-	  *	5)	if there are any DELETE triggers, marks all columns in the bitmap
+	  *	5)	if there are any DELETE triggers, then do one of the following
+	  *     a)If all of the triggers have MISSING referencing clause, then that
+	  *      means that the trigger actions do not have access to before and
+	  *      after values. In that case, there is no need to blanketly decide 
+	  *      to include all the columns in the read map just because there are
+	  *      triggers defined on the table.
+	  *     b)Since one/more triggers have REFERENCING clause on them, get all
+	  *      the columns because we don't know what the user will ultimately 
+	  *      reference.
 	  *	6)	adds the triggers to an evolving list of triggers
 	  *
 	  *	@param	conglomVector		OUT: vector of affected indices
@@ -950,18 +961,41 @@ public class DeleteNode extends DMLModSt
 		DMLModStatementNode.getXAffectedIndexes(baseTable,  null, columnMap, conglomVector );
 
 		/*
-	 	** If we have any triggers, then get all the columns
-		** because we don't know what the user will ultimately
-		** reference.
+	 	** If we have any DELETE triggers, then do one of the following
+	 	** 1)If all of the triggers have MISSING referencing clause, then that
+	 	** means that the trigger actions do not have access to before and 
+	 	** after values. In that case, there is no need to blanketly decide to
+	 	** include all the columns in the read map just because there are
+	 	** triggers defined on the table.
+	 	** 2)Since one/more triggers have REFERENCING clause on them, get all 
+	 	** the columns because we don't know what the user will ultimately reference.
 	 	*/
 		baseTable.getAllRelevantTriggers( StatementType.DELETE, (int[])null, relevantTriggers );
-		if ( relevantTriggers.size() > 0 ) { needsDeferredProcessing[0] = true; }
 
 		if (relevantTriggers.size() > 0)
 		{
-			for (int i = 1; i <= columnCount; i++)
-			{
-				columnMap.set(i);
+			needsDeferredProcessing[0] = true;
+			
+			boolean needToIncludeAllColumns = false;
+			Enumeration descs = relevantTriggers.elements();
+			while (descs.hasMoreElements())
+			{
+				TriggerDescriptor trd = (TriggerDescriptor) descs.nextElement();
+				//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);
+				}
 			}
 		}
 

Modified: db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java?rev=1044553&r1=1044552&r2=1044553&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java
(original)
+++ db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/sql/compile/UpdateNode.java
Sat Dec 11 00:29:13 2010
@@ -21,17 +21,12 @@
 
 package	org.apache.derby.impl.sql.compile;
 
-import org.apache.derby.iapi.services.context.ContextManager;
-
-import org.apache.derby.iapi.services.loader.GeneratedMethod;
-
 import org.apache.derby.iapi.services.compiler.MethodBuilder;
 
 import org.apache.derby.impl.sql.compile.ActivationClassBuilder;
 import org.apache.derby.iapi.sql.conn.Authorizer;
 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
 import org.apache.derby.impl.sql.execute.FKInfo;
-import org.apache.derby.iapi.services.compiler.MethodBuilder;
 
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.error.StandardException;
@@ -40,16 +35,14 @@ import org.apache.derby.iapi.sql.compile
 import org.apache.derby.iapi.sql.compile.Visitable;
 import org.apache.derby.iapi.sql.compile.Visitor;
 
-import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
-
 import org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor;
 import org.apache.derby.iapi.sql.dictionary.ConstraintDescriptorList;
 import org.apache.derby.iapi.sql.dictionary.ConstraintDescriptor;
 import org.apache.derby.iapi.sql.dictionary.CheckConstraintDescriptor;
 import org.apache.derby.iapi.sql.dictionary.DataDictionary;
-import org.apache.derby.iapi.sql.dictionary.IndexRowGenerator;
 import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
 import org.apache.derby.iapi.sql.dictionary.GenericDescriptorList;
+import org.apache.derby.iapi.sql.dictionary.TriggerDescriptor;
 
 import org.apache.derby.iapi.reference.SQLState;
 import org.apache.derby.iapi.sql.execute.ConstantAction;
@@ -57,7 +50,6 @@ import org.apache.derby.iapi.sql.execute
 import org.apache.derby.iapi.sql.execute.ExecPreparedStatement;
 import org.apache.derby.iapi.sql.execute.ExecRow;
 
-import org.apache.derby.iapi.sql.Activation;
 import org.apache.derby.iapi.sql.ResultSet;
 import org.apache.derby.iapi.sql.StatementType;
 
@@ -72,9 +64,9 @@ import org.apache.derby.iapi.reference.C
 import org.apache.derby.iapi.util.ReuseFactory;
 import org.apache.derby.iapi.services.classfile.VMOpcode;
 
+import java.util.Enumeration;
 import java.lang.reflect.Modifier;
 import java.sql.SQLException;
-import java.util.Properties;
 import java.util.Vector;
 
 /**
@@ -914,7 +906,15 @@ public final class UpdateNode extends DM
 	  *	4)	finds all constraints which overlap the updated columns
 	  *		and adds the constrained columns to the bitmap
 	  *	5)	finds all triggers which overlap the updated columns.
-	  *	6)	if there are any triggers, marks all columns in the bitmap
+	  *	6)	if there are any UPDATE triggers, then do one of the following
+	  *     a)If all of the triggers have MISSING referencing clause, then that
+	  *      means that the trigger actions do not have access to before and
+	  *      after values. In that case, there is no need to blanketly decide 
+	  *      to include all the columns in the read map just because there are
+	  *      triggers defined on the table.
+	  *     b)Since one/more triggers have REFERENCING clause on them, get all
+	  *      the columns because we don't know what the user will ultimately 
+	  *      reference.
 	  *	7)	adds the triggers to an evolving list of triggers
 	  *
 	  *	@param	updateColumnList	a list of updated columns
@@ -997,19 +997,41 @@ public final class UpdateNode extends DM
 		}
 
 		/*
-	 	** If we have any triggers, then get all the columns
-		** because we don't know what the user will ultimately
-		** reference.
+	 	** If we have any UPDATE triggers, then do one of the following
+	 	** 1)If all of the triggers have MISSING referencing clause, then that
+	 	** means that the trigger actions do not have access to before and 
+	 	** after values. In that case, there is no need to blanketly decide to
+	 	** include all the columns in the read map just because there are
+	 	** triggers defined on the table.
+	 	** 2)Since one/more triggers have REFERENCING clause on them, get all 
+	 	** the columns because we don't know what the user will ultimately reference.
 	 	*/
-
 		baseTable.getAllRelevantTriggers( StatementType.UPDATE, changedColumnIds, relevantTriggers
);
-		if ( relevantTriggers.size() > 0 ) { needsDeferredProcessing[0] = true; }
 
 		if (relevantTriggers.size() > 0)
-		{
-			for (int i = 1; i <= columnCount; i++)
+		{ 
+			needsDeferredProcessing[0] = true;
+			
+			boolean needToIncludeAllColumns = false;
+			Enumeration descs = relevantTriggers.elements();
+			while (descs.hasMoreElements())
 			{
-				columnMap.set(i);
+				TriggerDescriptor trd = (TriggerDescriptor) descs.nextElement();
+				//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);
+				}
 			}
 		}
 

Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java?rev=1044553&r1=1044552&r2=1044553&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
(original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
Sat Dec 11 00:29:13 2010
@@ -59,6 +59,7 @@ public class _Suite extends BaseTestCase
         // the nightly runs.
         // suite.addTest(largeCodeGen.suite());
 
+        suite.addTest(org.apache.derbyTesting.functionTests.tests.memory.TriggerTests.suite());
         suite.addTest(AnsiTrimTest.suite());
         suite.addTest(CreateTableFromQueryTest.suite());
         suite.addTest(DatabaseClassLoadingTest.suite());

Copied: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/memory/TriggerTests.java
(from r915177, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/memory/TriggerTests.java)
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/memory/TriggerTests.java?p2=db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/memory/TriggerTests.java&p1=db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/memory/TriggerTests.java&r1=915177&r2=1044553&rev=1044553&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/memory/TriggerTests.java
(original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/memory/TriggerTests.java
Sat Dec 11 00:29:13 2010
@@ -19,6 +19,7 @@ import org.apache.derbyTesting.junit.Tes
 public class TriggerTests extends BaseJDBCTestCase {
 
 	final int lobsize = 300000*1024;
+	boolean isDerby1482Fixed = false;
 	/**
 	 * Insert trigger tests
 	 * ****************
@@ -302,13 +303,16 @@ public class TriggerTests extends BaseJD
 	 * @throws SQLException
 	 */
 	public void test1InsertAfterTrigger() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
 		s.execute("create trigger trigger1 AFTER INSERT on table1 referencing " +
 			"new as n_row for each row " +
 			"insert into table2(id, updates) values (n_row.id, -1)");
 		commit();
-   		runInsertTriggerTest();		       	
+   		runtest2InsertTriggerTest();		       	
 	}
 
 	/**
@@ -319,6 +323,9 @@ public class TriggerTests extends BaseJD
 	 * @throws SQLException
 	 */
 	public void test1InsertAfterTriggerStoredProc() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
         s.execute("create procedure proc_test1_InsertAfterTrigger_update_table " +
@@ -329,7 +336,7 @@ public class TriggerTests extends BaseJD
 			"new as n_row for each row " +
 			"call proc_test1_InsertAfterTrigger_update_table(n_row.id)");
 		commit();
-   		runInsertTriggerTest();		       	
+   		runtest2InsertTriggerTest();		       	
 	}
 
 	/**
@@ -353,6 +360,9 @@ public class TriggerTests extends BaseJD
 	 * @throws SQLException
 	 */
 	public void test1DeleteAfterTrigger() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
 		s.execute("create trigger trigger1 after DELETE on table1 referencing " +
@@ -370,6 +380,9 @@ public class TriggerTests extends BaseJD
 	 * @throws SQLException
 	 */
 	public void test1DeleteAfterTriggerStoredProc() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
         s.execute("create procedure proc_test1_DeleteAfterTrigger_update_table " +
@@ -418,6 +431,9 @@ public class TriggerTests extends BaseJD
 	 * @throws SQLException
 	 */
 	public void test1UpdateAfterTrigger() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
 		s.execute("create trigger trigger1 after update of status on table1 referencing " +
@@ -435,6 +451,9 @@ public class TriggerTests extends BaseJD
 	 * @throws SQLException
 	 */
 	public void test1UpdateAfterTriggerStoredProc() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
         s.execute("create procedure proc_test1_UpdateAfterTrigger_update_table " +
@@ -470,13 +489,16 @@ public class TriggerTests extends BaseJD
 	 * @throws SQLException
 	 */
 	public void test1InsertBeforeTrigger() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
 		s.execute("create trigger trigger1 no cascade before INSERT on table1 referencing " +
 			"new as n_row for each row " +
 			"select updates from table2 where table2.id = n_row.id");
 		commit();
-   		runInsertTriggerTest();		       	
+   		runtest2InsertTriggerTest();		       	
 	}
 
 	/**
@@ -487,6 +509,9 @@ public class TriggerTests extends BaseJD
 	 * @throws SQLException
 	 */
 	public void test1InsertBeforeTriggerStoredProc() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
         s.execute("create procedure proc_test1_InsertBeforeTrigger_select_table " +
@@ -496,7 +521,7 @@ public class TriggerTests extends BaseJD
 		s.execute("create trigger trigger1 no cascade before INSERT on table1 referencing " +
 			"new as n_row for each row call proc_test1_InsertBeforeTrigger_select_table(n_row.id)");
 		commit();
-		runInsertTriggerTest();
+		runtest2InsertTriggerTest();
 	}
 	
 	/**
@@ -521,6 +546,9 @@ public class TriggerTests extends BaseJD
 	 * @throws SQLException
 	 */
 	public void test1DeleteBeforeTrigger() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
 		s.execute("create trigger trigger1 no cascade before DELETE on table1 referencing " +
@@ -538,7 +566,10 @@ public class TriggerTests extends BaseJD
 	 * @throws SQLException
 	 */
 	public void test1DeleteBeforeTriggerStoredProc() throws SQLException{
-        basicSetup();
+		if (isDerby1482Fixed == false)
+			return;
+		
+       basicSetup();
         Statement s = createStatement();
 
         s.execute("create procedure proc_test1_DeleteBeforeTrigger_select_table " +
@@ -588,6 +619,9 @@ public class TriggerTests extends BaseJD
 	 * @throws SQLException
 	 */
 	public void test1UpdateBeforeTrigger() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
 
@@ -606,6 +640,9 @@ public class TriggerTests extends BaseJD
 	 * @throws SQLException
 	 */
 	public void test1UpdateBeforeTriggerStoredProc() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
         s.execute("create procedure proc_test1_UpdateBeforeTrigger_select_table " +
@@ -642,6 +679,9 @@ public class TriggerTests extends BaseJD
 	 * @throws SQLException
 	 */
 	public void test2InsertAfterTriggerAccessLOB() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
 
@@ -659,7 +699,7 @@ public class TriggerTests extends BaseJD
 				"new as n_row for each row " +
 				"insert into table2(id, bl_table2) values (n_row.id, n_row.bl)");
 		commit();
-   		runInsertTriggerTest();
+   		runtest2InsertTriggerTest();
 	}
 
 	/**
@@ -670,6 +710,9 @@ public class TriggerTests extends BaseJD
 	 * @throws SQLException
 	 */
 	public void test2DeleteAfterTriggerAccessLOB() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
         //The default table2 created by basicSetup does not match the 
@@ -713,6 +756,9 @@ public class TriggerTests extends BaseJD
 	 * @throws SQLException
 	 */
 	public void test2UpdateAfterTriggerAccessLOB() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
         //The default table2 created by basicSetup does not match the 
@@ -740,6 +786,9 @@ public class TriggerTests extends BaseJD
 	 * @throws SQLException
 	 */
 	public void test2InsertAfterTriggerUpdatedLOB() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
 
@@ -758,7 +807,7 @@ public class TriggerTests extends BaseJD
 				"new as n_row for each row " +
 				"update table1 set bl_null=n_row.bl where bl_null is null");
 		commit();
-   		runInsertTriggerTest();
+   		runtest2InsertTriggerTest();
 	}
 
 	/**
@@ -769,6 +818,9 @@ public class TriggerTests extends BaseJD
 	 * @throws SQLException
 	 */
 	public void test2UpdateAfterTriggerUpdatedLOB() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
 
@@ -797,6 +849,9 @@ public class TriggerTests extends BaseJD
 	 * @throws SQLException
 	 */
 	public void test2InsertBeforeTriggerAccessLOB() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
         //The default table2 created by basicSetup does not match the 
@@ -813,7 +868,7 @@ public class TriggerTests extends BaseJD
 		ps.setInt(1, 1);
         ps.executeUpdate();
 		commit();
-   		runInsertTriggerTest();
+   		runtest2InsertTriggerTest();
 	}
 	
 	/**
@@ -823,6 +878,9 @@ public class TriggerTests extends BaseJD
 	 * @throws SQLException
 	 */
 	public void test2DeleteBeforeTriggerAccessLOB() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
 
@@ -850,6 +908,9 @@ public class TriggerTests extends BaseJD
 	 * @throws SQLException
 	 */
 	public void test2UpdateBeforeTriggerAccessLOB() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
 
@@ -888,6 +949,9 @@ public class TriggerTests extends BaseJD
 	 * @throws SQLException
 	 */
 	public void test3UpdateAfterTrigger() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
 		s.execute("create trigger trigger1 after update of bl on table1 referencing " +
@@ -906,6 +970,9 @@ public class TriggerTests extends BaseJD
 	 * @throws SQLException
 	 */
 	public void test3UpdateAfterTriggerStoredProc() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
 	
@@ -944,6 +1011,9 @@ public class TriggerTests extends BaseJD
 	 * @throws SQLException
 	 */
 	public void test3UpdateBeforeTrigger() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
 
@@ -962,6 +1032,9 @@ public class TriggerTests extends BaseJD
 	 * @throws SQLException
 	 */
 	public void test3UpdateBeforeTriggerStoredProc() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
 
@@ -1007,6 +1080,9 @@ public class TriggerTests extends BaseJD
 	 * @throws SQLException
 	 */
 	public void test4UpdateAfterTriggerAccessLOB() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
 	    Statement s = createStatement();
 
@@ -1034,6 +1110,9 @@ public class TriggerTests extends BaseJD
 	 * @throws SQLException
 	 */ 
 	public void test4UpdateAfterTriggerUpdatedLOB() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
         Statement s = createStatement();
 
@@ -1064,6 +1143,9 @@ public class TriggerTests extends BaseJD
 	 * @throws SQLException
 	 */
 	public void test4UpdateBeforeTrigger() throws SQLException{
+		if (isDerby1482Fixed == false)
+			return;
+		
         basicSetup();
 	    Statement s = createStatement();
 
@@ -1096,7 +1178,7 @@ public class TriggerTests extends BaseJD
 		s.execute("create trigger trigger1 AFTER INSERT on table1 " +
 			"insert into table2(id, updates) values (100, -1)");
 		commit();
-   		runInsertTriggerTest();		       	
+   		runtest1InsertTriggerTest();		       	
 	}
 	 
 	/**
@@ -1111,7 +1193,7 @@ public class TriggerTests extends BaseJD
 		s.execute("create trigger trigger1 NO CASCADE BEFORE INSERT on table1 " +
 			"select updates from table2 where table2.id = 1");
 		commit();
-   		runInsertTriggerTest();		       	
+   		runtest1InsertTriggerTest();		       	
 	}
 	 
 	/**
@@ -1153,8 +1235,7 @@ public class TriggerTests extends BaseJD
 	public void test5UpdateAfterTriggerNoReferencingClause() throws SQLException{
         basicSetup();
         Statement s = createStatement();
-		s.execute("create trigger trigger1 AFTER UPDATE of status on table1 referencing " +
-				"new as n_row for each row " +
+		s.execute("create trigger trigger1 AFTER UPDATE of status on table1 " +
 				"update table2 set updates = updates + 1 where table2.id = 1");
 		commit();
    		runtest1UpdateTrigger();		       	
@@ -1169,21 +1250,32 @@ public class TriggerTests extends BaseJD
 	public void test5UpdateBeforeTriggerNoReferencingClause() throws SQLException{
         basicSetup();
         Statement s = createStatement();
-		s.execute("create trigger trigger1 NO CASCADE BEFORE UPDATE of status on table1 referencing
" +
-				"new as n_row for each row " +
+		s.execute("create trigger trigger1 NO CASCADE BEFORE UPDATE of status on table1 " +
 				"select updates from table2 where table2.id = 1");
 		commit();
    		runtest1UpdateTrigger();		       	
 	}
+
+	/**
+	 * Following will do an insert into table1 which will cause insert 
+	 * trigger to fire. The insert does not involve the LOB column.
+	 *
+	 * @throws SQLException
+	 */
+	public void runtest1InsertTriggerTest() throws SQLException{
+		PreparedStatement ps = prepareStatement(
+				"insert into table1(id, status) values(101, 0)");
+        ps.executeUpdate();
+        commit();
+	}
 	
 	/**
 	 * Following will do an insert into table1 which will cause insert 
-	 * trigger to fire. 
+	 * trigger to fire. The insert involves the LOB column.
 	 * @param p1
 	 * @throws SQLException
 	 */
-	public void runInsertTriggerTest() throws SQLException{
-		System.out.println("Inserting into table1 to cause insert trigger to fire");
+	public void runtest2InsertTriggerTest() throws SQLException{
 		PreparedStatement ps = prepareStatement(
 				"insert into table1(id, status, bl) values(101, 0, ?)");
         ps.setBinaryStream(1, new LoopingAlphabetStream(lobsize), lobsize);
@@ -1193,12 +1285,11 @@ public class TriggerTests extends BaseJD
 	
 	/**
 	 * Following will update a row in table1 which will cause update 
-	 * trigger to fire. 
+	 * trigger to fire. The update does not involve the LOB column.
 	 * @param p1
 	 * @throws SQLException
 	 */
 	public void runtest1UpdateTrigger() throws SQLException{
-		System.out.println("Updating table1(int) to cause update trigger to fire");
 		PreparedStatement ps = prepareStatement(
 				"update table1 set status = 1 where id = 1");
         ps.executeUpdate();
@@ -1207,12 +1298,11 @@ public class TriggerTests extends BaseJD
 	
 	/**
 	 * Following will update a row in table1 which will cause update 
-	 * trigger to fire. 
+	 * trigger to fire. The update involves the LOB column.
 	 * @param p1
 	 * @throws SQLException
 	 */
 	public void runtest2UpdateTrigger() throws SQLException{
-		System.out.println("Updating table1(blob column1) to cause update trigger to fire");
 		PreparedStatement ps = prepareStatement(
 				"update table1 set bl = ? where id = 1");
         ps.setBinaryStream(1, new LoopingAlphabetStream(lobsize), lobsize);
@@ -1222,12 +1312,11 @@ public class TriggerTests extends BaseJD
 	
 	/**
 	 * Following will update a row in table1 which will cause update 
-	 * trigger to fire. 
+	 * trigger to fire. The update involves the LOB column.
 	 * @param p1
 	 * @throws SQLException
 	 */
 	public void runtest3UpdateTrigger() throws SQLException{
-		System.out.println("Updating table1(blob column2) to cause update trigger to fire");
 		PreparedStatement ps = prepareStatement(
 				"update table1 set bl_null=null where id = 1");
         ps.executeUpdate();
@@ -1241,7 +1330,6 @@ public class TriggerTests extends BaseJD
 	 * @throws SQLException
 	 */
 	public void runDeleteTriggerTest() throws SQLException{
-		System.out.println("Deleting from table1 to cause delete trigger to fire");
 		PreparedStatement ps = prepareStatement(
 				"delete from table1 where id=1");
         ps.executeUpdate();

Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/memory/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/memory/_Suite.java?rev=1044553&r1=1044552&r2=1044553&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/memory/_Suite.java
(original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/memory/_Suite.java
Sat Dec 11 00:29:13 2010
@@ -35,6 +35,7 @@ public class _Suite extends BaseJDBCTest
 
     public static Test suite() throws Exception{
         TestSuite suite = new TestSuite("Memory Suite");
+        suite.addTest(TriggerTests.suite());
         suite.addTest(BlobMemTest.suite());
         suite.addTest(ClobMemTest.suite());
         suite.addTest(MultiByteClobTest.suite());



Mime
View raw message