db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r432658 - in /db/derby/code/branches/10.2/java: drda/org/apache/derby/impl/drda/ engine/org/apache/derby/iapi/sql/compile/ engine/org/apache/derby/iapi/types/ engine/org/apache/derby/impl/services/bytecode/ engine/org/apache/derby/impl/sql/...
Date Fri, 18 Aug 2006 17:37:52 GMT
Author: rhillegas
Date: Fri Aug 18 10:37:49 2006
New Revision: 432658

URL: http://svn.apache.org/viewvc?rev=432658&view=rev
Log:
DERBY-1725: Merge trunk into 10.2 branch from 430947 through 431743.

Added:
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/perf/
      - copied from r431743, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/perf/
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/perf/StartupExistingDBTest.java
      - copied unchanged from r431743, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/perf/StartupExistingDBTest.java
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/perf/StartupExistingDBTest_app.properties
      - copied unchanged from r431743, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/perf/StartupExistingDBTest_app.properties
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/perf/StartupNewDBTest.java
      - copied unchanged from r431743, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/perf/StartupNewDBTest.java
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/perf/build.xml
      - copied unchanged from r431743, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/perf/build.xml
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/perf/copyfiles.ant
      - copied unchanged from r431743, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/perf/copyfiles.ant
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/perf/existingDb.jar
      - copied unchanged from r431743, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/perf/existingDb.jar
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/util/JarUtil.java
      - copied unchanged from r431743, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/JarUtil.java
Removed:
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURQueryMixTest_app.properties
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURTest_app.properties
Modified:
    db/derby/code/branches/10.2/java/drda/org/apache/derby/impl/drda/ConsistencyToken.java
    db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/sql/compile/Optimizer.java
    db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/types/DataType.java
    db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/types/XML.java
    db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/services/bytecode/BCMethod.java
    db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/services/bytecode/CodeChunk.java
    db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/compile/CoalesceFunctionNode.java
    db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/BaseActivation.java
    db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/CreateTriggerConstantAction.java
    db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/store/raw/data/OverflowInputStream.java
    db/derby/code/branches/10.2/java/testing/build.xml
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/blobclob4BLOB.out
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/derbyrunjartest.out
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/subquery.out
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/subquery2.out
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/triggerGeneral.out
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNet.exclude
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/suites/jdbcapi.runall
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testProperties.java
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testSecMec.java
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ConcurrencyTest.java
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/HoldabilityTest.java
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURQueryMixTest.java
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURTest.java
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/UpdateXXXTest.java
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/subquery.sql
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/subquery2.sql
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/triggerGeneral.sql
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/updatableResultSet.java
    db/derby/code/branches/10.2/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java

Modified: db/derby/code/branches/10.2/java/drda/org/apache/derby/impl/drda/ConsistencyToken.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/drda/org/apache/derby/impl/drda/ConsistencyToken.java?rev=432658&r1=432657&r2=432658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/drda/org/apache/derby/impl/drda/ConsistencyToken.java (original)
+++ db/derby/code/branches/10.2/java/drda/org/apache/derby/impl/drda/ConsistencyToken.java Fri Aug 18 10:37:49 2006
@@ -70,13 +70,23 @@
      * @return hash code
      */
     public int hashCode() {
-        if (hash == 0) {
+        // ConsistencyToken objects might be kept for a long time and are
+        // frequently used as keys in hash tables. Therefore, it is a good idea
+        // to cache their hash codes.
+        int h = hash;
+        if (h == 0) {
+            // The hash code has not been calculated yet (or perhaps the hash
+            // code actually is 0). Calculate a new one and cache it. No
+            // synchronization is needed since reads and writes of 32-bit
+            // primitive values are guaranteed to be atomic. See The
+            // "Double-Checked Locking is Broken" Declaration for details.
             int len = bytes.length;
             for (int i = 0; i < len; ++i) {
-                hash ^= bytes[i];
+                h ^= bytes[i];
             }
+            hash = h;
         }
-        return hash;
+        return h;
     }
 
     /**

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/sql/compile/Optimizer.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/sql/compile/Optimizer.java?rev=432658&r1=432657&r2=432658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/sql/compile/Optimizer.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/sql/compile/Optimizer.java Fri Aug 18 10:37:49 2006
@@ -70,6 +70,12 @@
 	String MAX_MEMORY_PER_TABLE = "derby.language.maxMemoryPerTable";
 
 	/**
+		Maximum size of dynamically created materialized rows. Caching large results
+		use lot of memory and can cause stack overflow. See DERBY-634
+	*/
+	int MAX_DYNAMIC_MATERIALIZED_ROWS = 512;
+
+	/**
 	   Property name for disabling statistics use for all queries.
 	*/
 	String USE_STATISTICS = "derby.language.useStatistics";

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/types/DataType.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/types/DataType.java?rev=432658&r1=432657&r2=432658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/types/DataType.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/types/DataType.java Fri Aug 18 10:37:49 2006
@@ -478,6 +478,14 @@
 		}
 	}
 
+	/**
+	 * Set the value of this DataValueDescriptor based on the value
+	 * of the specified DataValueDescriptor.
+	 *
+	 * @param dvd	The DataValueDescriptor that holds the value to
+	 *  which we want to set this DataValueDescriptor's value.
+	 *
+	 */
 	protected void setFrom(DataValueDescriptor dvd) throws StandardException
 	{
 		throw StandardException.newException(SQLState.NOT_IMPLEMENTED);

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/types/XML.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/types/XML.java?rev=432658&r1=432657&r2=432658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/types/XML.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/types/XML.java Fri Aug 18 10:37:49 2006
@@ -158,7 +158,6 @@
      * object's qualified type.
      * @param val A SQLChar instance to clone and use for
      *  this XML value.
-     * @param qualXType Qualified XML type.
      */
     private XML(SQLChar val, int xmlType)
     {
@@ -255,9 +254,7 @@
     }
 
     /**
-     * @see DataValueDescriptor#setFrom
-     *
-     * Note: 
+     * @see DataType#setFrom
      */
     protected void setFrom(DataValueDescriptor theValue)
         throws StandardException

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/services/bytecode/BCMethod.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/services/bytecode/BCMethod.java?rev=432658&r1=432657&r2=432658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/services/bytecode/BCMethod.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/services/bytecode/BCMethod.java Fri Aug 18 10:37:49 2006
@@ -77,7 +77,7 @@
 
 	final BCClass		cb;
 	protected final ClassHolder modClass; // the class it is in (modifiable fmt)
-	private final String myReturnType;
+	final String myReturnType;
 	
 	/**
 	 * The original name of the method, this
@@ -260,6 +260,7 @@
     private void splitMethod() {
         
         int split_pc = 0;
+        boolean splittingZeroStack = true;
         for (int codeLength = myCode.getPC();
                (cb.limitMsg == null) &&
                (codeLength > CODE_SPLIT_LENGTH);
@@ -280,19 +281,36 @@
             if (optimalMinLength > lengthToCheck)
                 optimalMinLength = lengthToCheck;
 
-            split_pc = myCode.splitZeroStack(this, modClass, split_pc,
+            if (splittingZeroStack)
+            {
+                split_pc = myCode.splitZeroStack(this, modClass, split_pc,
                     optimalMinLength);
+            }
+            else
+            {
+                //TODO: re-start split at point left off
+                //split_pc = myCode.splitExpressionOut(this, modClass,
+                //        optimalMinLength, maxStack);
+                
+                // DERBY-766 temp - don't call the split method yet.
+                split_pc = -1;
+            }
 
             // Negative split point returned means that no split
             // was possible. Give up on this approach and goto
-            // the next approach (none-yet).
+            // the next approach.
             if (split_pc < 0) {
-                break;
+                if (!splittingZeroStack)
+                   break;
+                splittingZeroStack = false;
+                split_pc = 0;
             }
 
             // success, continue on splitting after the call to the
             // sub-method if the method still execeeds the maximum length.
         }
+        
+ 
     }
 
 	/*

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/services/bytecode/CodeChunk.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/services/bytecode/CodeChunk.java?rev=432658&r1=432657&r2=432658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/services/bytecode/CodeChunk.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/services/bytecode/CodeChunk.java Fri Aug 18 10:37:49 2006
@@ -1406,9 +1406,9 @@
      * uses parameters.
      */
     private BCMethod startSubMethod(BCMethod mb, String returnType,
-            int split_pc, int codeLength) {
+            int split_pc, int blockLength) {
 
-        boolean needParameters = usesParameters(mb, split_pc, codeLength);
+        boolean needParameters = usesParameters(mb, split_pc, blockLength);
 
         return mb.getNewSubMethod(returnType, needParameters);
     }
@@ -1509,7 +1509,18 @@
 
         // Just cause the sub-method to return,
         // fix up its maxStack and then complete it.
-        subChunk.addInstr(VMOpcode.RETURN);
+        if (subMethod.myReturnType.equals("void"))
+            subChunk.addInstr(VMOpcode.RETURN);
+        else
+           subChunk.addInstr(VMOpcode.ARETURN);
+        
+        // Finding the max stack requires the class format to
+        // still be valid. If we have blown the number of constant
+        // pool entries then we can no longer guarantee that indexes
+        // into the constant pool in the code stream are valid.
+        if (cb.limitMsg != null)
+            return -1;
+        
         subMethod.maxStack = subChunk.findMaxStack(ch, 0, subChunk.getPC());
         subMethod.complete();
 
@@ -1643,8 +1654,8 @@
      * <LI> N + 1 - method returning a single word
      * <LI> N + 2 - method returning a double word (java long or double)
      * </UL>
-     * This code will handle the N+1 and  N+2 cases, the typical
-     * ones for generated code.
+     * This code will handle the N+1 where the word is a reference,
+     * the typical case for generated code.
      * <BR>
      * The code is self contained because in general the byte code
      * for the arguments will push and pop values but never drop
@@ -1667,39 +1678,28 @@
      * push3 this swap invoke
      * </code>
      * In this case the byte code for arg1 (swap) is not self-contained
-     * and relies on earlier stack values. The set of instructions
-     * that break the self-containment are limited and thus can be
-     * checked for easily.
+     * and relies on earlier stack values.
      * <P>
      * How to identify "self-contained blocks of code".
      * <BR>
      * We walk through the byte code and maintain a history of
-     * the program counter when the stack changed. If a word
-     * was pushed by an opcode that does not depend on previous
-     * stack values the current program counter is recorded
-     * otherwise -1 is set to indicate stack value may depend
-     * on previous stack values.
-     * <code>
-     * pcDepth[N] = 45
-     * pcDepth[N+1] = -1
-     * pcDepth[N+2] = 52
-     * </code>
+     * the program counter that indicates the start of the
+     * independent sequence each stack word depends on.
+     * Thus for a ALOAD_0 instruction which pushes 'this' the
+     * dependent pc is that of the this. If a DUP instruction followed
+     * then the top-word is now dependent on the previous word (this)
+     * and thus the dependence of it is equal to the dependence of
+     * the previous word. This information is kept in earliestIndepPC
+     * array as we process the instruction stream.
      * <BR>
-     * The pcDepth represents a program counter that caused
-     * the stack to reach that depth and is independent of
-     * previous stack entries. Initially a very limited
-     * number of opcodes are supported as independent.
-     * <BR>
-     * If the instruction that caused the stack decrease
-     * is an invoke byte code that matches what we are looking for
-     * then a determination begins as to if its calling sequence
-     * is self-contained and should it be split out into a sub-method.
-     * The information with the instruction allows us to find
-     * the stack-depth corresponding to the instance for the call.
-     * The depth, from the pcDepth array allows us to find the
-     * pc and instruction that pushed the instance. It can then be
-     * determined the code to generate the instance is this
-     * or this.getter(). 
+     * When a INVOKE instruction is seen for an instance method
+     * that returns a single or double word, the dependence of
+     * the returned value is the dependence of the word in the
+     * stack that is the objectref for the call. This complete
+     * sequence from the pc the objectref depended on to the
+     * INVOKE instruction is then a self contained sequence
+     * and can be split into a sub-method.
+
      * <BR>
      * If the block is self-contained then it can be split, following
      * similar logic to splitZeroStack().
@@ -1707,23 +1707,54 @@
      *  <P>
      *  WORK IN PROGRESS - Incremental development
      *  <BR>
-     *  Currently just walks the method maintaining the
-     *  pcByDepth array and identifies potential blocks
-     *  to splt. Does not perform any split.
-     *  Not called by submitted code. Tested with local
-     *  changes from calls in BCMethod.
+     *  Currently walks the method maintaining the
+     *  earliestIndepPC array and identifies potential blocks
+     *  to splt, performs splits as required.
+     *  Called by BCMethod but commented out in submitted code.
+     *  Tested with local changes from calls in BCMethod.
+     *  Splits generally work, though largeCodeGen shows
+     *  a problem that will be fixed before the code in
+     *  enabled for real.
      *  
       */
+
     final int splitExpressionOut(BCMethod mb, ClassHolder ch,
-            final int codeLength, final int optimalMinLength,
+            final int optimalMinLength,
             int maxStack)
     {
-        // program counter for the instruction that
-        // made the stack reach the given stack depth.
-        int[] pcByDepth = new int[maxStack+1];
-        Arrays.fill(pcByDepth, -1);
-        pcByDepth[0] = 0;
+        // Save the best block we have seen for splitting out.
+        int bestSplitPC = -1;
+        int bestSplitBlockLength = -1;
+        String bestSplitRT = null;      
         
+        // Program counter of the earliest instruction
+        // that the word in the current active stack
+        // at the given depth depends on.
+        //
+        // Some examples, N is the stack depth *after*
+        // the instruction.
+        // E.g. 
+        // ALOAD_0 - pushes this, is an instruction that
+        // pushes an independent value, so the current
+        // stack word depends on the pc of current instruction.
+        // earliestIndepPC[N] = pc (that pushed the value).
+        //
+        // DUP - duplicates the top word, so the duplicated
+        // top word will depend on the same pc as the word
+        // it was duplicated from.
+        // I.e. earliestIndepPC[N]
+        //            = earliestIndepPC[N-1];
+        //
+        // instance method call returning single word value.
+        // The top word will depend on the same pc as the
+        // objectref for the method call, which was at the
+        // same depth in this case.
+        // earliestIndepPC[N] unchanged
+        //
+        // at any time earliestIndepPC is only valid
+        // from 1 to N where N is the depth of the stack.
+       int[] earliestIndepPC = new int[maxStack+1];
+       
         int stack = 0;
                
         //TODO: this conditional handling is copied from
@@ -1734,11 +1765,12 @@
         // a conditional.
         int outerConditionalEnd_pc = -1;  
 
-        int end_pc = 0 + codeLength;
+        int end_pc = getPC();
+        
         for (int pc = 0; pc < end_pc;) {
 
             short opcode = getOpcode(pc);
-
+            
             int stackDelta = stackWordDelta(ch, pc, opcode);
             
             stack += stackDelta;
@@ -1780,37 +1812,94 @@
                 }
                 continue;
             }
-
-            // Set up independent points.
-            // 
-            // Code in this switch either
-            // 1) 'break's out not changing anything
-            // to indicate the instruction left the
-            // stack in such that its independence
-            // at the current stack level is left unchanged.
-            //
-            // 2) Marks the opcode_pc as the independent
-            // start point for the current stack depth.
-            //
-            // 3) marks the current stack depth as not
-            // having an independent start point. In some cases
-            // that may be a false assertion as it's a fail safe
-            // system. Only a small defined set of instructions
-            // are handled as valid starting points. More development
-            // and thought can be put into handling more cases as required.
-            // The 'this' ALOAD_0 instruction will cover most cases.
             
             int opcode_pc = pc - instructionLength(opcode);
             switch (opcode)
             {
-            // Independent instructions that do not modify the stack
-            case VMOpcode.NOP: 
+            // Any instruction we don't have any information
+            // on, we simply clear all evidence of independent
+            // starting points, and start again.
+            default:
+                Arrays.fill(earliestIndepPC,
+                        0, stack + 1, -1);
+                break;
+            
+            // Independent instructions do not change the stack depth
+            // and the independence of the top word picks up
+            // the independence of the previous word at the same
+            // position. Ie. no change!
+            case VMOpcode.ARRAYLENGTH:
+            case VMOpcode.NOP:
+            case VMOpcode.CHECKCAST:
+            case VMOpcode.D2L:
+            case VMOpcode.DNEG:
+            case VMOpcode.F2I:
             	break;
             	
-            // Independent instructions that push one value
-            case VMOpcode.ALOAD_0: // push 'this'
-            	pcByDepth[stack] = opcode_pc;
+            // Independent instructions that push one word
+            case VMOpcode.ALOAD_0:
+            case VMOpcode.ALOAD_1:
+            case VMOpcode.ALOAD_2:
+            case VMOpcode.ALOAD_3:
+            case VMOpcode.ALOAD:
+            case VMOpcode.ACONST_NULL:
+            case VMOpcode.BIPUSH:
+            case VMOpcode.FCONST_0:
+            case VMOpcode.FCONST_1:
+            case VMOpcode.FCONST_2:
+            case VMOpcode.FLOAD:
+            case VMOpcode.ICONST_0:
+            case VMOpcode.ICONST_1:
+            case VMOpcode.ICONST_2:
+            case VMOpcode.ICONST_3:
+            case VMOpcode.ICONST_4:
+            case VMOpcode.ICONST_5:
+            case VMOpcode.ICONST_M1:
+            case VMOpcode.LDC:
+            case VMOpcode.LDC_W:
+            case VMOpcode.SIPUSH:
+            	earliestIndepPC[stack] = opcode_pc;
             	break;
+            
+            // Independent instructions that push two words
+            case VMOpcode.DCONST_0:
+            case VMOpcode.DCONST_1:
+            case VMOpcode.LCONST_0:
+            case VMOpcode.LCONST_1:
+            case VMOpcode.LDC2_W:
+            case VMOpcode.LLOAD:
+            case VMOpcode.LLOAD_0:
+            case VMOpcode.LLOAD_1:
+            case VMOpcode.LLOAD_2:
+            case VMOpcode.LLOAD_3:
+                earliestIndepPC[stack - 1] = 
+                    earliestIndepPC[stack] = opcode_pc;
+                break;
+                
+            // nothing to do for pop, obviously no
+            // code will be dependent on the popped words.
+            case VMOpcode.POP:
+            case VMOpcode.POP2:
+                break;
+                
+            case VMOpcode.SWAP:
+                earliestIndepPC[stack] = earliestIndepPC[stack -1];
+                break;
+            
+            // push a value that depends on the previous value
+            case VMOpcode.I2L:
+                earliestIndepPC[stack] = earliestIndepPC[stack -1];
+                break;
+                
+            case VMOpcode.GETFIELD:
+            {
+                String vmDescriptor = getTypeDescriptor(ch, opcode_pc);
+                int width = CodeChunk.getDescriptorWordCount(vmDescriptor);
+                if (width == 2)
+                    earliestIndepPC[stack] = earliestIndepPC[stack -1];
+                    
+                break;
+            }
 
             case VMOpcode.INVOKEINTERFACE:
             case VMOpcode.INVOKEVIRTUAL:
@@ -1824,85 +1913,89 @@
                 // Width of the value returned by the method call.
                 String vmDescriptor = getTypeDescriptor(ch, opcode_pc);
                 int width = CodeChunk.getDescriptorWordCount(vmDescriptor);
-     
-                // Need to determine the pc of the
-            	// instruction that pushed the objectref
-            	// for the method call. Three cases depending
-            	// on the return type:
-            	// 1) void method
-            	//     pcDepth[stack + 1]
-            	// 2) returns single word
-            	//     pcDepth[stack]
-            	// 3) returns double word
-            	//     pcDepth[stack - 1]
                 
-                // Special case of zero arguments
-                // and returning an single word value.
-                // In this case most likely the code
-                // block to the objectref is not
-                // worth splitting, but it also
-                // does not affect the independence
-                // of the current stack depth.
-                // If the objectref was independent
-                // then the current stack value will
-                // be. This is looking
-                // for the case of this.getXXXFactory().
-                //
-                // 
-                // objectref is popped and single word
-                // value pushed by method call, so
-                // stackDelta must be zero.
-                if (stackDelta == 0 && width == 1)
+                // Independence of this block is the independence
+                // of the objectref that invokved the method.
+                int selfContainedBlockStart;
+                if (width == 0)
                 {
-                	break;
+                    // objectref was at one more than the current depth
+                    selfContainedBlockStart =
+                        earliestIndepPC[stack + 1];
                 }
+                else if (width == 1)
+                {     
+                    // stack is unchanged, objectref was at
+                    // the current stack depth
+                    selfContainedBlockStart = earliestIndepPC[stack];
+               }
+                else
+                {
+                    // width == 2, objectref was one below the
+                    // current stack depth.
+                    selfContainedBlockStart = earliestIndepPC[stack] =
+                        earliestIndepPC[stack - 1];
+                 }
                 
-                int stackDepthForObjectref = stack + (1 - width);
-                
-                // Look for an starting point that is independent
-                // starting at the objectref and working backwards
-                // in the code by looking for program counters
-                // that pushed an independent value.
-                int selfContainedBlockStart = -1;
-                for (int sd = stackDepthForObjectref; sd >= 0; sd--)
+                if (selfContainedBlockStart != -1)
                 {
-                	int pcStart = pcByDepth[sd];
-                	
-                	// not a independent value
-                	if (pcStart == -1)
-                		continue;
-                	
-                	// found a suitable block if
-                	if ((pc - pcStart) >= optimalMinLength)
-                	{
-                		selfContainedBlockStart = pcStart;
-                		break;
-                	}
+                    int blockLength = pc - selfContainedBlockStart;
+
+                    // Only split for a method that returns
+                    // an class reference.
+                    int me = vmDescriptor.lastIndexOf(')');
+                    
+                    if (vmDescriptor.charAt(me+1) == 'L')
+                    {
+                        String rt = vmDescriptor.substring(me + 2,
+                                vmDescriptor.length() - 1);
+                        
+                        if (blockLength > (VMOpcode.MAX_CODE_LENGTH - 1))
+                        {
+                            // too big to split into a single method
+                            // (one for the return opcode)
+                        }                       
+                        else if (blockLength >= optimalMinLength)
+                        {
+                            // Split now!
+                            System.out.println("NOW " + blockLength
+                                    + " @ " + selfContainedBlockStart);
+                            BCMethod subMethod = startSubMethod(mb,
+                                    rt, selfContainedBlockStart,
+                                    blockLength);
+
+                            return splitCodeIntoSubMethod(mb, ch, subMethod,
+                                    selfContainedBlockStart, blockLength);                             
+                        }                       
+                        else if (blockLength > bestSplitBlockLength)
+                        {
+                            // Save it, may split at this point
+                            // if nothing better seen.                          
+                            bestSplitPC = selfContainedBlockStart;
+                            bestSplitBlockLength = blockLength;
+                            bestSplitRT = rt;
+                        }
+                    }
                 }
-            	
-            	// Did we find an independent starting pc
-            	if (selfContainedBlockStart != -1)
-            	{     
-            		// TODO: actual extract & split
-             	    return -1;
-            	}
-            	pcByDepth[stack] = -1;
-            	if (width == 2)
-            		pcByDepth[stack - 1] = -1;
             	break;
               }
-               //TODO: work on splits.
-              default:
-            	// assume the instruction is not independent
-            	// (fail-safe)
-            	pcByDepth[stack] = -1;
-                // account for opcodes pushing longs/doubles.
-                if (stackDelta == 2)
-                	pcByDepth[stack - 1] = -1;
-                break;
-            }   	
+            }   
+            
        }
+        
+        if (bestSplitBlockLength > 100)
+        {
+            System.out.println("BEST " + bestSplitBlockLength
+                    + " @ " + bestSplitPC);
+            BCMethod subMethod = startSubMethod(mb,
+                    bestSplitRT, bestSplitPC,
+                    bestSplitBlockLength);
+
+            return splitCodeIntoSubMethod(mb, ch, subMethod,
+                    bestSplitBlockLength, bestSplitBlockLength); 
             
+        }
+                       
         return -1;
     }
     

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/compile/CoalesceFunctionNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/compile/CoalesceFunctionNode.java?rev=432658&r1=432657&r2=432658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/compile/CoalesceFunctionNode.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/compile/CoalesceFunctionNode.java Fri Aug 18 10:37:49 2006
@@ -317,4 +317,57 @@
 		}
 	}
 
+	/**
+	 * Preprocess an expression tree.  We do a number of transformations
+	 * here (including subqueries, IN lists, LIKE and BETWEEN) plus
+	 * subquery flattening.
+	 * NOTE: This is done before the outer ResultSetNode is preprocessed.
+	 *
+	 * @param	numTables			Number of tables in the DML Statement
+	 * @param	outerFromList		FromList from outer query block
+	 * @param	outerSubqueryList	SubqueryList from outer query block
+	 * @param	outerPredicateList	PredicateList from outer query block
+	 *
+	 * @return						The modified expression
+	 *
+	 * @exception StandardException		Thrown on error
+	 */
+	public ValueNode preprocess(int numTables,
+								FromList outerFromList,
+								SubqueryList outerSubqueryList,
+								PredicateList outerPredicateList) 
+					throws StandardException
+	{
+		int argumentsListSize = argumentsList.size();
+		for (int i=0; i < argumentsListSize; i++) {
+			((ValueNode)argumentsList.elementAt(i)).preprocess
+				(numTables,
+				 outerFromList,
+				 outerSubqueryList,
+				 outerPredicateList);
+		}
+		return this;
+	}
+
+
+	/**
+	 * Prints the sub-nodes of this object.  See QueryTreeNode.java for
+	 * how tree printing is supposed to work.
+	 *
+	 * @param depth					The depth of this node in the tree
+	 */
+
+	public void printSubNodes(int depth)
+	{
+		if (SanityManager.DEBUG)
+		{
+			super.printSubNodes(depth);
+			printLabel(depth, "argumentsList: ");
+			int argumentsListSize = argumentsList.size();
+			for (int i=0; i < argumentsListSize; i++) {
+			    ((ValueNode)argumentsList.elementAt(i)).treePrint(depth+1);
+			}
+		}
+	}
+        
 }

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/BaseActivation.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/BaseActivation.java?rev=432658&r1=432657&r2=432658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/BaseActivation.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/BaseActivation.java Fri Aug 18 10:37:49 2006
@@ -1409,6 +1409,19 @@
 	 * in-memory converted resultset, or the original result set if not converted.
 	 * See beetle 4373 for details.
 	 *
+	 * Optimization implemented as part of Beetle: 4373 can cause severe stack overflow
+	 * problems. See JIRA entry DERBY-634. With default MAX_MEMORY_PER_TABLE of 1MG, it is
+	 * possible that this optimization could attempt to cache upto 250K rows as nested
+	 * union results. At runtime, this would cause stack overflow.
+	 *
+	 * As Jeff mentioned in DERBY-634, right way to optimize original problem would have been
+	 * to address subquery materialization during optimization phase, through hash joins.
+	 * Recent Army's optimizer work through DEBRY-781 and related work introduced a way to
+	 * materialize subquery results correctly and needs to be extended to cover this case.
+	 * While his optimization needs to be made more generic and stable, I propose to avoid
+	 * this regression by limiting size of the materialized resultset created here to be
+	 * less than MAX_MEMORY_PER_TABLE and MAX_DYNAMIC_MATERIALIZED_ROWS.
+	 *
 	 *	@param	rs	input result set
 	 *	@return	materialized resultset, or original rs if it can't be materialized
 	 */
@@ -1432,7 +1445,8 @@
 		while (aRow != null)
 		{
 			cacheSize += aRow.getColumn(1).getLength();
-			if (cacheSize > maxMemoryPerTable)
+			if (cacheSize > maxMemoryPerTable ||
+					rowCache.size() > Optimizer.MAX_DYNAMIC_MATERIALIZED_ROWS)
 				break;
 			rowCache.addElement(aRow.getClone(toClone));
 			aRow = rs.getNextRowCore();

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/CreateTriggerConstantAction.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/CreateTriggerConstantAction.java?rev=432658&r1=432657&r2=432658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/CreateTriggerConstantAction.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/CreateTriggerConstantAction.java Fri Aug 18 10:37:49 2006
@@ -257,23 +257,17 @@
 		*/
 		UUID tmpTriggerId = dd.getUUIDFactory().createUUID();
 
-		/*	
-		** If we have a WHEN action we create it now.
-		*/ 
+		actionSPSId = (actionSPSId == null) ? 
+			dd.getUUIDFactory().createUUID() : actionSPSId;
+ 
 		DataDescriptorGenerator ddg = dd.getDataDescriptorGenerator();
-		if (whenText != null)
-		{
-			whenspsd = createSPS(lcc, ddg, dd, tc, tmpTriggerId, triggerSd,
-						whenSPSId, spsCompSchemaId, whenText, true, triggerTable);
-		}
 
 		/*
-		** Create the trigger action
+		** Create the trigger descriptor first so the trigger action
+		** compilation can pick up the relevant trigger especially in 
+		** the case of self triggering.
 		*/
-		actionspsd = createSPS(lcc, ddg, dd, tc, tmpTriggerId, triggerSd,
-						actionSPSId, spsCompSchemaId, actionText, false, triggerTable);
-		
-		TriggerDescriptor triggerd = 
+		TriggerDescriptor triggerd =
 				ddg.newTriggerDescriptor(
 									triggerSd,
 									tmpTriggerId,
@@ -284,7 +278,7 @@
 									isEnabled,
 									triggerTable,
 									whenspsd == null ? null : whenspsd.getUUID(),
-									actionspsd.getUUID(),
+									actionSPSId,
 									creationTimestamp == null ? new Timestamp(System.currentTimeMillis()) : creationTimestamp,
 									referencedCols,
 									originalActionText,
@@ -298,6 +292,22 @@
 								DataDictionary.SYSTRIGGERS_CATALOG_NUM, false,
 								tc);
 
+
+		/*	
+		** If we have a WHEN action we create it now.
+		*/
+		if (whenText != null)
+		{
+			whenspsd = createSPS(lcc, ddg, dd, tc, tmpTriggerId, triggerSd,
+						whenSPSId, spsCompSchemaId, whenText, true, triggerTable);
+		}
+
+		/*
+		** Create the trigger action
+		*/
+		actionspsd = createSPS(lcc, ddg, dd, tc, tmpTriggerId, triggerSd,
+						actionSPSId, spsCompSchemaId, actionText, false, triggerTable);
+		
 		/*
 		** Make underlying spses dependent on the trigger.
 		*/

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/store/raw/data/OverflowInputStream.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/store/raw/data/OverflowInputStream.java?rev=432658&r1=432657&r2=432658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/store/raw/data/OverflowInputStream.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/store/raw/data/OverflowInputStream.java Fri Aug 18 10:37:49 2006
@@ -74,7 +74,8 @@
 			try
             {
 				// fill the byte holder with data from the page.
-				BasePage columnOverflowPage = ((BasePage) this.owner.getPage(overflowPage));
+				BasePage columnOverflowPage = 
+                    ((BasePage) this.owner.getPage(overflowPage));
 
 				if (columnOverflowPage != null)
                 {

Modified: db/derby/code/branches/10.2/java/testing/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/build.xml?rev=432658&r1=432657&r2=432658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/build.xml (original)
+++ db/derby/code/branches/10.2/java/testing/build.xml Fri Aug 18 10:37:49 2006
@@ -73,6 +73,7 @@
     <ant dir="${derby.testing.src.dir}/${derby.testing.functest.dir}/tests/unit"/> 
     <ant dir="${derby.testing.src.dir}/${derby.testing.functest.dir}/tests/i18n"/> 
     <ant dir="${derby.testing.src.dir}/${derby.testing.functest.dir}/tests/jdbc4"/> 
+    <ant dir="${derby.testing.src.dir}/${derby.testing.functest.dir}/tests/perf"/> 
   	<ant dir="${derby.testing.src.dir}/${derby.testing.functest.dir}/tests/upgradeTests"/> 
     <ant dir="${derby.testing.src.dir}/${derby.testing.functest.dir}/tests/largedata"/> 
     <ant dir="${derby.testing.src.dir}/${derby.testing.functest.dir}/multi/stress"/> 

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/blobclob4BLOB.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/blobclob4BLOB.out?rev=432658&r1=432657&r2=432658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/blobclob4BLOB.out (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/blobclob4BLOB.out Fri Aug 18 10:37:49 2006
@@ -464,7 +464,6 @@
 START: clobTest53
 clobTest53 finished
 START: clobTest54
-java.lang.StringIndexOutOfBoundsException: String index out of range: -1
 EXPECTED SQLSTATE(22018): Invalid character string format for type INTEGER.
 end clobTest54
 START: clobTest6
@@ -474,6 +473,7 @@
 EXPECTED SQLSTATE(null): Invalid position 0 or length 0
 FAIL -- unexpected exception:java.lang.StringIndexOutOfBoundsException: String index out of range: -1
 START: clobTest7
+java.lang.StringIndexOutOfBoundsException: String index out of range: -1
 clobTest7 finished
 START: clobTest8
 small string pattern
@@ -773,7 +773,6 @@
 blobTest53 finished
 START: blobTest54
 EXPECTED SQLSTATE(XCL12): An attempt was made to put a data value of type 'byte[]' into a data value of type 'INTEGER'.
-java.lang.NegativeArraySizeException
 blobTest54 finished
 START: blobTest6
 EXPECTED SQLSTATE(null): Invalid position 0 or length 5
@@ -782,6 +781,7 @@
 EXPECTED SQLSTATE(null): Invalid position 0 or length 0
 FAIL -- unexpected exception:java.lang.NegativeArraySizeException
 START: blobTest7
+java.lang.NegativeArraySizeException
 blobTest7 finished
 START: blobTest8Trigger
 FAIL -- unexpected exception ****************

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/derbyrunjartest.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/derbyrunjartest.out?rev=432658&r1=432657&r2=432658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/derbyrunjartest.out (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/derbyrunjartest.out Fri Aug 18 10:37:49 2006
@@ -1,7 +1,7 @@
 ij --help:
 Usage: java org.apache.derby.tools.ij [-p propertyfile] [-ca connectionAttributePropertyFile] [inputfile]
 sysinfo -cp help:
-USAGE: java org.apache.derby.tools.sysinfo -cp [ [ embedded ][ server ][ client] [ tools ] [  anyClass.class ] ]
+USAGE: java org.apache.derby.tools.sysinfo -cp [ [ embedded ][ server ][ client] [ db2driver ] [ tools ] [  anyClass.class ] ]
 dblook:
  USAGE:
  java org.apache.derby.tools.dblook -d <sourceDBUrl> [OPTIONS]

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/subquery.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/subquery.out?rev=432658&r1=432657&r2=432658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/subquery.out (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/subquery.out Fri Aug 18 10:37:49 2006
@@ -1645,4 +1645,28 @@
 0 rows inserted/updated/deleted
 ij> drop table t4;
 0 rows inserted/updated/deleted
+ij> -- DERBY-1574: Subquery in COALESCE gives NPE due
+-- to preprocess not implemented for that node type
+create table t1 (id int);
+0 rows inserted/updated/deleted
+ij> create table t2 (i integer primary key, j int);
+0 rows inserted/updated/deleted
+ij> insert into t1 values 1,2,3,4,5;
+5 rows inserted/updated/deleted
+ij> insert into t2 values (1,1),(2,4),(3,9),(4,16);
+4 rows inserted/updated/deleted
+ij> update t1 set id = coalesce((select j from t2 where t2.i=t1.id), 0);
+5 rows inserted/updated/deleted
+ij> select * from t1;
+ID         
+-----------
+1          
+4          
+9          
+16         
+0          
+ij> drop table t1;
+0 rows inserted/updated/deleted
+ij> drop table t2;
+0 rows inserted/updated/deleted
 ij> 

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/subquery2.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/subquery2.out?rev=432658&r1=432657&r2=432658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/subquery2.out (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/subquery2.out Fri Aug 18 10:37:49 2006
@@ -1020,4 +1020,73 @@
 0 rows inserted/updated/deleted
 ij> drop table w_2;
 0 rows inserted/updated/deleted
+ij> -- DERBY-634: Dynamic subquery materialization can cause stack overflow
+create table parentT ( i int, j int, k int);
+0 rows inserted/updated/deleted
+ij> create table childT ( i int, j int, k int);
+0 rows inserted/updated/deleted
+ij> -- Load some data
+insert into parentT values (1,1,1), (2,2,2), (3,3,3), (4,4,4);
+4 rows inserted/updated/deleted
+ij> insert into parentT select i+4, j+4, k+4 from parentT;
+4 rows inserted/updated/deleted
+ij> insert into parentT select i+8, j+8, k+8 from parentT;
+8 rows inserted/updated/deleted
+ij> insert into parentT select i+16, j+16, k+16 from parentT;
+16 rows inserted/updated/deleted
+ij> insert into parentT select i+32, j+32, k+32 from parentT;
+32 rows inserted/updated/deleted
+ij> insert into parentT select i+64, j+64, k+64 from parentT;
+64 rows inserted/updated/deleted
+ij> insert into parentT select i+128, j+128, k+128 from parentT;
+128 rows inserted/updated/deleted
+ij> insert into parentT select i+256, j+256, k+256 from parentT;
+256 rows inserted/updated/deleted
+ij> insert into parentT select i+512, j+512, k+512 from parentT;
+512 rows inserted/updated/deleted
+ij> insert into parentT select i+1024, j+1024, k+1024 from parentT;
+1024 rows inserted/updated/deleted
+ij> insert into parentT select i+2048, j+2048, k+2048 from parentT;
+2048 rows inserted/updated/deleted
+ij> insert into parentT select i+4096, j+4096, k+4096 from parentT;
+4096 rows inserted/updated/deleted
+ij> insert into parentT select i+8192, j+8192, k+8192 from parentT;
+8192 rows inserted/updated/deleted
+ij> -- Try with three different sizes of subquery results.
+update parentT set j = j /10;
+16384 rows inserted/updated/deleted
+ij> update parentT set k = k /100;
+16384 rows inserted/updated/deleted
+ij> create unique index parentIdx on parentT(i);
+0 rows inserted/updated/deleted
+ij> insert into childT select * from parentT;
+16384 rows inserted/updated/deleted
+ij> select count(*) from parentT where i < 10 and i not in (select i from childT);
+1          
+-----------
+0          
+ij> select count(*) from parentT where i< 10 and exists (select i from childT where childT.i=parentT.i);
+1          
+-----------
+9          
+ij> select count(*) from parentT where i< 10 and j not in (select distinct j from childT);
+1          
+-----------
+0          
+ij> select count(*) from parentT where i< 10 and exists (select distinct j from childT where childT.j=parentT.j);
+1          
+-----------
+9          
+ij> select count(*) from parentT where i< 10 and k not in (select distinct k from childT);
+1          
+-----------
+0          
+ij> select count(*) from parentT where i< 10 and exists (select distinct k from childT where childT.k=parentT.k);
+1          
+-----------
+9          
+ij> drop table childT;
+0 rows inserted/updated/deleted
+ij> drop table parentT;
+0 rows inserted/updated/deleted
 ij> 

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/triggerGeneral.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/triggerGeneral.out?rev=432658&r1=432657&r2=432658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/triggerGeneral.out (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/triggerGeneral.out Fri Aug 18 10:37:49 2006
@@ -842,12 +842,10 @@
 create trigger tgood after insert on x for each statement mode db2sql insert into x values 666;
 0 rows inserted/updated/deleted
 ij> insert into x values 1;
-1 row inserted/updated/deleted
+ERROR 54038: Maximum depth of nested triggers was exceeded.
 ij> select * from x;
 X          
 -----------
-1          
-666        
 ij> drop trigger tgood;
 0 rows inserted/updated/deleted
 ij> create trigger tgood after insert on x for each statement mode db2sql delete from x;
@@ -875,46 +873,36 @@
 for each statement mode db2sql insert into x values (666), (999), (333);
 0 rows inserted/updated/deleted
 ij> insert into x values 1;
-1 row inserted/updated/deleted
+ERROR 54038: Maximum depth of nested triggers was exceeded.
 ij> select * from x order by 1;
 X          
 -----------
-1          
-333        
-666        
-999        
 ij> drop trigger tgood;
 0 rows inserted/updated/deleted
 ij> delete from x;
-4 rows inserted/updated/deleted
+0 rows inserted/updated/deleted
 ij> create trigger tgood after insert on x
 referencing new as n
 for each row mode db2sql insert into x values (n.x);
 0 rows inserted/updated/deleted
 ij> insert into x values 7;
-1 row inserted/updated/deleted
+ERROR 54038: Maximum depth of nested triggers was exceeded.
 ij> select * from x order by 1;
 X          
 -----------
-7          
-7          
 ij> drop trigger tgood;
 0 rows inserted/updated/deleted
 ij> delete from x;
-2 rows inserted/updated/deleted
+0 rows inserted/updated/deleted
 ij> create trigger tgood after insert on x
 referencing new as n
 for each row mode db2sql insert into x values (333), (999), (333);
 0 rows inserted/updated/deleted
 ij> insert into x values 1;
-1 row inserted/updated/deleted
+ERROR 54038: Maximum depth of nested triggers was exceeded.
 ij> select * from x order by 1;
 X          
 -----------
-1          
-333        
-333        
-999        
 ij> drop trigger tgood;
 0 rows inserted/updated/deleted
 ij> -- DERBY-1204 trigger causes StringIndexOutOfBoundsException
@@ -1133,4 +1121,19 @@
 -----------
 0          
 1          
+ij> -- DERBY-1652
+create table test (testid integer not null 
+    generated always as identity (start with 1, increment by 1), 
+    info integer not null, ts timestamp not null default '1980-01-01-00.00.00.000000');
+0 rows inserted/updated/deleted
+ij> create trigger update_test 
+    after update on test 
+    referencing old as old 
+    for each row mode db2sql 
+    update test set ts=current_timestamp where testid=old.testid;
+0 rows inserted/updated/deleted
+ij> insert into test(info) values (1),(2),(3);
+3 rows inserted/updated/deleted
+ij> UPDATE TEST SET INFO = 1 WHERE TESTID = 2;
+ERROR 54038: Maximum depth of nested triggers was exceeded.
 ij> 

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNet.exclude
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNet.exclude?rev=432658&r1=432657&r2=432658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNet.exclude (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNet.exclude Fri Aug 18 10:37:49 2006
@@ -35,14 +35,6 @@
 # excluding jdbcapi/derbyStress.java - jcc runs out of memory with this test
 jdbcapi/derbyStress.java
 largedata/LobLimits.java
-# These next five tests fail since the
-# db2 driver produces statements which Derby cannot compile in 
-# ResultSet.updateRow()
-jdbcapi/UpdateXXXTest.junit
-jdbcapi/SURQueryMixTest.junit
-jdbcapi/SURTest.junit
-jdbcapi/ConcurrencyTest.junit
-jdbcapi/HoldabilityTest.junit
 # Excluding checkDataSource and checkDataSource30 because JCC has no XA
 jdbcapi/checkDataSource30.java
 jdbcapi/checkDataSource.java

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/suites/jdbcapi.runall
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/suites/jdbcapi.runall?rev=432658&r1=432657&r2=432658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/suites/jdbcapi.runall (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/suites/jdbcapi.runall Fri Aug 18 10:37:49 2006
@@ -1,4 +1,3 @@
-jdbcapi/HoldabilityTest.junit
 jdbcapi/bestrowidentifier.sql
 jdbcapi/characterStreams.java
 jdbcapi/checkDriver.java
@@ -16,17 +15,12 @@
 jdbcapi/LOBTest.java
 jdbcapi/blobclob4BLOB.java
 jdbcapi/parameterMapping.java
-jdbcapi/ProcedureTest.junit
 jdbcapi/setTransactionIsolation.java
 jdbcapi/SetQueryTimeoutTest.java
 jdbcapi/prepStmtNull.java
 jdbcapi/testRelative.java
 jdbcapi/rsgetXXXcolumnNames.java
 jdbcapi/Stream.java
-jdbcapi/UpdateXXXTest.junit
-jdbcapi/SURQueryMixTest.junit
-jdbcapi/SURTest.junit
-jdbcapi/ScrollResultSetTest.junit
-jdbcapi/URCoveringIndexTest.junit
 jdbcapi/SURTest_ij.sql
 jdbcapi/ResultSetCloseTest.junit
+jdbcapi/_Suite.junit

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testProperties.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testProperties.java?rev=432658&r1=432657&r2=432658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testProperties.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testProperties.java Fri Aug 18 10:37:49 2006
@@ -23,6 +23,7 @@
 import java.sql.*;
 import java.util.Vector;
 import java.util.Properties;
+import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.BufferedOutputStream;
@@ -111,27 +112,43 @@
 									"-p",
 									"1527"};	
     /**
-	 * Execute the given command and dump the results to standard out
+	 * Execute the given command and optionally wait and dump the results to standard out
 	 *
 	 * @param args	command and arguments
-	 * @param wait  true =wait for completion
+	 * @param wait  true =wait for completion and dump output, false don't wait and
+     * ignore the output.
 	 * @exception Exception
 	 */
 
-	private static void execCmdDumpResults (String[] args) throws Exception
+	private static void execCmdDumpResults (String[] args, boolean wait) throws Exception
 	{
         // We need the process inputstream and errorstream
         ProcessStreamResult prout = null;
         ProcessStreamResult prerr = null;
             
+        System.out.flush();
+        bos.flush();
+        
+        BufferedOutputStream _bos = bos;
+        if (!wait) {
+            // not interested in the output, don't expect a huge amount.
+            // information will just be written to the byte array in
+            // memory and never used.
+            _bos = new BufferedOutputStream(new ByteArrayOutputStream());
+        }
 		// Start a process to run the command
 		Process pr = execCmd(args);
-        prout = new ProcessStreamResult(pr.getInputStream(), bos, null);
-        prerr = new ProcessStreamResult(pr.getErrorStream(), bos, null);
+        prout = new ProcessStreamResult(pr.getInputStream(), _bos, null);
+        prerr = new ProcessStreamResult(pr.getErrorStream(), _bos, null);
+        
+        if (!wait)
+            return;
 
 		// wait until all the results have been processed
 		prout.Wait();
 		prerr.Wait();
+        _bos.flush();
+        System.out.flush();
 
 	}
 
@@ -182,10 +199,8 @@
 			 {portString,"org.apache.derby.drda.NetworkServerControl", cmd};
 		else
 			cmdArr = new String[] {"org.apache.derby.drda.NetworkServerControl", cmd,"-p", portString};
-		if (!wait)
-			execCmd(cmdArr);
-		else 
-			execCmdDumpResults(cmdArr);
+		
+        execCmdDumpResults(cmdArr, wait);
 	}	
 	
 	private static void waitForStart(String portString, int timeToWait) throws Exception
@@ -278,23 +293,23 @@
 
 			//Shutdown the server started by test
 			derbyServerCmd("shutdown","1527");
-			execCmd(startServerCmd);
+            execCmdDumpResults(startServerCmd, false);
 			waitForStart("1527",15000);
 			//check that default properties are used
 			listProperties("1527");
 			
 			//Test trace and logconnections commands
-			execCmdDumpResults(cmdTraceOn);
-			execCmdDumpResults(cmdLogconnectionsOn);
+			execCmdDumpResults(cmdTraceOn, true);
+			execCmdDumpResults(cmdLogconnectionsOn, true);
 			listProperties("1527");
-			execCmdDumpResults(cmdTraceOff);
+			execCmdDumpResults(cmdTraceOff, true);
 			listProperties("1527");
 			derbyServerCmd("shutdown","1527");
 			
 			//Test error conditions in command-line
-			execCmdDumpResults(cmdWithoutArgs);
-			execCmdDumpResults(cmdUnknown);
-			execCmdDumpResults(cmdWithWrongArgNum);
+			execCmdDumpResults(cmdWithoutArgs, true);
+			execCmdDumpResults(cmdUnknown, true);
+			execCmdDumpResults(cmdWithWrongArgNum, true);
 			
 			System.out.println("End test");
 			bos.close();

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testSecMec.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testSecMec.java?rev=432658&r1=432657&r2=432658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testSecMec.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testSecMec.java Fri Aug 18 10:37:49 2006
@@ -239,8 +239,10 @@
 		        }
 		        
 		        // Wait for the NetworkServer to start.
-		        if (!isServerStarted(networkServer, 60))
-		            System.exit(-1);
+		        if (!isServerStarted(networkServer, 60)) {
+                    System.out.println("FAIL: Server failed to respond to ping - ending test");
+                    break;
+                }
 		    }
 		    
 		    // Now, go ahead and run the test.

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ConcurrencyTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ConcurrencyTest.java?rev=432658&r1=432657&r2=432658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ConcurrencyTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ConcurrencyTest.java Fri Aug 18 10:37:49 2006
@@ -814,6 +814,11 @@
     
     public static Test suite() {
         TestSuite suite = new TestSuite();
+        
+        // DB2 client doesn't support this functionality
+        if (usingDerbyNet())
+            return suite;
+
                 
         // Requires holdability
         if (JDBC.vmSupportsJDBC3() || JDBC.vmSupportsJSR169()) {

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/HoldabilityTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/HoldabilityTest.java?rev=432658&r1=432657&r2=432658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/HoldabilityTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/HoldabilityTest.java Fri Aug 18 10:37:49 2006
@@ -30,6 +30,19 @@
     public HoldabilityTest(String name) {
         super(name, 1000); // We will use 1000 records
     }
+    
+    public static Test suite() {
+        TestSuite suite = new TestSuite();
+               
+        // DB2 client doesn't support this functionality
+        if (usingDerbyNet())
+            return suite;
+        
+        suite.addTestSuite(HoldabilityTest.class);
+        
+        return suite;
+
+    }
 
     /**
      * Sets up the connection, then create the data model

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURQueryMixTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURQueryMixTest.java?rev=432658&r1=432657&r2=432658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURQueryMixTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURQueryMixTest.java Fri Aug 18 10:37:49 2006
@@ -539,6 +539,11 @@
     {   
         TestSuite mainSuite = new TestSuite();
         
+        // DB2 client doesn't support this functionality
+        if (usingDerbyNet())
+            return mainSuite;
+  
+        
         // Iterate over all data models and decorate the tests:
         for (Iterator i = SURDataModelSetup.SURDataModel.values().iterator();
              i.hasNext();) {

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURTest.java?rev=432658&r1=432657&r2=432658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURTest.java Fri Aug 18 10:37:49 2006
@@ -1527,6 +1527,10 @@
         
         TestSuite mainSuite = new TestSuite();
         
+        // DB2 client doesn't support this functionality
+        if (usingDerbyNet())
+            return mainSuite;
+        
         // Iterate over all data models and decorate the tests:
         for (Iterator i = SURDataModelSetup.SURDataModel.values().iterator();
              i.hasNext();) {

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/UpdateXXXTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/UpdateXXXTest.java?rev=432658&r1=432657&r2=432658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/UpdateXXXTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/UpdateXXXTest.java Fri Aug 18 10:37:49 2006
@@ -53,6 +53,10 @@
     public static Test suite() {
         TestSuite suite = new TestSuite();
         
+        // DB2 client doesn't support this functionality
+        if (usingDerbyNet())
+            return suite;
+        
         suite.addTest(new UpdateXXXTest("testUpdateShort"));
         suite.addTest(new UpdateXXXTest("testUpdateInt"));
         suite.addTest(new UpdateXXXTest("testUpdateLong"));

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java?rev=432658&r1=432657&r2=432658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java Fri Aug 18 10:37:49 2006
@@ -46,7 +46,7 @@
 		TestSuite suite = new TestSuite("jdbcapi");
 
 		suite.addTest(ConcurrencyTest.suite());
-		suite.addTestSuite(HoldabilityTest.class);
+		suite.addTest(HoldabilityTest.suite());
 		suite.addTest(ProcedureTest.suite());
 		suite.addTest(SURQueryMixTest.suite());
 		suite.addTest(SURTest.suite());

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/subquery.sql
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/subquery.sql?rev=432658&r1=432657&r2=432658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/subquery.sql (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/subquery.sql Fri Aug 18 10:37:49 2006
@@ -525,3 +525,18 @@
 drop table t2;
 drop table t3;
 drop table t4;
+
+-- DERBY-1574: Subquery in COALESCE gives NPE due
+-- to preprocess not implemented for that node type
+create table t1 (id int);
+create table t2 (i integer primary key, j int);
+
+insert into t1 values 1,2,3,4,5;
+insert into t2 values (1,1),(2,4),(3,9),(4,16);
+ 
+update t1 set id = coalesce((select j from t2 where t2.i=t1.id), 0);
+select * from t1;
+
+drop table t1;
+drop table t2;
+

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/subquery2.sql
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/subquery2.sql?rev=432658&r1=432657&r2=432658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/subquery2.sql (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/subquery2.sql Fri Aug 18 10:37:49 2006
@@ -337,3 +337,45 @@
 drop table v_empty;
 drop table w_2;
 
+-- DERBY-634: Dynamic subquery materialization can cause stack overflow
+
+create table parentT ( i int, j int, k int);
+create table childT ( i int, j int, k int);
+
+-- Load some data
+insert into parentT values (1,1,1), (2,2,2), (3,3,3), (4,4,4);
+insert into parentT select i+4, j+4, k+4 from parentT;
+insert into parentT select i+8, j+8, k+8 from parentT;
+insert into parentT select i+16, j+16, k+16 from parentT;
+insert into parentT select i+32, j+32, k+32 from parentT;
+insert into parentT select i+64, j+64, k+64 from parentT;
+insert into parentT select i+128, j+128, k+128 from parentT;
+insert into parentT select i+256, j+256, k+256 from parentT;
+insert into parentT select i+512, j+512, k+512 from parentT;
+insert into parentT select i+1024, j+1024, k+1024 from parentT;
+insert into parentT select i+2048, j+2048, k+2048 from parentT;
+insert into parentT select i+4096, j+4096, k+4096 from parentT;
+insert into parentT select i+8192, j+8192, k+8192 from parentT;
+
+-- Try with three different sizes of subquery results.
+update parentT set j = j /10;
+update parentT set k = k /100;
+create unique index parentIdx on parentT(i);
+
+insert into childT select * from parentT;
+
+select count(*) from parentT where i < 10 and i not in (select i from childT);
+
+select count(*) from parentT where i< 10 and exists (select i from childT where childT.i=parentT.i);
+
+select count(*) from parentT where i< 10 and j not in (select distinct j from childT);
+
+select count(*) from parentT where i< 10 and exists (select distinct j from childT where childT.j=parentT.j);
+
+select count(*) from parentT where i< 10 and k not in (select distinct k from childT);
+
+select count(*) from parentT where i< 10 and exists (select distinct k from childT where childT.k=parentT.k);
+
+drop table childT;
+drop table parentT;
+

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/triggerGeneral.sql
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/triggerGeneral.sql?rev=432658&r1=432657&r2=432658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/triggerGeneral.sql (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/triggerGeneral.sql Fri Aug 18 10:37:49 2006
@@ -625,3 +625,15 @@
 SELECT * FROM T10642;
 SELECT * FROM T10641_DELETIONS;
 SELECT * FROM T10642_DELETIONS;
+
+-- DERBY-1652
+create table test (testid integer not null 
+    generated always as identity (start with 1, increment by 1), 
+    info integer not null, ts timestamp not null default '1980-01-01-00.00.00.000000');
+create trigger update_test 
+    after update on test 
+    referencing old as old 
+    for each row mode db2sql 
+    update test set ts=current_timestamp where testid=old.testid;
+insert into test(info) values (1),(2),(3);
+UPDATE TEST SET INFO = 1 WHERE TESTID = 2;

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/updatableResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/updatableResultSet.java?rev=432658&r1=432657&r2=432658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/updatableResultSet.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/updatableResultSet.java Fri Aug 18 10:37:49 2006
@@ -1291,7 +1291,7 @@
 			rs.next();
 			System.out.println("column 1 on this row is " + rs.getInt(1));
 			System.out.println("this update row will fire the update trigger which will update all the rows in the table to have c1=1 and hence no more rows will qualify for the resultset");
-			rs.updateLong(1,123);
+			rs.updateLong(2,2);
 			rs.updateRow();
 			rs.next();
 			try {
@@ -3109,9 +3109,9 @@
 		stmt.executeUpdate("create trigger tr1 after delete on table0WithTriggers for each statement mode db2sql insert into deleteTriggerInsertIntoThisTable values (1)");
 		stmt.executeUpdate("create trigger tr2 after update on table0WithTriggers for each statement mode db2sql insert into updateTriggerInsertIntoThisTable values (1)");
 		stmt.executeUpdate("create table table1WithTriggers (c1 int, c2 bigint)");
-		stmt.executeUpdate("create trigger tr3 after delete on table1WithTriggers for each statement mode db2sql delete from table1WithTriggers");
+		stmt.executeUpdate("create trigger tr3 after delete on table1WithTriggers referencing old as old for each row mode db2sql delete from table1WithTriggers where c1=old.c1+1 or c1=old.c1-1");
 		stmt.executeUpdate("create table table2WithTriggers (c1 int, c2 bigint)");
-		stmt.executeUpdate("create trigger tr4 after update on table2WithTriggers for each statement mode db2sql update table2WithTriggers set c1=1");
+		stmt.executeUpdate("create trigger tr4 after update of c2 on table2WithTriggers for each statement mode db2sql update table2WithTriggers set c1=1");
 		stmt.executeUpdate("create table selfReferencingT1 (c1 char(2) not null, c2 char(2), constraint selfReferencingT1 primary key(c1), constraint manages1 foreign key(c2) references selfReferencingT1(c1) on delete cascade)");
 		stmt.executeUpdate("create table selfReferencingT2 (c1 char(2) not null, c2 char(2), constraint selfReferencingT2 primary key(c1), constraint manages2 foreign key(c2) references selfReferencingT2(c1) on update restrict)");
 

Modified: db/derby/code/branches/10.2/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java?rev=432658&r1=432657&r2=432658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java (original)
+++ db/derby/code/branches/10.2/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java Fri Aug 18 10:37:49 2006
@@ -454,12 +454,13 @@
 
 	private static final String NET = "server";
 	private static final String CLIENT = "client";
+	private static final String DB2DRIVER = "db2driver";
 
 	/* you can add this if you like */
 
 	private static final String MAINUSAGESTRING = "java org.apache.derby.tools.sysinfo -cp";
 
-	private static final String USAGESTRINGPARTA = MAINUSAGESTRING + " [ [ " + EMBEDDED + " ][ " + NET + " ][ " + CLIENT + "] [ " + TOOLS + " ] [ ";
+	private static final String USAGESTRINGPARTA = MAINUSAGESTRING + " [ [ " + EMBEDDED + " ][ " + NET + " ][ " + CLIENT + "] [ " + DB2DRIVER + " ] [ " + TOOLS + " ] [ ";
     private static final String USAGESTRINGPARTB = ".class ] ]";
 
   static  void useMe(String[] args, java.io.PrintWriter pw) {
@@ -507,6 +508,7 @@
 		  tryCoreClasspath(successes, failures);
 		  tryNetClasspath(successes, failures);
 		  tryClientClasspath(successes, failures);
+		  tryDB2DriverClasspath(successes, failures);
 		  tryUtilsClasspath(successes, failures);
 		  localPW.println(successes.toString());
 		  if (!failures.toString().equals(crLf() + Main.getTextMessage("SIF08.E") + crLf())) {
@@ -542,6 +544,10 @@
 			seenArg =true;
 
 		}
+		if (argumentsContain(args,DB2DRIVER)) {
+			tryDB2DriverClasspath(successes, failures);
+			seenArg =true;
+		}
 
 		if (argumentsContain(args,TOOLS) || argumentsContain(args,"utils")) {
 		  tryUtilsClasspath(successes, failures);
@@ -584,9 +590,15 @@
 		tryMyClasspath("org.apache.derby.drda.NetworkServerControl", Main.getTextMessage("SIF08.I", "derbynet.jar"), successes, failures);
 	}
 	private static void tryClientClasspath(StringBuffer successes, StringBuffer failures) {
-		tryMyClasspath("com.ibm.db2.jcc.DB2Driver", Main.getTextMessage("SIF08.L", "db2jcc.jar"), successes, failures);
 		tryMyClasspath("org.apache.derby.jdbc.ClientDriver", Main.getTextMessage("SIF08.L", "derbyclient.jar"), successes, failures);
 	}
+    private static void tryDB2DriverClasspath(StringBuffer successes,
+            StringBuffer failures)
+    {
+        tryMyClasspath("com.ibm.db2.jcc.DB2Driver",
+                Main.getTextMessage("SIF08.L", "db2jcc.jar"),
+                successes, failures);
+    }
 
 	private static void tryUtilsClasspath(StringBuffer successes, StringBuffer failures) {
 		tryMyClasspath("org.apache.derby.tools.ij", Main.getTextMessage("SIF08.Q", "derbytools.jar"), successes, failures);



Mime
View raw message