<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>derby-commits@db.apache.org Archives</title>
<link rel="self" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/?format=atom"/>
<link href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/"/>
<id>http://mail-archives.apache.org/mod_mbox/db-derby-commits/</id>
<updated>2009-12-10T04:26:11Z</updated>
<entry>
<title>svn commit: r888881 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby151Test.java</title>
<author><name>dag@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091209172528.8039823888C5@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091209172528-8039823888C5@eris-apache-org%3e</id>
<updated>2009-12-09T17:25:28Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: dag
Date: Wed Dec  9 17:25:28 2009
New Revision: 888881

URL: http://svn.apache.org/viewvc?rev=888881&amp;view=rev
Log:
DERBY-4463 JMX test in nightly test suite failed with: JMXTest:clientjava.lang.InterruptedException:

Patch derby-4463.diff, which moves the clearing of the interrupted
flag in Derby151Test to the teardown method of the test so it will
always be performed.


Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby151Test.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby151Test.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby151Test.java?rev=888881&amp;r1=888880&amp;r2=888881&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby151Test.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby151Test.java
Wed Dec  9 17:25:28 2009
@@ -98,6 +98,13 @@
     protected void tearDown()
             throws java.lang.Exception {
 
+        // Clearing the interrupt flag; makes sense for embedded part of
+        // the test. When running c/s, it would be the server thread which
+        // receives the interrupt, and since db is shut down, that should
+        // be ok for later tests. We need to clear the flag here since, for
+        // embedded, the app thread is affected.
+        Thread.currentThread().interrupted();
+
         Statement stmt = createStatement();
         stmt.executeUpdate("DROP TABLE d151");
         stmt.close();
@@ -150,12 +157,6 @@
             println("Not able to test fix for DERBY-151: No interrupt seen");
         } catch (SQLException e) {
             assertSQLState("XSDG9", e);
-            // Clearing the interrupt flag; makes sense for embedded part of
-            // the test. When running c/s, it would be the server thread which
-            // receives the interrupt, and since db is shut down, that should
-            // be ok for later tests. We need to clear the flag here since, for
-            // embedded, the app thread is affected.
-            Thread.currentThread().interrupted();
         }
     }
 }




</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r888811 - in /db/derby/code/trunk/java: engine/org/apache/derby/catalog/types/ engine/org/apache/derby/iapi/sql/depend/ engine/org/apache/derby/iapi/sql/dictionary/ engine/org/apache/derby/impl/sql/catalog/ engine/org/apache/derby/impl/sql/...</title>
<author><name>rhillegas@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091209142249.6BB6923889B8@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091209142249-6BB6923889B8@eris-apache-org%3e</id>
<updated>2009-12-09T14:22:48Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: rhillegas
Date: Wed Dec  9 14:22:46 2009
New Revision: 888811

URL: http://svn.apache.org/viewvc?rev=888811&amp;view=rev
Log:
DERBY-651: Add dependency tracking between tables and UDTs.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/BaseTypeIdImpl.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/depend/DependencyManager.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/AliasDescriptor.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AlterTableNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnDefinitionNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateTableNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/depend/BasicDependencyManager.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateTableConstantAction.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DDLConstantAction.java
    db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml
    db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
    db/derby/code/trunk/java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UDTTest.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/BaseTypeIdImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/BaseTypeIdImpl.java?rev=888811&amp;r1=888810&amp;r2=888811&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/BaseTypeIdImpl.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/BaseTypeIdImpl.java Wed
Dec  9 14:22:46 2009
@@ -148,6 +148,9 @@
      */
     public String getUnqualifiedName() { return unqualifiedName; }
 
+    /** Return true if this is this type id describes an ANSI UDT */
+    public boolean isAnsiUDT() { return (schemaName != null); }
+    
     /**
      * Get the jdbc type id for this type.  JDBC type can be
      * found in java.sql.Types. 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/depend/DependencyManager.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/depend/DependencyManager.java?rev=888811&amp;r1=888810&amp;r2=888811&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/depend/DependencyManager.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/depend/DependencyManager.java
Wed Dec  9 14:22:46 2009
@@ -337,6 +337,8 @@
 
     public static final int DROP_SEQUENCE = 49;
 
+    public static final int DROP_UDT = 50;
+
     /**
      * Extensions to this interface may use action codes &gt; MAX_ACTION_CODE without fear
of
      * clashing with action codes in this base interface.

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/AliasDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/AliasDescriptor.java?rev=888811&amp;r1=888810&amp;r2=888811&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/AliasDescriptor.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/AliasDescriptor.java
Wed Dec  9 14:22:46 2009
@@ -380,6 +380,10 @@
         case AliasInfo.ALIAS_TYPE_SYNONYM_AS_CHAR:
             invalidationType = DependencyManager.DROP_SYNONYM;
             break;
+            
+        case AliasInfo.ALIAS_TYPE_UDT_AS_CHAR:
+            invalidationType = DependencyManager.DROP_UDT;
+            break;
         }
         
         dm.invalidateFor(this, invalidationType, lcc);

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java?rev=888811&amp;r1=888810&amp;r2=888811&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java
Wed Dec  9 14:22:46 2009
@@ -1475,6 +1475,16 @@
 	 */
 	UUIDFactory getUUIDFactory();
 
+    /**
+     * Get the alias descriptor for an ANSI UDT.
+     *
+     * @param tc The transaction to use: if null, use the compilation transaction
+     * @param dtd The UDT's type descriptor
+     *
+     * @return The UDT's alias descriptor if it is an ANSI UDT; null otherwise.
+     */
+    public AliasDescriptor getAliasDescriptorForUDT( TransactionController tc, DataTypeDescriptor
dtd ) throws StandardException;
+    
 	/**
 	 * Get an AliasDescriptor given its UUID.
 	 *

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java?rev=888811&amp;r1=888810&amp;r2=888811&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java
Wed Dec  9 14:22:46 2009
@@ -30,10 +30,14 @@
 import org.apache.derby.catalog.DependableFinder;
 import org.apache.derby.catalog.UUID;
 import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.reference.SQLState;
 import org.apache.derby.iapi.services.io.FormatableBitSet;
 import org.apache.derby.iapi.services.io.StoredFormatIds;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.sql.StatementType;
+import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
+import org.apache.derby.iapi.sql.depend.DependencyManager;
+import org.apache.derby.iapi.sql.depend.Dependent;
 import org.apache.derby.iapi.sql.depend.Provider;
 import org.apache.derby.iapi.sql.execute.ExecRow;
 import org.apache.derby.iapi.types.DataValueDescriptor;
@@ -83,7 +87,7 @@
 	*/
 
 public class TableDescriptor extends TupleDescriptor
-	implements UniqueSQLObjectDescriptor, Provider
+	implements UniqueSQLObjectDescriptor, Provider, Dependent
 {
 	public static final int BASE_TABLE_TYPE = 0;
 	public static final int SYSTEM_TABLE_TYPE = 1;
@@ -1383,4 +1387,79 @@
 	{
 		return (tableType == TableDescriptor.SYNONYM_TYPE) ? "Synonym" : "Table/View";
 	}
+
+	//////////////////////////////////////////////////////
+	//
+	// DEPENDENT INTERFACE
+	//
+	//////////////////////////////////////////////////////
+	/**
+	 * Check that all of the dependent's dependencies are valid.
+	 *
+	 * @return true if the dependent is currently valid
+	 */
+	public synchronized boolean isValid()
+	{
+		return true;
+	}
+
+	/**
+	 * Prepare to mark the dependent as invalid (due to at least one of
+	 * its dependencies being invalid).
+	 *
+	 * @param action	The action causing the invalidation
+	 * @param p		the provider
+	 *
+	 * @exception StandardException thrown if unable to make it invalid
+	 */
+	public void prepareToInvalidate(Provider p, int action,
+					LanguageConnectionContext lcc) 
+		throws StandardException
+	{
+		DependencyManager dm = getDataDictionary().getDependencyManager();
+
+		switch (action)
+		{
+			/*
+			** Currently, the only thing we are dependent
+			** on is an alias descriptor for an ANSI UDT.
+			*/
+		    default:
+
+				throw StandardException.newException(SQLState.LANG_PROVIDER_HAS_DEPENDENT_TABLE, 
+									dm.getActionString(action), 
+									p.getObjectName(),
+									getQualifiedName());
+		}
+	}
+
+	/**
+	 * Mark the dependent as invalid (due to at least one of
+	 * its dependencies being invalid).  Always an error
+	 * for a table -- should never have gotten here.
+	 *
+	 * @param	action	The action causing the invalidation
+	 *
+	 * @exception StandardException thrown if called in sanity mode
+	 */
+	public void makeInvalid(int action, LanguageConnectionContext lcc) 
+		throws StandardException
+	{
+		/* 
+		** We should never get here, we should have barfed on 
+		** prepareToInvalidate().
+		*/
+		if (SanityManager.DEBUG)
+		{
+			DependencyManager dm;
+	
+			dm = getDataDictionary().getDependencyManager();
+
+			SanityManager.THROWASSERT("makeInvalid("+
+				dm.getActionString(action)+
+				") not expected to get called");
+		}
+	}
+    
 }
+

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java?rev=888811&amp;r1=888810&amp;r2=888811&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
Wed Dec  9 14:22:46 2009
@@ -134,6 +134,7 @@
 import org.apache.derby.catalog.DefaultInfo;
 import org.apache.derby.catalog.TypeDescriptor;
 import org.apache.derby.catalog.UUID;
+import org.apache.derby.catalog.types.BaseTypeIdImpl;
 import org.apache.derby.catalog.types.RoutineAliasInfo;
 
 import org.apache.derby.iapi.services.io.FormatableBitSet;
@@ -6675,8 +6676,6 @@
 			ddlList,
 			false);
 
-
-
 		return ddlList;
 	}
 
@@ -6827,6 +6826,30 @@
 		return uuidFactory;
 	}
 
+    /**
+     * Get the alias descriptor for an ANSI UDT.
+     *
+     * @param tc The transaction to use: if null, use the compilation transaction
+     * @param dtd The UDT's type descriptor
+     *
+     * @return The UDT's alias descriptor if it is an ANSI UDT; null otherwise.
+     */
+    public AliasDescriptor getAliasDescriptorForUDT( TransactionController tc, DataTypeDescriptor
dtd ) throws StandardException
+    {
+        if ( tc == null ) { tc = getTransactionCompile(); }
+
+        if ( dtd == null ) { return null; }
+
+        BaseTypeIdImpl btii = dtd.getTypeId().getBaseTypeId();
+        if ( !btii.isAnsiUDT() ) { return null; }
+
+        SchemaDescriptor sd = getSchemaDescriptor( btii.getSchemaName(), tc, true );
+        AliasDescriptor ad = getAliasDescriptor
+            ( sd.getUUID().toString(), btii.getUnqualifiedName(), AliasInfo.ALIAS_NAME_SPACE_UDT_AS_CHAR
);
+
+        return ad;
+    }
+    
 	/**
 	 * Get a AliasDescriptor given its UUID.
 	 *
@@ -8310,7 +8333,7 @@
 		else
 		{
 			if (SanityManager.DEBUG)
-			{
+ 			{
 				SanityManager.ASSERT(! booting, "booting is expected to be false");
 			}
 			{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AlterTableNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AlterTableNode.java?rev=888811&amp;r1=888810&amp;r2=888811&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AlterTableNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AlterTableNode.java
Wed Dec  9 14:22:46 2009
@@ -30,6 +30,8 @@
 import org.apache.derby.iapi.error.StandardException;
 
 import org.apache.derby.iapi.sql.compile.C_NodeTypes;
+import org.apache.derby.iapi.sql.compile.Visitable;
+import org.apache.derby.iapi.sql.compile.Visitor;
 
 import org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor;
 import org.apache.derby.iapi.sql.dictionary.ConstraintDescriptorList;
@@ -566,6 +568,24 @@
 	}
 
 
+	/**
+	 * Accept the visitor for all visitable children of this node.
+	 * 
+	 * @param v the visitor
+	 *
+	 * @exception StandardException on error
+	 */
+	void acceptChildren(Visitor v)
+		throws StandardException
+	{
+		super.acceptChildren(v);
+
+		if (tableElementList != null)
+		{
+			tableElementList.accept(v);
+		}
+	}
+
 	/*
 	 * class interface
 	 */

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnDefinitionNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnDefinitionNode.java?rev=888811&amp;r1=888810&amp;r2=888811&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnDefinitionNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ColumnDefinitionNode.java
Wed Dec  9 14:22:46 2009
@@ -199,7 +199,7 @@
 	{
 		if (SanityManager.DEBUG)
 		{
-			return "type: " + getType().toString() + "\n" +
+			return "type: " + getType() + "\n" +
 				"defaultValue: " + defaultValue + "\n" +
 				super.toString();
 		}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateTableNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateTableNode.java?rev=888811&amp;r1=888810&amp;r2=888811&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateTableNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateTableNode.java
Wed Dec  9 14:22:46 2009
@@ -38,6 +38,8 @@
 
 import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 import org.apache.derby.iapi.sql.compile.CompilerContext;
+import org.apache.derby.iapi.sql.compile.Visitable;
+import org.apache.derby.iapi.sql.compile.Visitor;
 import org.apache.derby.iapi.sql.conn.Authorizer;
 
 import org.apache.derby.iapi.error.StandardException;
@@ -563,4 +565,23 @@
                 onCommitDeleteRows,
                 onRollbackDeleteRows));
 	}
+
+	/**
+	 * Accept the visitor for all visitable children of this node.
+	 * 
+	 * @param v the visitor
+	 *
+	 * @exception StandardException on error
+	 */
+	void acceptChildren(Visitor v)
+		throws StandardException
+	{
+		super.acceptChildren(v);
+
+		if (tableElementList != null)
+		{
+			tableElementList.accept(v);
+		}
+	}
+    
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java?rev=888811&amp;r1=888810&amp;r2=888811&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java
Wed Dec  9 14:22:46 2009
@@ -224,8 +224,9 @@
 					ModifyColumnNode mcdn = (ModifyColumnNode)cdn;
 					mcdn.checkExistingConstraints(td);
 					mcdn.useExistingCollation(td);
+
 				} else if (cdn.isAutoincrementColumn())
-					numAutoCols ++;
+                { numAutoCols ++; }
 			}
 			else if (tableElement.getElementType() == TableElementNode.AT_DROP_COLUMN)
 			{
@@ -483,9 +484,12 @@
 		{
 			if (((TableElementNode) elementAt(index)).getElementType() == TableElementNode.AT_DROP_COLUMN)
 			{
+                String columnName = ((TableElementNode) elementAt(index)).getName();
+
 				colInfos[index] = new ColumnInfo(
-								((TableElementNode) elementAt(index)).getName(),
-								null, null, null, null, null, null,
+								columnName,
+								td.getColumnDescriptor( columnName ).getType(),
+                                null, null, null, null, null,
 								ColumnInfo.DROP, 0, 0, 0);
 				break;
 			}
@@ -521,7 +525,7 @@
                 DependencyManager dm = getDataDictionary().getDependencyManager();
                 providerInfos = dm.getPersistentProviderInfos(apl);
             }
-            
+
 			colInfos[index - numConstraints] = 
 				new ColumnInfo(coldef.getColumnName(),
 							   coldef.getType(),

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementNode.java?rev=888811&amp;r1=888810&amp;r2=888811&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementNode.java
Wed Dec  9 14:22:46 2009
@@ -22,6 +22,7 @@
 package	org.apache.derby.impl.sql.compile;
 
 import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.iapi.sql.compile.C_NodeTypes;
 
 /**
  * A TableElementNode is an item in a TableElementList, and represents
@@ -101,6 +102,7 @@
 		if (SanityManager.DEBUG)
 		{
 			return "name: " + name + "\n" +
+                "elementType: " + getElementType() + "\n" +
 				super.toString();
 		}
 		else
@@ -181,7 +183,11 @@
 		else if ( hasUniqueKeyConstraint() ) { return AT_ADD_UNIQUE_CONSTRAINT; }
 		else if ( hasCheckConstraint() ) { return AT_ADD_CHECK_CONSTRAINT; }
 		else if ( this instanceof ConstraintDefinitionNode ) { return AT_DROP_CONSTRAINT; }
-		else if ( this instanceof ModifyColumnNode ) { return AT_MODIFY_COLUMN; }
+		else if ( this instanceof ModifyColumnNode )
+        {
+            if ( getNodeType() == C_NodeTypes.DROP_COLUMN_NODE ) { return AT_DROP_COLUMN;
}
+            else { return AT_MODIFY_COLUMN; }
+        }
 		else { return elementType; }
 	}
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/depend/BasicDependencyManager.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/depend/BasicDependencyManager.java?rev=888811&amp;r1=888810&amp;r2=888811&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/depend/BasicDependencyManager.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/depend/BasicDependencyManager.java
Wed Dec  9 14:22:46 2009
@@ -264,6 +264,7 @@
 		throws StandardException
 	{
 		List list = getDependents(p);
+
 		if (list == null)
 		{
 			return;
@@ -889,6 +890,9 @@
             case DROP_SEQUENCE:
 				return "DROP SEQUENCE";
 
+            case DROP_UDT:
+				return "DROP TYPE";
+
             default:
 				if (SanityManager.DEBUG)
 				{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java?rev=888811&amp;r1=888810&amp;r2=888811&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
Wed Dec  9 14:22:46 2009
@@ -510,6 +510,9 @@
 			}
 		}
 
+        // adjust dependencies on user defined types
+        adjustUDTDependencies( lcc, dd, td, columnInfo );
+
 		/* Create/Drop any constraints */
 		if (constraintActions != null)
 		{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateTableConstantAction.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateTableConstantAction.java?rev=888811&amp;r1=888810&amp;r2=888811&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateTableConstantAction.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/CreateTableConstantAction.java
Wed Dec  9 14:22:46 2009
@@ -366,6 +366,11 @@
 		{
             addColumnDependencies( lcc, dd, td, columnInfo[ ix ] );
         }
+
+        //
+        // The table itself can depend on the user defined types of its columns.
+        //
+        adjustUDTDependencies( lcc, dd, td, columnInfo );
         
 		if ( tableType == TableDescriptor.GLOBAL_TEMPORARY_TABLE_TYPE )
 		{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DDLConstantAction.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DDLConstantAction.java?rev=888811&amp;r1=888810&amp;r2=888811&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DDLConstantAction.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DDLConstantAction.java
Wed Dec  9 14:22:46 2009
@@ -21,9 +21,12 @@
 
 package org.apache.derby.impl.sql.execute;
 
+import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 
+import org.apache.derby.catalog.AliasInfo;
 import org.apache.derby.catalog.DependableFinder;
 import org.apache.derby.catalog.UUID;
 import org.apache.derby.iapi.error.StandardException;
@@ -37,9 +40,12 @@
 import org.apache.derby.iapi.sql.depend.Dependent;
 import org.apache.derby.iapi.sql.depend.Provider;
 import org.apache.derby.iapi.sql.depend.ProviderInfo;
+import org.apache.derby.iapi.sql.dictionary.AliasDescriptor;
 import org.apache.derby.iapi.sql.dictionary.ColPermsDescriptor;
 import org.apache.derby.iapi.sql.dictionary.ColumnDescriptor;
+import org.apache.derby.iapi.sql.dictionary.ColumnDescriptorList;
 import org.apache.derby.iapi.sql.dictionary.DefaultDescriptor;
+import org.apache.derby.iapi.sql.dictionary.DependencyDescriptor;
 import org.apache.derby.iapi.sql.dictionary.DataDictionary;
 import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
 import org.apache.derby.iapi.sql.dictionary.PermissionsDescriptor;
@@ -56,6 +62,7 @@
 import org.apache.derby.iapi.store.access.ConglomerateController;
 import org.apache.derby.iapi.store.access.TransactionController;
 import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.iapi.types.DataTypeDescriptor;
 
 /**
  * Abstract class that has actions that are across
@@ -805,6 +812,122 @@
         }
     }
 
+    /**
+     * Adjust dependencies of a table on ANSI UDTs. We only add one dependency
+     * between a table and a UDT. If the table already depends on the UDT, we don't add
+     * a redundant dependency.
+     */
+    protected   void    adjustUDTDependencies
+        (
+         LanguageConnectionContext  lcc,
+         DataDictionary     dd,
+         TableDescriptor    td,
+         ColumnInfo[]        columnInfos
+         )
+        throws StandardException
+    {
+        if ( columnInfos == null ) { return; }
+
+		TransactionController tc = lcc.getTransactionExecute();
+
+        int changedColumnCount = columnInfos.length;
+        HashMap addUdtMap = new HashMap();
+        HashMap dropUdtMap = new HashMap();
+        HashSet addColumnNames = new HashSet();
+        HashSet dropColumnNames = new HashSet();
+
+        // first find all of the new ansi udts which the table must depend on
+        // and the old ones which are candidates for removal
+        for ( int i = 0; i &lt; changedColumnCount; i++ )
+        {
+            ColumnInfo ci = columnInfos[ i ];
+
+            // skip this column if it is not a UDT
+            AliasDescriptor ad = dd.getAliasDescriptorForUDT( tc, columnInfos[ i ].dataType
);
+            if ( ad == null ) { continue; }
+
+            String key = ad.getObjectID().toString();
+
+            if ( ci.action == ColumnInfo.CREATE )
+            {
+                addColumnNames.add( ci.name);
+
+                // no need to add the descriptor if it is already on the list
+                if ( addUdtMap.get( key ) != null ) { continue; }
+
+                addUdtMap.put( key, ad );
+            }
+            else if ( ci.action == ColumnInfo.DROP )
+            {
+                dropColumnNames.add( ci.name );
+                dropUdtMap.put( key, ad );
+            }
+        }
+
+        // nothing to do if there are no columns of udt type
+        if ( (addUdtMap.size() == 0) &amp;&amp; (dropUdtMap.size() == 0) ) { return; }
+
+        //
+        // Now prune from the add list all udt descriptors for which we already have dependencies.
+        // These are the udts for old columns. This supports the ALTER TABLE ADD COLUMN
+        // case.
+        //
+        // Also prune from the drop list add udt descriptors which will still be
+        // referenced by the remaining columns.
+        //
+        ColumnDescriptorList cdl = td.getColumnDescriptorList();
+        int totalColumnCount = cdl.size();
+
+        for ( int i = 0; i &lt; totalColumnCount; i++ )
+        {
+            ColumnDescriptor cd = cdl.elementAt( i );
+
+            // skip columns that are being added and dropped. we only want the untouched
columns
+            if (
+                addColumnNames.contains( cd.getColumnName() ) ||
+                dropColumnNames.contains( cd.getColumnName() )
+                ) { continue; }
+
+            // nothing to do if the old column isn't a UDT
+            AliasDescriptor ad = dd.getAliasDescriptorForUDT( tc, cd.getType() );
+            if ( ad == null ) { continue; }
+
+            String key = ad.getObjectID().toString();
+
+            // ha, it is a UDT. remove the UDT from the list of dependencies to
+            // add and drop
+            if ( addUdtMap.get( key ) != null ) { addUdtMap.remove( key ); }
+            if ( dropUdtMap.get( key ) != null ) { dropUdtMap.remove( key ); }
+        }
+
+        // again, nothing to do if there are no columns of udt type
+        if ( (addUdtMap.size() == 0) &amp;&amp; (dropUdtMap.size() == 0) ) { return; }
+
+        DependencyManager   dm = dd.getDependencyManager();
+        ContextManager      cm = lcc.getContextManager();
+
+        // add new dependencies
+        Iterator            addIterator = addUdtMap.values().iterator();
+        while( addIterator.hasNext() )
+        {
+            AliasDescriptor ad = (AliasDescriptor) addIterator.next();
+
+            dm.addDependency( td, ad, cm );
+        }
+
+        // drop dependencies that are orphaned
+        Iterator            dropIterator = dropUdtMap.values().iterator();
+        while( dropIterator.hasNext() )
+        {
+            AliasDescriptor ad = (AliasDescriptor) dropIterator.next();
+
+            DependencyDescriptor dependency = new DependencyDescriptor( td, ad );
+
+            dd.dropStoredDependency( dependency, tc );
+        }
+    }
+
+    
 	/**
 	 * Mutable Boolean wrapper, initially false
 	 */

Modified: db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml?rev=888811&amp;r1=888810&amp;r2=888811&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml Wed Dec  9 14:22:46
2009
@@ -3136,6 +3136,14 @@
             &lt;/msg&gt;
 
             &lt;msg&gt;
+                &lt;name&gt;X0Y29.S&lt;/name&gt;
+                &lt;text&gt;Operation '{0}' cannot be performed on object '{1}' because TABLE
'{2}' is dependent on that object.&lt;/text&gt;
+                &lt;arg&gt;operationName&lt;/arg&gt;
+                &lt;arg&gt;objectName&lt;/arg&gt;
+                &lt;arg&gt;viewName&lt;/arg&gt;
+            &lt;/msg&gt;
+
+            &lt;msg&gt;
                 &lt;name&gt;X0Y32.S&lt;/name&gt;
                 &lt;text&gt;{0} '{1}' already exists in {2} '{3}'.&lt;/text&gt;
                 &lt;arg&gt;value&lt;/arg&gt;

Modified: db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java?rev=888811&amp;r1=888810&amp;r2=888811&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
(original)
+++ db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
Wed Dec  9 14:22:46 2009
@@ -1321,6 +1321,7 @@
 	String LANG_PROVIDER_HAS_DEPENDENT_OBJECT                          = "X0Y25.S";
 	String LANG_INDEX_AND_TABLE_IN_DIFFERENT_SCHEMAS                   = "X0Y26.S";
 	String LANG_CREATE_SYSTEM_INDEX_ATTEMPTED                          = "X0Y28.S";
+	String LANG_PROVIDER_HAS_DEPENDENT_TABLE                            = "X0Y29.S";
 	String LANG_OBJECT_ALREADY_EXISTS_IN_OBJECT						   = "X0Y32.S";
 	String LANG_CREATE_INDEX_NO_TABLE                                  = "X0Y38.S";
 	String LANG_INVALID_FK_NO_PK                                       = "X0Y41.S";

Modified: db/derby/code/trunk/java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java?rev=888811&amp;r1=888810&amp;r2=888811&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java
(original)
+++ db/derby/code/trunk/java/storeless/org/apache/derby/impl/storeless/EmptyDictionary.java
Wed Dec  9 14:22:46 2009
@@ -614,6 +614,12 @@
 		return null;
 	}
 
+    public AliasDescriptor getAliasDescriptorForUDT( TransactionController tc, DataTypeDescriptor
dtd )
+        throws StandardException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
 	public AliasDescriptor getAliasDescriptor(UUID uuid)
 			throws StandardException {
 		// TODO Auto-generated method stub

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UDTTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UDTTest.java?rev=888811&amp;r1=888810&amp;r2=888811&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UDTTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UDTTest.java
Wed Dec  9 14:22:46 2009
@@ -51,6 +51,7 @@
     public static final String OBJECT_EXISTS = "X0Y68";
     public static final String NONEXISTENT_OBJECT = "42Y55";
     public static final String SYNTAX_ERROR = "42X01";
+    public static final String TABLE_DEPENDS_ON_TYPE = "X0Y29";
 
     ///////////////////////////////////////////////////////////////////////////////////
     //
@@ -226,10 +227,159 @@
              );
     }
 
+    /**
+     * &lt;p&gt;
+     * Adding and dropping udt columns.
+     * &lt;/p&gt;
+     */
+    public void test_03_addDropColumn() throws Exception
+    {
+        Connection conn = getConnection();
+        String tableName1 = "UDTCOLUMNS";
+        String tableName2 = "UDTCOLUMNS2";
+
+        goodStatement
+            ( conn,
+              "create type price_03 external name 'org.apache.derbyTesting.functionTests.tests.lang.Price'
language java\n" );
+
+        // even though there are 2 price_03 columns, we only create 1 dependency
+        goodStatement
+            ( conn,
+              "create table " + tableName1 + "\n" +
+              "(\n" +
+              "    a int, b int,\n" +
+              "    price1 price_03,\n" +
+              "    price2 price_03\n" +
+              ")\n"
+              );
+        assertEquals( 1, countTableDependencies( conn, tableName1 ) );
+
+        // verify that we can't drop the type while the table depends on it
+        expectExecutionError( conn, TABLE_DEPENDS_ON_TYPE, "drop type Price_03 restrict\n"
);
+
+        // add another price_03 column. should not add another dependency
+        goodStatement
+            ( conn,
+              "alter table udtColumns add column price3 price_03\n" );
+        assertEquals( 1, countTableDependencies( conn, tableName1 ) );
+        expectExecutionError( conn, TABLE_DEPENDS_ON_TYPE, "drop type Price_03 restrict\n"
);
+
+        // drop one of the price_03 column. there should still be a dependency
+        goodStatement
+            ( conn,
+              "alter table udtColumns drop column price3\n" );
+        assertEquals( 1, countTableDependencies( conn, tableName1 ) );
+        expectExecutionError( conn, TABLE_DEPENDS_ON_TYPE, "drop type Price_03 restrict\n"
);
+
+        // drop another column. same story.
+        goodStatement
+            ( conn,
+              "alter table udtColumns drop column price2\n" );
+        assertEquals( 1, countTableDependencies( conn, tableName1 ) );
+        expectExecutionError( conn, TABLE_DEPENDS_ON_TYPE, "drop type Price_03 restrict\n"
);
+
+        // drop the last udt column. dependency should disappear
+        goodStatement
+            ( conn,
+              "alter table udtColumns drop column price1\n" );
+        assertEquals( 0, countTableDependencies( conn, tableName1 ) );
+        goodStatement
+            ( conn,
+              "drop type Price_03 restrict\n" );
+
+        // similar experiments with more types
+        goodStatement
+            ( conn,
+              "create type price_03_a external name 'org.apache.derbyTesting.functionTests.tests.lang.Price'
language java\n" );
+        goodStatement
+            ( conn,
+              "create type price_03_b external name 'org.apache.derbyTesting.functionTests.tests.lang.Price'
language java\n" );
+        goodStatement
+            ( conn,
+              "create type price_03_c external name 'org.apache.derbyTesting.functionTests.tests.lang.Price'
language java\n" );
+
+        goodStatement
+            ( conn,
+              "create table udtColumns2\n" +
+              "(\n" +
+              "    a int, b int,\n" +
+              "    price1 price_03_a,\n" +
+              "    price2 price_03_b\n" +
+              ")\n"
+              );
+        assertEquals( 2, countTableDependencies( conn, tableName2 ) );
+        expectExecutionError( conn, TABLE_DEPENDS_ON_TYPE, "drop type Price_03_a restrict\n"
);
+        expectExecutionError( conn, TABLE_DEPENDS_ON_TYPE, "drop type Price_03_b restrict\n"
);
+        
+        goodStatement
+            ( conn,
+              "alter table udtColumns2 add column price3 price_03_c\n" );
+        assertEquals( 3, countTableDependencies( conn, tableName2 ) );
+        expectExecutionError( conn, TABLE_DEPENDS_ON_TYPE, "drop type Price_03_a restrict\n"
);
+        expectExecutionError( conn, TABLE_DEPENDS_ON_TYPE, "drop type Price_03_b restrict\n"
);
+        expectExecutionError( conn, TABLE_DEPENDS_ON_TYPE, "drop type Price_03_c restrict\n"
);
+
+        goodStatement
+            ( conn,
+              "alter table udtColumns2 drop column b\n" );
+        assertEquals( 3, countTableDependencies( conn, tableName2 ) );
+        expectExecutionError( conn, TABLE_DEPENDS_ON_TYPE, "drop type Price_03_a restrict\n"
);
+        expectExecutionError( conn, TABLE_DEPENDS_ON_TYPE, "drop type Price_03_b restrict\n"
);
+        expectExecutionError( conn, TABLE_DEPENDS_ON_TYPE, "drop type Price_03_c restrict\n"
);
+
+        goodStatement
+            ( conn,
+              "alter table udtColumns2 drop column price3\n" );
+        assertEquals( 2, countTableDependencies( conn, tableName2 ) );
+        goodStatement
+            ( conn,
+              "drop type Price_03_c restrict\n" );
+
+        goodStatement
+            ( conn,
+              "alter table udtColumns2 drop column price2\n" );
+        assertEquals( 1, countTableDependencies( conn, tableName2 ) );
+        goodStatement
+            ( conn,
+              "drop type Price_03_b restrict\n" );
+
+        goodStatement
+            ( conn,
+              "alter table udtColumns2 drop column price1\n" );
+        assertEquals( 0, countTableDependencies( conn, tableName2 ) );
+        goodStatement
+            ( conn,
+              "drop type Price_03_a restrict\n" );
+
+    }
+
     ///////////////////////////////////////////////////////////////////////////////////
     //
     // MINIONS
     //
     ///////////////////////////////////////////////////////////////////////////////////
 
+    /** Get the number of dependencies that a table has */
+    private int countTableDependencies( Connection conn, String tableName ) throws Exception
+    {
+        PreparedStatement ps = chattyPrepare
+            ( conn, "select count(*) from sys.sysdepends d, sys.systables t where d.dependentid
= t.tableid and t.tablename = ?" );
+        ps.setString( 1, tableName );
+
+        return getScalarInteger( ps );
+    }
+
+    /** Get a scalar integer result from a query */
+    private int getScalarInteger( PreparedStatement ps ) throws Exception
+    {
+        ResultSet rs = ps.executeQuery();
+        rs.next();
+        int retval = rs.getInt( 1 );
+
+        rs.close();
+        ps.close();
+
+        return retval;
+    }
+
 }




</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r888754 - /db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLChar.java</title>
<author><name>kahatlen@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091209100747.BA9862388893@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091209100747-BA9862388893@eris-apache-org%3e</id>
<updated>2009-12-09T10:07:47Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: kahatlen
Date: Wed Dec  9 10:07:47 2009
New Revision: 888754

URL: http://svn.apache.org/viewvc?rev=888754&amp;view=rev
Log:
DERBY-4465: Typo in error message from SQLChar

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLChar.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLChar.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLChar.java?rev=888754&amp;r1=888753&amp;r2=888754&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLChar.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLChar.java Wed Dec  9 10:07:47
2009
@@ -709,7 +709,7 @@
                     throw StandardException.newException(
                             SQLState.LANG_STREAMING_COLUMN_I_O_EXCEPTION, 
                             ioe, 
-                            "java.sql.String");
+                            String.class.getName());
                 }
             }
         }




</pre>
</div>
</content>
</entry>
<entry>
<title>=?utf-8?q?=5BDb-derby_Wiki=5D_Update_of_=22DerbyTenSixOneRelease=22_by_Kn?= =?utf-8?q?utAndersHatlen?=</title>
<author><name>Apache Wiki &lt;wikidiffs@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091209092134.12216.67785@eos.apache.org%3e"/>
<id>urn:uuid:%3c20091209092134-12216-67785@eos-apache-org%3e</id>
<updated>2009-12-09T09:21:34Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Db-derby Wiki" for change notification.

The "DerbyTenSixOneRelease" page has been changed by KnutAndersHatlen.
http://wiki.apache.org/db-derby/DerbyTenSixOneRelease?action=diff&amp;rev1=7&amp;rev2=8

--------------------------------------------------

- '''Table of Contents'''
- &lt;&lt;TableOfContents(3)&gt;&gt;
+ '''Table of Contents''' &lt;&lt;TableOfContents(3)&gt;&gt;
+ 
+ == 10.6.1 Release Summary ==
+ Derby 10.6.1 is a feature release.
+ ||Release Manager ||- ||
+ ||Draft Release Notes Circulated ||- ||
+ ||Release candidate to be posted ||- ||
+ ||Sanity Testing and Voting ||- ||
+ ||Target Release Date ||- ||
  
  
- == 10.6.1 Release Summary ==
  
- Derby 10.6.1 is a feature release.
- 
- ||Release Manager|| - ||
- ||Draft Release Notes Circulated || - ||
- ||Release candidate to be posted|| - ||
- ||Sanity Testing and Voting  || - ||
- ||Target Release Date || - ||
  
  == 10.6.1 Features ==
+ The following features are planned for 10.6.1. Note that this is not a contract. The contents
of 10.6.1 will shift as development proceeds.
+ ||'''Feature''' ||'''JIRAs''' ||'''Comments''' ||
+ ||Sequence Generators (T176) ||[[https://issues.apache.org/jira/browse/DERBY-712|DERBY-712]]
||ANSI/ISO Sequence Generators ||
+ ||DBLOOK Improvements ||[[https://issues.apache.org/jira/browse/DERBY-4272|DERBY-4272]]
||Sort DDL by dependencies; add GRANT/REVOKE statements ||
+ ||Replication Monitoring ||[[https://issues.apache.org/jira/browse/DERBY-3501|DERBY-3501]]
||JMX-based monitoring of master and slave databases ||
+ ||Restricted Table Functions ||[[https://issues.apache.org/jira/browse/DERBY-4357|DERBY-4357]]
||Push projections and simple restrictions into table functions. ||
+ ||XPLAIN statistics collection ||[[https://issues.apache.org/jira/browse/DERBY-2487|DERBY-2487]]
||Capture statistics about the execution of a query into database tables for further analysis
||
+ ||GROUP BY ROLLUP (T431, limited) ||[[https://issues.apache.org/jira/browse/DERBY-3002|DERBY-3002]]
||Implement a subset of the SQL Standard ROLLUP functionality on the GROUP BY clause ||
+ ||CROSS JOIN (F401-04) ||[[https://issues.apache.org/jira/browse/DERBY-4355|DERBY-4355]]
||Implement SQL Standard CROSS JOIN syntax. ||
+ ||Named columns join ||[[https://issues.apache.org/jira/browse/DERBY-4370|DERBY-4370]] ||Allow
USING clauses in joins. ||
+ ||SHOW FUNCTIONS ||[[https://issues.apache.org/jira/browse/DERBY-3809|DERBY-3809]] ||Add
a command that lists stored functions in ij. ||
+ ||In-memory back end enhancements ||[[https://issues.apache.org/jira/browse/DERBY-4428|DERBY-4428]]
||Add a proper delete mechanism. ||
+ ||ORDER BY in subqueries ||[[https://issues.apache.org/jira/browse/DERBY-4397|DERBY-4397]]
||Add syntax for explicit ordering of rows returned by subqueries. ||
  
- The following features are planned for 10.6.1. Note that this is not a contract. The contents
of 10.6.1 will shift as development proceeds.
  
- || '''Feature''' || '''JIRAs''' || '''Comments'''||
- || Sequence Generators (T176) || [[https://issues.apache.org/jira/browse/DERBY-712|DERBY-712]]
|| ANSI/ISO Sequence Generators ||
- || DBLOOK Improvements || [[https://issues.apache.org/jira/browse/DERBY-4272|DERBY-4272]]
|| Sort DDL by dependencies; add GRANT/REVOKE statements ||
- || Replication Monitoring || [[https://issues.apache.org/jira/browse/DERBY-3501|DERBY-3501]]
|| JMX-based monitoring of master and slave databases ||
- || Restricted Table Functions || [[https://issues.apache.org/jira/browse/DERBY-4357|DERBY-4357]]
|| Push projections and simple restrictions into table functions. ||
- || XPLAIN statistics collection || [[https://issues.apache.org/jira/browse/DERBY-2487|DERBY-2487]]
|| Capture statistics about the execution of a query into database tables for further analysis
||
- || GROUP BY ROLLUP (T431, limited) || [[https://issues.apache.org/jira/browse/DERBY-3002|DERBY-3002]]
|| Implement a subset of the SQL Standard ROLLUP functionality on the GROUP BY clause ||
- || CROSS JOIN (F401-04) || [[https://issues.apache.org/jira/browse/DERBY-4355|DERBY-4355]]
|| Implement SQL Standard CROSS JOIN syntax. ||
- || Named columns join || [[https://issues.apache.org/jira/browse/DERBY-4370|DERBY-4370]]
|| Allow USING clauses in joins. ||
- || SHOW FUNCTIONS || [[https://issues.apache.org/jira/browse/DERBY-3809|DERBY-3809]] ||
Add a command that lists stored functions in ij. ||
- || In-memory back end enhancements || [[https://issues.apache.org/jira/browse/DERBY-4428|DERBY-4428]]
|| Add a proper delete mechanism. ||
  
  
  == 10.6.1 Bug Fixes ==
- 
  We will put some effort into fixing bugs on the following lists:
  
   * [[https://issues.apache.org/jira/secure/IssueNavigator.jspa?mode=hide&amp;requestId=12313481|Data
Corruptions]]
@@ -40, +39 @@

   * [[https://issues.apache.org/jira/secure/IssueNavigator.jspa?mode=hide&amp;requestId=12313483|Crashes]]
  
  == 10.6.1 Testing ==
- 
  Testing details can be found on the following pages:
  
   * TenSixOnePlatformTesting
  
  List other testing here:
  
- RC1 
+ RC1
- || '''Tester''' || '''Date''' || '''Additional Tests''' || '''Comments'''||
+ ||'''Tester''' ||'''Date''' ||'''Additional Tests''' ||'''Comments''' ||
  
+ 


</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r888421 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java</title>
<author><name>rhillegas@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091208145609.50F6F238888F@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091208145609-50F6F238888F@eris-apache-org%3e</id>
<updated>2009-12-08T14:56:09Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: rhillegas
Date: Tue Dec  8 14:56:08 2009
New Revision: 888421

URL: http://svn.apache.org/viewvc?rev=888421&amp;view=rev
Log:
DERBY-712: Wrap another sanity assertion in a debug conditional.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java?rev=888421&amp;r1=888420&amp;r2=888421&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java Tue
Dec  8 14:56:08 2009
@@ -230,7 +230,10 @@
             break;
 
         default:
+            if( SanityManager.DEBUG)
+            {
                 SanityManager.THROWASSERT( "Invalid privilege objectType: " + this.objectType);
+            }
         }
 
         if( dependencyProvider != null)




</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r888385 - in /db/derby/code/trunk/maven2: README.txt SetDerbyVersion.java settings.xml</title>
<author><name>kristwaa@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091208130426.6D34E238888C@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091208130426-6D34E238888C@eris-apache-org%3e</id>
<updated>2009-12-08T13:04:26Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: kristwaa
Date: Tue Dec  8 13:04:25 2009
New Revision: 888385

URL: http://svn.apache.org/viewvc?rev=888385&amp;view=rev
Log:
DERBY-4400: Document the process of producing Maven 2 artifacts for Derby 

Added a utility class that obtains the Derby version from the jars that will
be put into the artifacts. It also does a few sanity checks of the jars, for
instance checking if they are all there.
Updated the README and changed/added some comments in settings.xml.

Patch file: derby-4400-1c-SetDerbyVersion.diff


Added:
    db/derby/code/trunk/maven2/SetDerbyVersion.java   (with props)
Modified:
    db/derby/code/trunk/maven2/README.txt
    db/derby/code/trunk/maven2/settings.xml

Modified: db/derby/code/trunk/maven2/README.txt
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/maven2/README.txt?rev=888385&amp;r1=888384&amp;r2=888385&amp;view=diff
==============================================================================
--- db/derby/code/trunk/maven2/README.txt (original)
+++ db/derby/code/trunk/maven2/README.txt Tue Dec  8 13:04:25 2009
@@ -1,8 +1,8 @@
 GENERATING MAVEN 2 ARTIFACTS FOR APACHE DERBY
 =============================================
 
-The POMs in the maven2 directory are able to generate Maven 2 artifacts for
-Apache Derby. The following software is required for deploying a release:
+The POMs in the maven2 directory enable you to generate Maven 2 artifacts
+for Apache Derby. The following software is required for deploying a release:
  1. Maven 2
  2. GnuPG (for signing the artifacts)
  3. ssh/scp (for site deployment)
@@ -11,20 +11,38 @@
 you run it. They will be cached locally, so they are not downloaded again the
 next time.
 
+All commands below are to be executed from the directory 'maven2' within the
+Derby source code repository.
+
+WARNING: The Maven repository is write-once. This means that you have only one
+         chance to deploy artifacts with a given version string. Once they are
+         deployed, you cannot overwrite them. The only way to deprecate a set
+         of deployed artifacts is to deploy a new set of artifacts with a
+         different version string.
+
+
 Short description of the required steps:
+
  a) Generate the Derby jar files.
-    For releases, generate the insane jars. You can specify which jars to use
+    For releases, generate the insane jars. You can override which jars to use
     with the property 'sanity' in the top-level POM.
     The jars are expected to be found in 'jars/[in]sane' relative to the
     checked out code repository.
 
- b) Specify required information for one or all of the following steps.
-    To generate and deploy release artifacts, these pieces of information must
-    be specified:
+ b) Specify required information for one or all of the following sub-steps.
+    To successfully generate and deploy release artifacts, all of these
+    must be specified:
       - The Derby release version, which must be specified in all POMs.
-        One way to do this, is to use search and replace (i.e. Perl or sed).
-      - Passphrase for your GPG signing key, see top level POM and step (d).
-      - User credentials for deployment, see 'settings.xml'.
+        Compile and execute the Java program SetDerbyVersion, i.e.:
+        javac SetDerbyVersion &amp;&amp; java -cp . SetDerbyVersion
+        Alternatively, use search and replace (i.e. Perl or sed) - make sure
+        you don't replace version tags that aren't supposed to modified.
+        Make sure you diff the POMs to verify the changes.
+        Note that the Java program performs some extra sanity checks.
+      - Passphrase for your GPG signing key. Required for step (c) and (d).
+        See the top level POM for details, brief instructions in (c).
+      - User credentials for deployment. Required for step (d).
+        See 'settings.xml' for details.
 
  c) 'mvn clean install'
     Generates the artifacts, signatures for the artifacts using GnuPG and
@@ -32,12 +50,17 @@
     You are required to provide your private key and the passphrase to GnuPG.
     Using a passphrase agent is recommended, but you can also specify it on
     the command line when invoking maven with -Dgpg.passphrase=PASSPHRASE.
-    There are other ways to achieve this too, but please do not specify you
-    passphrase in the POM that is deployed on the Maven repositories!
+
+    WARNING: Do not specify your passphrase in the POM that is deployed on
+             the Maven repositories!
+
     The local repository is typically found in '~/.m2/repository/', and the
-    Derby artifacts are located under "org/apache/derby/".
+    Derby artifacts are located under 'org/apache/derby/'.
     The clean target is included to avoid unintentionally installing/deploying
     artifacts not supposed to be deployed.
+    If you just want to build the artifacts, use 'mvn package' or 'mvn verify'.
+    The former will generate the artifact jar, the latter will additionally
+    generate/include the POM to be deployed and the signatures.
 
     NOTE: Do not run 'mvn package|verify install', that is to combine either
           package or verify with install, as this causes the
@@ -45,17 +68,42 @@
           './engine/target/derby-trunk-alpha.jar.asc.asc'.
 
  d) 'mvn deploy' or 'mvn clean deploy'
-   NOTE: This step has been reported not to work. Deploy manually until fixed.
-   Deploys the artifacts, including signatures and checksum files, to the
-   Apache Maven 2 repository. The files will then be distributed to mirrors.
+    Deploys the artifacts, including signatures and checksum files, to the
+    Apache Maven 2 repository. The files will then be distributed to mirrors.
+
+    NOTE: This step has been reported to not work when using username and
+    password authentication. Unless you prefer to deploy manually, use a
+    public key to log into the remote host (people.apache.org).
 
-Basically, for each project, the following files should be found in the
-various 'maven2/[project]/target' directories:
+For each project, the following files should be found in the
+various 'maven2/[project]/target' directories after 'verify' or 'install':
     - ARTIFACT-VERSION.jar
     - ARTIFACT-VERSION.jar.asc
     - ARTIFACT-VERSION.pom
     - ARTIFACT-VERSION.pom.asc
 
-When these are deployed or installed locally, there will be a md5 and a sha1
-file for each artifact. The 'derbywar' project will have a war file instead
-of a jar file.
+When these are deployed, or installed locally, checksum files (a md5 and a sha1
+file for each artifact) will be generated by Maven. Check your local
+repository to confirm this (i.e. '~/.m2/repository').
+The 'derbywar' project will have a war file instead of a jar file.
+
+Some time after you have deployed the artifacts to the Apache staging
+repository (happens when you run 'mvn deploy'), they should appear in the
+central Maven repository.
+Try one of these to confirm that your artifacts are available:
+http://repo1.maven.org/maven2/org/apache/derby/
+http://mvnrepository.com/artifact/org.apache.derby
+
+
+Release history for Maven 2 artifacts
+=====================================
+
+The list below shows the Apache Derby artifacts published by the Apache Derby
+community.
+The dates are when the artifacts were written to the central Maven repository
+(repo1.maven.org/maven2 or repo2.maven.org/maven2).
+
+2009-10-07 10.5.3.0_1   OK
+2009-08-26 10.5.3.0     BROKEN
+    An error in all the POMs made these artifacts unusable (DERBY-4390).
+    Use version 10.5.3.0_1 instead.

Added: db/derby/code/trunk/maven2/SetDerbyVersion.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/maven2/SetDerbyVersion.java?rev=888385&amp;view=auto
==============================================================================
--- db/derby/code/trunk/maven2/SetDerbyVersion.java (added)
+++ db/derby/code/trunk/maven2/SetDerbyVersion.java Tue Dec  8 13:04:25 2009
@@ -0,0 +1,447 @@
+/*
+
+   Derby - Class SetDerbyVersion
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.EOFException;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.Driver;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Checks the current Derby jars in the source tree directory, obtains the
+ * Derby version from them, and replaces the value of the placeholder
+ * version tags in the POM files.
+ * &lt;p&gt;
+ * After this method has been successfully run you should be ready to
+ * generate the Maven 2 artifacts for Derby.
+ * &lt;p&gt;
+ * The main task of this class is to replace the version tags in the Maven
+ * POM files. The can be done manually, but exact process would vary from
+ * platform to platform. Also, running a search-and-replace could potentially
+ * replace tags not supposed to be replaced. To make the Maven 2 artifact
+ * publish process simpler, this class was written.
+ */
+//@NotThreadSafe
+public class SetDerbyVersion {
+
+    private static final String PROMPT_CONT_WARN =
+            "Do you want to continue despite the warnings?";
+    private static final String PROMPT_USE_SANE =
+            "Do you want to generate artifacts with SANE jars?";
+    private static final String JDBC_URL =
+            "jdbc:derby:memory:testDB;create=true";
+    private static final String REL_JAR_PATH = "../jars";
+    private static final File SANE = new File(REL_JAR_PATH, "sane");
+    private static final File INSANE = new File(REL_JAR_PATH, "insane");
+    /** List of required jar files the Maven 2 Derby artifacts. */
+    private static final String[] JARS = new String[] {
+        "derby.jar",
+        "derby.war",
+        "derbynet.jar",
+        "derbyclient.jar",
+        "derbytools.jar",
+        // Ignore derbyTesting.jar, not part of the Maven 2 artifacts.
+        // "derbyTesting.jar",
+        // Ignore derbyrun.jar, not part of the Maven 2 artifacts.
+        //"derbyrun.jar",
+        // The various locale files.
+        "derbyLocale_cs.jar",
+        "derbyLocale_de_DE.jar",
+        "derbyLocale_es.jar",
+        "derbyLocale_fr.jar",
+        "derbyLocale_hu.jar",
+        "derbyLocale_it.jar",
+        "derbyLocale_ja_JP.jar",
+        "derbyLocale_ko_KR.jar",
+        "derbyLocale_pl.jar",
+        "derbyLocale_pt_BR.jar",
+        "derbyLocale_ru.jar",
+        "derbyLocale_zh_CN.jar",
+        "derbyLocale_zh_TW.jar",
+    };
+
+    /**
+     * Displays a prompt and obtains a yes / no answer from standard in.
+     *
+     * @param prompt the prompt to display
+     * @return {@code true} if the answer is yes, {@code false} if the answer
+     *      is no.
+     * @throws IOException if reading from standard in fails
+     */
+    private static boolean getYesNoInput(String prompt)
+            throws IOException {
+        // We don't care about keeping the objects around, this method will
+        // only be used a few times.
+        BufferedReader bIn = new BufferedReader(
+                new InputStreamReader(System.in));
+        while (true) {
+            System.out.print("&gt;&gt; " + prompt + " (yes/no) ");
+            String answer = bIn.readLine();
+            if (answer == null) {
+                // We don't know what do to here, so just fail.
+                throw new EOFException("Input stream closed.");
+            }
+            if (answer.equals("yes")) {
+                return true;
+            } else if (answer.equals("no")) {
+                return false;
+            }
+        }
+    }
+
+    /**
+     * Set to {@code true} if a warning message is printed. Must be manually
+     * reset if used to check for warnings in a part of the code.
+     */
+    private boolean warnings = false;
+    /** The version string inserted into the POMs. */
+    private String versionString = "ALPHA_VERSION";
+    private File PREFIX;
+
+    /**
+     * Prints a warning message and sets the internal warning flag.
+     *
+     * @param msg the message to print
+     */
+    private void warn(String msg) {
+        warnings = true;
+        System.out.println("WARNING! " + msg);
+    }
+
+    private void info(String msg) {
+        System.out.println(msg);
+    }
+
+    /**
+     * Checks that all required jars are found in the jar directory.
+     *
+     * @return {@code true} if all required jars exist, {@code false} otherwise.
+     */
+    public boolean checkJars()
+            throws Exception {
+        if (!SANE.exists() &amp;&amp; !INSANE.exists()) {
+            warn("No jars exist. Produce a Derby release build.");
+            return false;
+        }
+        if (SANE.exists() &amp;&amp; INSANE.exists()) {
+            warn("Both SANE and INSANE jars exist.");
+            return false;
+        }
+        PREFIX = SANE.exists() ? SANE : INSANE;
+        if (SANE.exists()) {
+            warn("Only SANE jars exist. Normally INSANE jars are used for a " +
+                    "release.");
+            boolean answer = getYesNoInput(PROMPT_USE_SANE);
+            if (!answer) {
+                return false;
+            }
+        }
+        URL[] URLS = new URL[JARS.length];
+        for (int i=0; i &lt; JARS.length; i++) {
+            URLS[i] = new File(PREFIX, JARS[i]).toURI().toURL();
+        }
+
+        warnings = false; // Reuse the warnings flag.
+        // Make sure the files are there.
+        for (URL url : URLS) {
+            File f = new File(url.toURI());
+            info(String.format(
+                    "Checking file: %-30s %,12d bytes",
+                    f.getName(), f.length()));
+            if (!f.exists()) {
+                warn("Missing file: " + f.getCanonicalPath());
+            } else if (f.length() == 0) {
+                warn("Empty file: " + f.getCanonicalPath());
+            }
+        }
+        info("");
+        if (warnings) {
+            // Fail here.
+            warn("There are missing or empty jar files.");
+            return false;
+        }
+
+        // The class loader used for the Derby jars.
+        URLClassLoader cl = new URLClassLoader(URLS, null);
+
+        // Extra sanity check for the sanity...
+        try {
+            Class.forName(
+                    "org.apache.derby.shared.common.sanity.SanityManager",
+                    true ,cl);
+            if (PREFIX == INSANE) {
+                warn("Found SanityManager in INSANE build. Aborting.");
+                return false;
+            }
+        } catch (ClassNotFoundException cnfe) {
+            if (PREFIX == SANE) {
+                warn("Unable to load SanityManager in SANE build. Aborting.");
+                return false;
+            }
+        }
+
+        // Fire up Derby to get the version string.
+        Class driverClass =
+                Class.forName("org.apache.derby.jdbc.EmbeddedDriver", true, cl);
+        Driver driver = (Driver)driverClass.newInstance();
+        Connection con = driver.connect(JDBC_URL, null);
+        DatabaseMetaData meta = con.getMetaData();
+        con.close();
+        // Delete the derby.log file.
+        new File("derby.log").delete();
+
+        // I.e.: 10.6.0.0 alpha - (882129M)
+        String fullVersion = meta.getDatabaseProductVersion();
+        String[] components = fullVersion.split(" - ");
+        versionString = components[0].replaceAll(" ", "_");
+        String srcRevision = components[1].replaceAll("\\(|\\)", "");
+        info("Obtained product version string: " + fullVersion);
+        info("(version=" + versionString + ", revision=" + srcRevision + ")");
+        if (versionString.contains("beta")) {
+            warn("This is a BETA build.");
+        }
+        if (versionString.contains("alpha")) {
+            warn("This is an ALPHA build.");
+        }
+        if (srcRevision.endsWith("M")) {
+            warn("The sources had been modified when the jars were built.");
+            warnings = true;
+        }
+        if (warnings) {
+            if (!getYesNoInput(PROMPT_CONT_WARN)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Replaces the relevant version tags in the various POM files.
+     *
+     * @throws IOException if accessing a POM file fails
+     */
+    public boolean setPOMVersionTags()
+            throws IOException {
+        File curDir = new File(".");
+        boolean gotWarnings = false;
+        // We only descend one level, no need for a recursive method.
+        for (File topLevel : curDir.listFiles()) {
+            if (topLevel.getName().equals("pom.xml")) {
+                gotWarnings |= setVersionTag(topLevel);
+            }
+            if (topLevel.isDirectory()) {
+                for (File l1 : topLevel.listFiles()) {
+                    if (l1.getName().equals("pom.xml")) {
+                        gotWarnings |= setVersionTag(l1);
+                        // There is only one POM in each sub-directory.
+                        break;
+                    }
+                }
+            }
+        }
+
+        // See if we ran into problems when replacing the version tags.
+        info("");
+        if (gotWarnings) {
+            warn("There were errors replacing the POM version tags.");
+        } else {
+            info("POM version tags replacement succeeded.");
+            info("It is recommended that you verify the POM diffs " +
+                    "before running Maven.");
+        }
+        return (warnings == false);
+    }
+
+    public void printSanityNote()
+            throws IOException {
+        if (PREFIX == SANE) {
+            info("");
+            info("NOTE: Remember to change the &lt;sanity&gt; tag in the top-level");
+            info("      POM, setting it to 'sane'.");
+        }
+    }
+
+    /**
+     * Verifies that the correct number of tags were replaced in the POM.
+     *
+     * @param replaceCount the number of tags replaced
+     * @param pom the POM modified
+     * @return {@code 0} if the check passed, a negative value if too few tags
+     *      were replaced, and a positive value if too many tags were replaced.
+     */
+    private int checkResult(int replaceCount, File pom) {
+        // The locales requires two replacements, due to the dependency.
+        String parent = pom.getParent();
+        if (parent.contains("derbyLocale")) {
+            return (replaceCount - 2);
+        // derbynet also requries two replacements (derby.jar dependency)
+        } else if (parent.contains("net")) {
+            return (replaceCount - 2);
+        } else {
+            return (replaceCount - 1);
+        }
+    }
+
+    /**
+     * Replaces all qualifying version tags in the specified POM.
+     *
+     * @param pom the POM to modify
+     * @return {@code false} if warnings were produced when replacing,
+     *      {@code true} if all seemed to go well.
+     *
+     * @throws IOException if reading or writing to the POM file fails
+     */
+    private boolean setVersionTag(File pom)
+            throws IOException {
+        // Clear internal warning flag.
+        warnings = false;
+        // Just read the whole file into memory.
+        List&lt;String&gt; lines = readFile(pom);
+
+        // Start writing the file back out, and search for tags to replace.
+        BufferedWriter bOut = new BufferedWriter(new FileWriter(pom, false));
+        int replaced = 0;
+        boolean artifactIdOk = false;
+        boolean groupIdOk = false;
+        // Could have used XML, but keep it simple.
+        // artifactId and groupId are used to qualify the version tag, as it can
+        // be used in more places than those we want to replace.
+        for (String line : lines) {
+            // Look for tags for qualification.
+            if (line.trim().startsWith("&lt;artifactId&gt;") &amp;&amp;
+                    line.contains("derby")) {
+                artifactIdOk = true;
+            } else if (line.trim().startsWith("&lt;groupId&gt;") &amp;&amp;
+                    line.contains("org.apache.derby")) {
+                groupIdOk = true;
+            }
+
+            // Change line if a qualified version tag, echo otherwise.
+            if (line.trim().startsWith("&lt;version&gt;") &amp;&amp;
+                    artifactIdOk &amp;&amp; groupIdOk) {
+                // Replace tag.
+                int whitespaceTag = line.indexOf("&gt;");
+                bOut.write(line.substring(0, whitespaceTag +1));
+                bOut.write(versionString);
+                int tagEnd = line.indexOf("&lt;", whitespaceTag);
+                bOut.write(line.substring(tagEnd));
+                bOut.newLine();
+                replaced++;
+                artifactIdOk = groupIdOk = false;
+            } else {
+                bOut.write(line);
+                bOut.newLine();
+            }
+        }
+        try {
+            bOut.flush();
+            bOut.close();
+        } catch (IOException ioe) {
+            warn("Flushing/closing stream for " + pom.getCanonicalPath() +
+                    " failed: " + ioe.getMessage());
+        }
+        int result = checkResult(replaced, pom);
+        if (result == 0) {
+            info("Replaced " + replaced + " version tag(s) in " +
+                    pom.getParentFile().getName() + "/" + pom.getName());
+        } else if (result &gt; 0) {
+            warn("Too many version tags (" + replaced + " &gt; " +
+                    (replaced - result) + ") replaced in " + pom.getPath());
+        } else {
+            warn("Too few version tags (" + replaced + " &lt; " +
+                    (replaced - result) + ") replaced in " + pom.getPath());
+        }
+        return warnings;
+    }
+
+    /**
+     * Reads the contents of a text file.
+     *
+     * @param f the file to read
+     * @return A list containing the lines of the file.
+     * @throws IOException if reading the file fails
+     */
+    private List&lt;String&gt; readFile(File f)
+            throws IOException {
+        ArrayList&lt;String&gt; lines = new ArrayList&lt;String&gt;();
+        BufferedReader bIn = new BufferedReader(new FileReader(f));
+        String lineIn;
+        try {
+            while ((lineIn = bIn.readLine()) != null) {
+                lines.add(lineIn);
+            }
+        } finally {
+            try {
+                bIn.close();
+            } catch (IOException ioe) {
+                // Just print a warning.
+                warn("Failed to close input stream for " + f.getPath() + ": " +
+                        ioe.getMessage());
+            }
+        }
+        return lines;
+    }
+
+    /**
+     * Quits the JVM if a failure is detected.
+     *
+     * @param success the return value to check
+     */
+    private static void ensureSuccess(boolean success) {
+        if (!success) {
+            System.out.println();
+            System.out.println(
+                    "!! The process failed or was aborted by the user.");
+            System.out.println(
+                    "   Read the above output and take corrective measures.");
+            System.exit(1);
+        }
+    }
+
+    /**
+     * Checks the current Derby jars in the source tree directory, obtains the
+     * Derby version from them, and replaces the value of the placeholder
+     * version tags in the POM files.
+     * &lt;p&gt;
+     * After this method has been successfully run you should be ready to
+     * generate the Maven 2 artifacts for Derby.
+     *
+     * @param args ignored
+     * @throws Exception if something goes wrong
+     */
+    public static void main(String[] args)
+            throws Exception {
+        SetDerbyVersion sdv = new SetDerbyVersion();
+        ensureSuccess(sdv.checkJars());
+        ensureSuccess(sdv.setPOMVersionTags());
+        sdv.printSanityNote();
+    }
+}

Propchange: db/derby/code/trunk/maven2/SetDerbyVersion.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/derby/code/trunk/maven2/settings.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/maven2/settings.xml?rev=888385&amp;r1=888384&amp;r2=888385&amp;view=diff
==============================================================================
--- db/derby/code/trunk/maven2/settings.xml (original)
+++ db/derby/code/trunk/maven2/settings.xml Tue Dec  8 13:04:25 2009
@@ -7,21 +7,39 @@
     &lt;server&gt;
       &lt;id&gt;apache.releases&lt;/id&gt;
       &lt;!-- RELEASE_DATA: User credentials required for site deployment.
-           Replace the user name and password with your Apache credentials.
+           Fill in your Apache user name, and uncomment the line to specify
+           a private key passphrase if required.
            It is highly recommended to only do this when actually deploying
            a release, and then revert the changes immediately afterwards to
            avoid unintended deployments!
+
+           Note that all required information can be specified as properties on
+           the command line instead of in this file. For instance:
+           mvn -Dusername=asf_user -Dpassphrase=asf_users_passphrase deploy
+
+           If you get the credentials wrong and try to deploy to the Apache
+           site, your IP may be blacklisted. Contact the Apache infrastructure
+           team to get the ban lifted.
       --&gt;
       &lt;username&gt;my_login&lt;/username&gt;
+      &lt;!--
+           Password authentication doesn't work (unknown reason).
+           Use a private key (see below).
       &lt;password&gt;my_password&lt;/password&gt;
-      &lt;!-- Make sure only one of password and privateKey is used.
-           If both are present, privateKey will be ignored.
+      --&gt;
+      &lt;!-- Make sure only one of 'password' and 'privateKey' is specified.
+           If both are present, 'privateKey' will be ignored.
+      --&gt;
       &lt;privateKey&gt;${user.home}/.ssh/id_dsa&lt;/privateKey&gt;
+      &lt;!-- Specify the key passphrase if you have one (uncomment the line).
       &lt;passphrase&gt;some_passphrase&lt;/passphrase&gt;
       --&gt;
+
+      &lt;!-- These settings don't work, but maybe they will one day? --&gt;
       &lt;filePermissions&gt;664&lt;/filePermissions&gt;
       &lt;directoryPermissions&gt;775&lt;/directoryPermissions&gt;
       &lt;configuration&gt;&lt;/configuration&gt;
+
     &lt;/server&gt;
   &lt;/servers&gt;
 &lt;/settings&gt;




</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r888311 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java</title>
<author><name>kahatlen@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091208102420.F13C523888DC@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091208102420-F13C523888DC@eris-apache-org%3e</id>
<updated>2009-12-08T10:24:20Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: kahatlen
Date: Tue Dec  8 10:24:20 2009
New Revision: 888311

URL: http://svn.apache.org/viewvc?rev=888311&amp;view=rev
Log:
DERBY-4442: Default value and identity in an INSERT result set evaluated too early

Back out the fix for DERBY-4419 and DERBY-4425, since the fix is no
longer necessary after the changes that added a ProjectRestrictNode on
top of the original insert source. The test cases for those bugs are
still part of the regression test suite.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java?rev=888311&amp;r1=888310&amp;r2=888311&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
Tue Dec  8 10:24:20 2009
@@ -1688,7 +1688,7 @@
 			ResultColumn resultColumn = (ResultColumn) elementAt(index);
 
 			/* Skip over generated columns */
-			if (resultColumn.isGenerated() || resultColumn.isGeneratedForUnmatchedColumnInInsert())
+			if (resultColumn.isGenerated())
 			{
 				continue;
 			}




</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r888233 - /db/derby/docs/trunk/src/getstart/twwdactivity4.dita</title>
<author><name>bpendleton@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091208024403.ED39823889BB@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091208024403-ED39823889BB@eris-apache-org%3e</id>
<updated>2009-12-08T02:44:03Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: bpendleton
Date: Tue Dec  8 02:44:02 2009
New Revision: 888233

URL: http://svn.apache.org/viewvc?rev=888233&amp;view=rev
Log:
DERBY-3518: Incomplete instructions for compiling WwdEmbedded.java

This patch was contributed by Kim Haase (camilla dot haase at sun dot com)

This change corrects a mistake in the previous DERBY-3518 submission: the
note tag must appear inside the context tag.

Modified:
    db/derby/docs/trunk/src/getstart/twwdactivity4.dita

Modified: db/derby/docs/trunk/src/getstart/twwdactivity4.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/getstart/twwdactivity4.dita?rev=888233&amp;r1=888232&amp;r2=888233&amp;view=diff
==============================================================================
--- db/derby/docs/trunk/src/getstart/twwdactivity4.dita (original)
+++ db/derby/docs/trunk/src/getstart/twwdactivity4.dita Tue Dec  8 02:44:02 2009
@@ -37,13 +37,13 @@
 and experience starting and connecting to the Network Server are helpful.
 You will need to use a text editor to create the &lt;codeph&gt;WwdClient.java&lt;/codeph&gt;

 program.&lt;/prereq&gt;
-&lt;note&gt;As a convenience, the &lt;codeph&gt;workingwithderby&lt;/codeph&gt;
+&lt;context&gt;&lt;note&gt;As a convenience, the &lt;codeph&gt;workingwithderby&lt;/codeph&gt;
     directory contains a program &lt;codeph&gt;WwdClientExample.java&lt;/codeph&gt;
     which has already been edited in the appropriate manner. You can use
     this program directly as it is, or you can compare the contents of this
     program to the &lt;codeph&gt;WwdClient.java&lt;/codeph&gt; program that you will
     construct in this activity, to see how the changes are made.&lt;/note&gt;
-&lt;context&gt;You will create a &lt;ph conref="../conrefs.dita#prod/productshortname"&gt;&lt;/ph&gt;
client
+You will create a &lt;ph conref="../conrefs.dita#prod/productshortname"&gt;&lt;/ph&gt; client
 program,  &lt;codeph&gt;WwdClient.java&lt;/codeph&gt;, by changing a few lines of the  &lt;codeph&gt;WwdEmbedded.java&lt;/codeph&gt;
program.
 You can run the client program in multiple command shells, allowing simultaneous
 update from two or more sources. &lt;p&gt;You use two command windows (Server-Shell




</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r888226 - in /db/derby/docs/trunk/src/adminguide: cadminconfig86869.dita tadminadv804410.dita</title>
<author><name>bpendleton@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091208022658.3236A23888E9@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091208022658-3236A23888E9@eris-apache-org%3e</id>
<updated>2009-12-08T02:26:57Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: bpendleton
Date: Tue Dec  8 02:26:57 2009
New Revision: 888226

URL: http://svn.apache.org/viewvc?rev=888226&amp;view=rev
Log:
DERBY-4153: Document that Network Server will try to create the trace directory

This patch was contributed by Kim Haase (camilla dot haase at sun dot com)

This follow-on patch corrects two errors in the DITA source:
 - p elements were placed directly inside the step, rather than in stepxmp
 - ul elements were placed in the shortdesc, which does not allow ul


Modified:
    db/derby/docs/trunk/src/adminguide/cadminconfig86869.dita
    db/derby/docs/trunk/src/adminguide/tadminadv804410.dita

Modified: db/derby/docs/trunk/src/adminguide/cadminconfig86869.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/adminguide/cadminconfig86869.dita?rev=888226&amp;r1=888225&amp;r2=888226&amp;view=diff
==============================================================================
--- db/derby/docs/trunk/src/adminguide/cadminconfig86869.dita (original)
+++ db/derby/docs/trunk/src/adminguide/cadminconfig86869.dita Tue Dec  8 02:26:57 2009
@@ -19,8 +19,10 @@
 --&gt;
 &lt;concept id="cadminconfig86869" xml:lang="en-us"&gt;
 &lt;title&gt;Managing the Derby Network Server&lt;/title&gt;
-&lt;shortdesc&gt;The &lt;ph conref="../conrefs.dita#prod/productshortname"&gt;&lt;/ph&gt;
Network
-    Server can be run in either of these configurations:
+&lt;prolog&gt;&lt;/prolog&gt;
+&lt;conbody&gt;
+&lt;p&gt;The &lt;ph conref="../conrefs.dita#prod/productshortname"&gt;&lt;/ph&gt; Network
+    Server can be run in either of these configurations:&lt;/p&gt;
     &lt;ul&gt;
         &lt;li&gt;As &lt;xref format="html" scope="external"
                 href="http://db.apache.org/derby/papers/DerbyTut/ns_intro.html#ns_intro"&gt;a
stand-alone server&lt;/xref&gt;,
@@ -34,9 +36,6 @@
             &lt;ph conref="../conrefs.dita#prod/productshortname"&gt;&lt;/ph&gt; 
             database engine are loaded by the Java application&lt;/li&gt;
     &lt;/ul&gt;
-&lt;/shortdesc&gt;
-&lt;prolog&gt;&lt;/prolog&gt;
-&lt;conbody&gt;
 &lt;p&gt;You can use Java Management Extensions (JMX) technology to monitor and manage
 &lt;ph conref="../conrefs.dita#prod/productshortname"&gt;&lt;/ph&gt; and the Network Server.
For information on how
 to do this, visit the wiki page

Modified: db/derby/docs/trunk/src/adminguide/tadminadv804410.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/adminguide/tadminadv804410.dita?rev=888226&amp;r1=888225&amp;r2=888226&amp;view=diff
==============================================================================
--- db/derby/docs/trunk/src/adminguide/tadminadv804410.dita (original)
+++ db/derby/docs/trunk/src/adminguide/tadminadv804410.dita Tue Dec  8 02:26:57 2009
@@ -33,7 +33,7 @@
 Alternatively,
 while the Network Server is running, enter the following command
 to set the trace directory:&lt;codeblock&gt;java org.apache.derby.drda.NetworkServerControl
traceDirectory 
-&amp;lt;&lt;i&gt;directory for tracing files&lt;/i&gt;&amp;gt; [-h &amp;lt;&lt;i&gt;hostname&lt;/i&gt;&amp;gt;]
[-p &amp;lt;&lt;i&gt;portnumber&lt;/i&gt;&amp;gt;]  &lt;/codeblock&gt; &lt;/stepxmp&gt;
+&amp;lt;&lt;i&gt;directory for tracing files&lt;/i&gt;&amp;gt; [-h &amp;lt;&lt;i&gt;hostname&lt;/i&gt;&amp;gt;]
[-p &amp;lt;&lt;i&gt;portnumber&lt;/i&gt;&amp;gt;]  &lt;/codeblock&gt; 
 &lt;p&gt;You need to specify only the directory where the tracing files will
 reside. The names of the tracing files are determined by the system. If you
 do not set a trace directory, the tracing files will be placed in derby.system.home.&lt;/p&gt;
@@ -56,7 +56,7 @@
 &lt;p&gt;
     See &lt;xref href="tadminnetservcustom.dita#tadminnetservcustom"&gt;&lt;/xref&gt; for
     information about customizing the Network Server's security policy.
-&lt;/p&gt;
+&lt;/p&gt;&lt;/stepxmp&gt;
 &lt;/step&gt;
 &lt;/steps&gt;
 &lt;/taskbody&gt;




</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r888129 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java</title>
<author><name>rhillegas@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091207204610.43D682388978@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091207204610-43D682388978@eris-apache-org%3e</id>
<updated>2009-12-07T20:46:10Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: rhillegas
Date: Mon Dec  7 20:46:09 2009
New Revision: 888129

URL: http://svn.apache.org/viewvc?rev=888129&amp;view=rev
Log:
DERBY-712: Fix problem in 888060 having to do with placement of sanity ifdefs.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java?rev=888129&amp;r1=888128&amp;r2=888129&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java Mon
Dec  7 20:46:09 2009
@@ -65,27 +65,36 @@
         {
             SanityManager.ASSERT( objectOfPrivilege != null,
                                   "null privilge object");
-            switch( this.objectType)
+        }
+        switch( this.objectType)
+        {
+        case TABLE_PRIVILEGES:
+            if( SanityManager.DEBUG)
             {
-            case TABLE_PRIVILEGES:
                 SanityManager.ASSERT( specificPrivileges != null,
                                       "null specific privileges used with table privilege");
-                objectName = (TableName) objectOfPrivilege;
-                this.specificPrivileges = (TablePrivilegesNode) specificPrivileges;
-                break;
-
-            case ROUTINE_PRIVILEGES:
+            }
+            objectName = (TableName) objectOfPrivilege;
+            this.specificPrivileges = (TablePrivilegesNode) specificPrivileges;
+            break;
+            
+        case ROUTINE_PRIVILEGES:
+            if( SanityManager.DEBUG)
+            {
                 SanityManager.ASSERT( specificPrivileges == null,
                                       "non-null specific privileges used with execute privilege");
-                routineDesignator = (RoutineDesignator) objectOfPrivilege;
-                objectName = routineDesignator.name;
-                break;
-
-            default:
+            }
+            routineDesignator = (RoutineDesignator) objectOfPrivilege;
+            objectName = routineDesignator.name;
+            break;
+            
+        default:
+            if( SanityManager.DEBUG)
+            {
                 SanityManager.THROWASSERT( "Invalid privilege objectType: " + this.objectType);
             }
         }
-    } // end of init
+    }
 
     /**
      * Bind this GrantNode. Resolve all table, column, and routine references. Register




</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r888060 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java</title>
<author><name>rhillegas@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091207180301.43D222388893@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091207180301-43D222388893@eris-apache-org%3e</id>
<updated>2009-12-07T18:03:01Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: rhillegas
Date: Mon Dec  7 18:03:00 2009
New Revision: 888060

URL: http://svn.apache.org/viewvc?rev=888060&amp;view=rev
Log:
DERBY-712: Small cleanup of PrivilegeNode before adding support for USAGE privilege.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java?rev=888060&amp;r1=888059&amp;r2=888060&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java Mon
Dec  7 18:03:00 2009
@@ -47,8 +47,9 @@
     public static final int ROUTINE_PRIVILEGES = 1;
 
     private int objectType;
-    private Object objectOfPrivilege;
-    private TablePrivilegesNode specificPrivileges; // Null for routines
+    private TableName objectName;
+    private TablePrivilegesNode specificPrivileges; // Null for routine and usage privs
+    private RoutineDesignator routineDesignator; // null for table and usage privs
 
     /**
      * initialize a PrivilegesNode
@@ -60,8 +61,6 @@
     public void init( Object objectType, Object objectOfPrivilege, Object specificPrivileges)
     {
         this.objectType = ((Integer) objectType).intValue();
-        this.objectOfPrivilege = objectOfPrivilege;
-        this.specificPrivileges = (TablePrivilegesNode) specificPrivileges;
         if( SanityManager.DEBUG)
         {
             SanityManager.ASSERT( objectOfPrivilege != null,
@@ -69,19 +68,17 @@
             switch( this.objectType)
             {
             case TABLE_PRIVILEGES:
-                SanityManager.ASSERT( objectOfPrivilege instanceof TableName,
-                                      "incorrect name type, " + objectOfPrivilege.getClass().getName()
-                                      + ", used with table privilege");
                 SanityManager.ASSERT( specificPrivileges != null,
                                       "null specific privileges used with table privilege");
+                objectName = (TableName) objectOfPrivilege;
+                this.specificPrivileges = (TablePrivilegesNode) specificPrivileges;
                 break;
 
             case ROUTINE_PRIVILEGES:
-                SanityManager.ASSERT( objectOfPrivilege instanceof RoutineDesignator,
-                                      "incorrect name type, " + objectOfPrivilege.getClass().getName()
-                                      + ", used with table privilege");
                 SanityManager.ASSERT( specificPrivileges == null,
                                       "non-null specific privileges used with execute privilege");
+                routineDesignator = (RoutineDesignator) objectOfPrivilege;
+                objectName = routineDesignator.name;
                 break;
 
             default:
@@ -106,71 +103,78 @@
 	public QueryTreeNode bind( HashMap dependencies, List grantees, boolean isGrant ) throws
StandardException
 	{
         Provider dependencyProvider = null;
-        SchemaDescriptor sd = null;
-		
+        SchemaDescriptor sd = getSchemaDescriptor( objectName.getSchemaName(), true);
+        objectName.setSchemaName( sd.getSchemaName() );
+        
+        // Can not grant/revoke permissions from self
+        if (grantees.contains(sd.getAuthorizationId()))
+        {
+            throw StandardException.newException
+                (SQLState.AUTH_GRANT_REVOKE_NOT_ALLOWED, objectName.getFullTableName());
+        }
+
         switch( objectType)
         {
         case TABLE_PRIVILEGES:
-            TableName tableName = (TableName) objectOfPrivilege;
-            sd = getSchemaDescriptor( tableName.getSchemaName(), true);
+
+            // can't grant/revoke privileges on system tables
             if (sd.isSystemSchema())
-                throw StandardException.newException(SQLState.AUTH_GRANT_REVOKE_NOT_ALLOWED,
tableName.getFullTableName());
-				
-            TableDescriptor td = getTableDescriptor( tableName.getTableName(), sd);
+            {
+                throw StandardException.newException(SQLState.AUTH_GRANT_REVOKE_NOT_ALLOWED,
objectName.getFullTableName());
+            }
+            
+            TableDescriptor td = getTableDescriptor( objectName.getTableName(), sd);
             if( td == null)
-                throw StandardException.newException( SQLState.LANG_TABLE_NOT_FOUND, tableName);
+            {
+                throw StandardException.newException( SQLState.LANG_TABLE_NOT_FOUND, objectName);
+            }
 
             // Don't allow authorization on SESSION schema tables. Causes confusion if
             // a temporary table is created later with same name.
             if (isSessionSchema(sd.getSchemaName()))
+            {
                 throw StandardException.newException(SQLState.LANG_OPERATION_NOT_ALLOWED_ON_SESSION_SCHEMA_TABLES);
+            }
 
             if (td.getTableType() != TableDescriptor.BASE_TABLE_TYPE &amp;&amp;
             		td.getTableType() != TableDescriptor.VIEW_TYPE)
-                throw StandardException.newException(SQLState.AUTH_GRANT_REVOKE_NOT_ALLOWED,
tableName.getFullTableName());
-
-			// Can not grant/revoke permissions from self
-			if (grantees.contains(sd.getAuthorizationId()))
-				throw StandardException.newException(SQLState.AUTH_GRANT_REVOKE_NOT_ALLOWED,
-						 td.getQualifiedName());
+            {
+                throw StandardException.newException(SQLState.AUTH_GRANT_REVOKE_NOT_ALLOWED,
objectName.getFullTableName());
+            }
 
             specificPrivileges.bind( td, isGrant);
             dependencyProvider = td;
             break;
 
         case ROUTINE_PRIVILEGES:
-            RoutineDesignator rd = (RoutineDesignator) objectOfPrivilege;
-            sd = getSchemaDescriptor( rd.name.getSchemaName(), true);
-
             if (!sd.isSchemaWithGrantableRoutines())
-                throw StandardException.newException(SQLState.AUTH_GRANT_REVOKE_NOT_ALLOWED,
rd.name.getFullTableName());
+            {
+                throw StandardException.newException(SQLState.AUTH_GRANT_REVOKE_NOT_ALLOWED,
objectName.getFullTableName());
+            }
 				
             AliasDescriptor proc = null;
             RoutineAliasInfo routineInfo = null;
             java.util.List list = getDataDictionary().getRoutineList(
-                sd.getUUID().toString(), rd.name.getTableName(),
-                rd.isFunction ? AliasInfo.ALIAS_NAME_SPACE_FUNCTION_AS_CHAR : AliasInfo.ALIAS_NAME_SPACE_PROCEDURE_AS_CHAR
+                sd.getUUID().toString(), objectName.getTableName(),
+                routineDesignator.isFunction ? AliasInfo.ALIAS_NAME_SPACE_FUNCTION_AS_CHAR
: AliasInfo.ALIAS_NAME_SPACE_PROCEDURE_AS_CHAR
                 );
 
-			// Can not grant/revoke permissions from self
-			if (grantees.contains(sd.getAuthorizationId()))
-				throw StandardException.newException(SQLState.AUTH_GRANT_REVOKE_NOT_ALLOWED,
-						 rd.name.getFullTableName());
-
-            if( rd.paramTypeList == null)
+            if( routineDesignator.paramTypeList == null)
             {
                 // No signature was specified. Make sure that there is exactly one routine
with that name.
                 if( list.size() &gt; 1)
-                    throw StandardException.newException( ( rd.isFunction ? SQLState.LANG_AMBIGUOUS_FUNCTION_NAME
+                {
+                    throw StandardException.newException( ( routineDesignator.isFunction
? SQLState.LANG_AMBIGUOUS_FUNCTION_NAME
                                                             : SQLState.LANG_AMBIGUOUS_PROCEDURE_NAME),
-                                                          rd.name.getFullTableName());
+                                                          objectName.getFullTableName());
+                }
                 if( list.size() != 1) {
-                    if (rd.isFunction) {
+                    if (routineDesignator.isFunction) {
                         throw StandardException.newException(SQLState.LANG_NO_SUCH_FUNCTION,

-                                rd.name.getFullTableName());
+                                objectName.getFullTableName());
                     } else {
                         throw StandardException.newException(SQLState.LANG_NO_SUCH_PROCEDURE,

-                                rd.name.getFullTableName());
+                                objectName.getFullTableName());
                     }
                 }
                 proc = (AliasDescriptor) list.get(0);
@@ -185,13 +189,13 @@
 
                     routineInfo = (RoutineAliasInfo) proc.getAliasInfo();
                     int parameterCount = routineInfo.getParameterCount();
-                    if (parameterCount != rd.paramTypeList.size())
+                    if (parameterCount != routineDesignator.paramTypeList.size())
                         continue;
                     TypeDescriptor[] parameterTypes = routineInfo.getParameterTypes();
                     found = true;
                     for( int parmIdx = 0; parmIdx &lt; parameterCount; parmIdx++)
                     {
-                        if( ! parameterTypes[parmIdx].equals( rd.paramTypeList.get( parmIdx)))
+                        if( ! parameterTypes[parmIdx].equals( routineDesignator.paramTypeList.get(
parmIdx)))
                         {
                             found = false;
                             break;
@@ -201,20 +205,23 @@
                 if( ! found)
                 {
                     // reconstruct the signature for the error message
-                    StringBuffer sb = new StringBuffer( rd.name.getFullTableName());
+                    StringBuffer sb = new StringBuffer( objectName.getFullTableName());
                     sb.append( "(");
-                    for( int i = 0; i &lt; rd.paramTypeList.size(); i++)
+                    for( int i = 0; i &lt; routineDesignator.paramTypeList.size(); i++)
                     {
                         if( i &gt; 0)
                             sb.append(",");
-                        sb.append( rd.paramTypeList.get(i).toString());
+                        sb.append( routineDesignator.paramTypeList.get(i).toString());
                     }
                     throw StandardException.newException(SQLState.LANG_NO_SUCH_METHOD_ALIAS,
sb.toString());
                 }
             }
-            rd.setAliasDescriptor( proc);
+            routineDesignator.setAliasDescriptor( proc);
             dependencyProvider = proc;
             break;
+
+        default:
+                SanityManager.THROWASSERT( "Invalid privilege objectType: " + this.objectType);
         }
 
         if( dependencyProvider != null)
@@ -239,7 +246,7 @@
             return specificPrivileges.makePrivilegeInfo();
 
         case ROUTINE_PRIVILEGES:
-            return ((RoutineDesignator) objectOfPrivilege).makePrivilegeInfo();
+            return routineDesignator.makePrivilegeInfo();
         }
         return null;
     }




</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r887826 - in /db/derby/docs/trunk/src: adminguide/cadminspace21579.dita ref/rrefsyscsdiagtables.dita</title>
<author><name>bpendleton@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091207031248.AF440238888E@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091207031248-AF440238888E@eris-apache-org%3e</id>
<updated>2009-12-07T03:12:48Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: bpendleton
Date: Mon Dec  7 03:12:47 2009
New Revision: 887826

URL: http://svn.apache.org/viewvc?rev=887826&amp;view=rev
Log:
DERBY-1160: Document use of SPACE_TABLE to display space that is recoverable

This change adds additional documentation to both the Admin guide and the
Reference guide. In the Admin guide, the change adds information about using
SPACE_TABLE to estimate the space that could be reclaimed. In the Reference
guide, the change adds information about the columns that are returned by
the SPACE_TABLE function; this information duplicates the information that
is in the engine Javadocs, but since we don't anticipate that users will
generally read the engine Javadocs, and since those docs are generated from
the development sources which may not match the behavior of SPACE_TABLE for a
particular release, I think it is reasonable to have that information
available in the Reference guide.


Modified:
    db/derby/docs/trunk/src/adminguide/cadminspace21579.dita
    db/derby/docs/trunk/src/ref/rrefsyscsdiagtables.dita

Modified: db/derby/docs/trunk/src/adminguide/cadminspace21579.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/adminguide/cadminspace21579.dita?rev=887826&amp;r1=887825&amp;r2=887826&amp;view=diff
==============================================================================
--- db/derby/docs/trunk/src/adminguide/cadminspace21579.dita (original)
+++ db/derby/docs/trunk/src/adminguide/cadminspace21579.dita Mon Dec  7 03:12:47 2009
@@ -43,6 +43,19 @@
 recover all available space. The difference between the two procedures is
 that unlike SYSCS_COMPRESS_TABLE, the SYSCS_INPLACE_COMPRESS procedure uses
 no temporary files and moves rows around within the same conglomerate.&lt;/p&gt;
+&lt;p&gt;
+You can use the SYSCS_DIAG.SPACE_TABLE diagnostic table to estimate the
+amount of unused space in a table or index by examining, in particular, the
+values of the NUMFREEPAGES and ESTIMSPACESAVING columns. For example:
+&lt;/p&gt;
+&lt;codeblock&gt;
+SELECT * FROM TABLE(SYSCS_DIAG.SPACE_TABLE('APP', 'FLIGHTAVAILABILITY')) AS T
+&lt;/codeblock&gt;
+&lt;p&gt;
+For more information about SYSCS_DIAG.SPACE_TABLE, see "SYSCS_DIAG
+diagnostic tables and functions" in the
+&lt;cite&gt;&lt;ph conref="../conrefs.dita#pub/citref"&gt;&lt;/ph&gt;&lt;/cite&gt;.
+&lt;/p&gt;
 &lt;example&gt;&lt;p&gt;As an example, after you have determined that the FlightAvailability
 table and its related indexes have too much unused space, you could reclaim
 that space with the following command:&lt;/p&gt;&lt;codeblock&gt;call SYSCS_UTIL.SYSCS_COMPRESS_TABLE('APP',
'FLIGHTAVAILABILITY', 0);&lt;/codeblock&gt;&lt;p&gt; The

Modified: db/derby/docs/trunk/src/ref/rrefsyscsdiagtables.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/ref/rrefsyscsdiagtables.dita?rev=887826&amp;r1=887825&amp;r2=887826&amp;view=diff
==============================================================================
--- db/derby/docs/trunk/src/ref/rrefsyscsdiagtables.dita (original)
+++ db/derby/docs/trunk/src/ref/rrefsyscsdiagtables.dita Mon Dec  7 03:12:47 2009
@@ -167,7 +167,79 @@
 the SQL table function syntax. This diagnostic table function takes two arguments,
 the &lt;parmname&gt;schemaName&lt;/parmname&gt; and the &lt;parmname&gt;tableName&lt;/parmname&gt;.
 The &lt;parmname&gt;tableName&lt;/parmname&gt; argument is required. If you do not specify
-the &lt;parmname&gt;schemaName&lt;/parmname&gt;, the current schema is used. &lt;/p&gt;&lt;p&gt;For
+the &lt;parmname&gt;schemaName&lt;/parmname&gt;, the current schema is used. &lt;/p&gt;
+&lt;p&gt;
+The returned table has the following columns:
+&lt;table pgwide="1" frame="all"&gt;
+    &lt;tgroup cols="5" colsep="1" rowsep="1"&gt;
+        &lt;colspec colname="1" colnum="1" colwidth="2784*"/&gt;
+        &lt;colspec colname="2" colnum="2" colwidth="2185*"/&gt;
+        &lt;colspec colname="3" colnum="3" colwidth="814*"/&gt;
+        &lt;colspec colname="4" colnum="4" colwidth="1003*"/&gt;
+        &lt;colspec colname="5" colnum="5" colwidth="2902*"/&gt;
+&lt;thead&gt;
+&lt;row&gt;
+&lt;entry align="left" colname="1" valign="bottom"&gt;Column Name&lt;/entry&gt;
+&lt;entry align="left" colname="2" valign="bottom"&gt;Type&lt;/entry&gt;
+&lt;entry align="left" colname="3" valign="bottom"&gt;Length&lt;/entry&gt;
+&lt;entry align="left" colname="4" valign="bottom"&gt;Nullability&lt;/entry&gt;
+&lt;entry align="left" colname="5" valign="bottom"&gt;Contents&lt;/entry&gt;
+&lt;/row&gt;
+&lt;/thead&gt;
+&lt;tbody&gt;
+&lt;row&gt;
+&lt;entry colname="1"&gt;CONGLOMERATENAME&lt;/entry&gt;
+&lt;entry colname="2"&gt;VARCHAR&lt;/entry&gt;
+&lt;entry colname="3"&gt;128&lt;/entry&gt;
+&lt;entry colname="4"&gt;true&lt;/entry&gt;
+&lt;entry colname="5"&gt;The name of the conglomerate, which is either the table name or
the index name. (Unlike the SYSCONGLOMERATES column of the same name, table ID's do not appear
here).&lt;/entry&gt;
+&lt;/row&gt;
+&lt;row&gt;
+&lt;entry colname="1"&gt;ISINDEX&lt;/entry&gt;
+&lt;entry colname="2"&gt;SMALLINT&lt;/entry&gt;
+&lt;entry colname="3"&gt;&lt;/entry&gt;
+&lt;entry colname="4"&gt;false&lt;/entry&gt;
+&lt;entry colname="5"&gt;Is not zero if the conglomerate is an index, 0 otherwise.&lt;/entry&gt;
+&lt;/row&gt;
+&lt;row&gt;
+&lt;entry colname="1"&gt;NUMALLOCATEDPAGES&lt;/entry&gt;
+&lt;entry colname="2"&gt;BIGINT&lt;/entry&gt;
+&lt;entry colname="3"&gt;&lt;/entry&gt;
+&lt;entry colname="4"&gt;false&lt;/entry&gt;
+&lt;entry colname="5"&gt;The number of pages actively linked into the table. The total number
of pages in the file is the sum of NUMALLOCATEDPAGES + NUMFREEPAGES.&lt;/entry&gt;
+&lt;/row&gt;
+&lt;row&gt;
+&lt;entry colname="1"&gt;NUMFREEPAGES&lt;/entry&gt;
+&lt;entry colname="2"&gt;BIGINT&lt;/entry&gt;
+&lt;entry colname="3"&gt;&lt;/entry&gt;
+&lt;entry colname="4"&gt;false&lt;/entry&gt;
+&lt;entry colname="5"&gt;The number of free pages that belong to the table. When a new page
is to be linked into the table the system will move a page from the NUMFREEPAGES list to the
NUMALLOCATEDPAGES list. The total number of pages in the file is the sum of NUMALLOCATEDPAGES
+ NUMFREEPAGES.&lt;/entry&gt;
+&lt;/row&gt;
+&lt;row&gt;
+&lt;entry colname="1"&gt;NUMUNFILLEDPAGES&lt;/entry&gt;
+&lt;entry colname="2"&gt;BIGINT&lt;/entry&gt;
+&lt;entry colname="3"&gt;&lt;/entry&gt;
+&lt;entry colname="4"&gt;false&lt;/entry&gt;
+&lt;entry colname="5"&gt;The number of unfilled pages that belong to the table. Unfilled
pages are allocated pages that are not completely full. Note that the number of unfilled pages
is an estimate and is not exact. Running the same query twice can give different results on
this column.&lt;/entry&gt;
+&lt;/row&gt;
+&lt;row&gt;
+&lt;entry colname="1"&gt;PAGESIZE&lt;/entry&gt;
+&lt;entry colname="2"&gt;INTEGER&lt;/entry&gt;
+&lt;entry colname="3"&gt;&lt;/entry&gt;
+&lt;entry colname="4"&gt;false&lt;/entry&gt;
+&lt;entry colname="5"&gt;The size of the page in bytes for that conglomerate.&lt;/entry&gt;
+&lt;/row&gt;
+&lt;row&gt;
+&lt;entry colname="1"&gt;ESTIMSPACESAVING&lt;/entry&gt;
+&lt;entry colname="2"&gt;BIGINT&lt;/entry&gt;
+&lt;entry colname="3"&gt;&lt;/entry&gt;
+&lt;entry colname="4"&gt;false&lt;/entry&gt;
+&lt;entry colname="5"&gt;The estimated space which could possibly be saved by compressing
the conglomerate, in bytes.&lt;/entry&gt;
+&lt;/row&gt;
+                    &lt;/tbody&gt;
+                &lt;/tgroup&gt;
+        &lt;/table&gt;&lt;/p&gt;
+&lt;p&gt;For
 example, use the following query to return the space usage for all of the
 user tables and indexes in the database: &lt;codeblock&gt;SELECT T2.*
     FROM 




</pre>
</div>
</content>
</entry>
<entry>
<title>=?utf-8?q?=5BDb-derby_Wiki=5D_Update_of_=22UsesOfDerby=22_by_bobwoodbury?=</title>
<author><name>Apache Wiki &lt;wikidiffs@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091206013017.26866.39073@eos.apache.org%3e"/>
<id>urn:uuid:%3c20091206013017-26866-39073@eos-apache-org%3e</id>
<updated>2009-12-06T01:30:17Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Db-derby Wiki" for change notification.

The "UsesOfDerby" page has been changed by bobwoodbury.
http://wiki.apache.org/db-derby/UsesOfDerby?action=diff&amp;rev1=87&amp;rev2=88

--------------------------------------------------

  || DB Visual Architect for Eclipse || http://www.eclipseplugincentral.com/displayarticle429.html
|| support@eclipseplugincentral.com ||
  || DBVisualizer || http://www.minq.se/products/dbvis/  || support@minq.se ||
  || Derby/G || Derby/G is a research prototype implementing the GORDA Architecture and Programming
Interface (GAPI) (for database replication) on Apache Derby.&lt;&lt;BR&gt;&gt;http://gorda.di.uminho.pt/community/derbyg/
|| http://gorda.di.uminho.pt/community/lists ||
+ || Diapason digital media organizer || http://sourceforge.net/projects/diapason/ || ||
  || Drone (IRC bot) || http://drone.codehaus.org/Configuration+Database || gbevin@codehaus.org
||
  || Easysoft Data Access || http://www.easysoft.com/products/data_access/index.html || support@easysoft.com
||
  || Eclipse BIRT Business Intelligence and Reporting Tools || http://www.eclipse.org/birt/phoenix/db/
|| birt-dev@eclipse.org ||


</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r887475 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericStatement.java</title>
<author><name>bpendleton@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091205010124.1A5A72388996@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091205010124-1A5A72388996@eris-apache-org%3e</id>
<updated>2009-12-05T01:01:24Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: bpendleton
Date: Sat Dec  5 01:01:23 2009
New Revision: 887475

URL: http://svn.apache.org/viewvc?rev=887475&amp;view=rev
Log:
DERBY-4297: XplainStatisticsTest 'compilation time did not compute'

This change adjusts the technique used to compute the compileTime counter
in GenericStatement.prepMinion so that the following invariant will hold:

  parseTime + bindTime + optimizeTime + generateTime = compileTime

Previously, there was a small window after generateTime had been computed
but before compileTime had been recorded, during which the value of the
System.currentTimeMillis clock could change, resulting in a situation where
compileTime was too large, typically by 15 or 16 milliseconds.


Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericStatement.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericStatement.java?rev=887475&amp;r1=887474&amp;r2=887475&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericStatement.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericStatement.java Sat Dec
 5 01:01:23 2009
@@ -521,7 +521,7 @@
 						bindTime - parseTime, //bind time
 						optimizeTime - bindTime, //optimize time
 						generateTime - optimizeTime, //generate time
-						getElapsedTimeMillis(beginTime),
+						generateTime - beginTime, //total compile time
 						beginTimestamp,
 						endTimestamp);
 				}




</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r887305 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby151Test.java</title>
<author><name>dag@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091204181007.6427A23888FE@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091204181007-6427A23888FE@eris-apache-org%3e</id>
<updated>2009-12-04T18:10:07Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: dag
Date: Fri Dec  4 18:10:06 2009
New Revision: 887305

URL: http://svn.apache.org/viewvc?rev=887305&amp;view=rev
Log:
DERBY-4461

Committed fix which resets the interrupt flag in the test's
application thread.  Not resetting it caused issues on Windows and
Linux downstream (in teardown).


Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby151Test.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby151Test.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby151Test.java?rev=887305&amp;r1=887304&amp;r2=887305&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby151Test.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby151Test.java
Fri Dec  4 18:10:06 2009
@@ -150,6 +150,12 @@
             println("Not able to test fix for DERBY-151: No interrupt seen");
         } catch (SQLException e) {
             assertSQLState("XSDG9", e);
+            // Clearing the interrupt flag; makes sense for embedded part of
+            // the test. When running c/s, it would be the server thread which
+            // receives the interrupt, and since db is shut down, that should
+            // be ok for later tests. We need to clear the flag here since, for
+            // embedded, the app thread is affected.
+            Thread.currentThread().interrupted();
         }
     }
 }




</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r887249 - in /db/derby/code/branches/10.5: ./ java/engine/org/apache/derby/impl/sql/compile/PredicateList.java java/testing/org/apache/derbyTesting/functionTests/tests/lang/JoinTest.java</title>
<author><name>dag@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091204161730.9FE9A23888EC@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091204161730-9FE9A23888EC@eris-apache-org%3e</id>
<updated>2009-12-04T16:17:30Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: dag
Date: Fri Dec  4 16:17:29 2009
New Revision: 887249

URL: http://svn.apache.org/viewvc?rev=887249&amp;view=rev
Log:
DERBY-4387 Infinite loop in PredicateList.joinClauseTransitiveClosure()

This patch, derby-4387, fixes a corner case of the closure code in
which the outer and the inner table is the same. This led to adding
the same, new predicate twice to the same table, causing the infinite
loop. The patch also adds a test case, which, without the fix, shows
the infinite loop.

Backported from trunk with:

svn merge -c 887246 https://svn.apache.org/repos/asf/db/derby/code/trunk


Modified:
    db/derby/code/branches/10.5/   (props changed)
    db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/JoinTest.java

Propchange: db/derby/code/branches/10.5/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Dec  4 16:17:29 2009
@@ -1 +1 @@
-/db/derby/code/trunk:769596,769602,769606,769962,772090,772337,772449,772534,774281,777105,779681,782991,785131,785139,785163,785570,785662,788369,788670,788674,788968,789264,790218,792434,793089,793588,794106,794303,794955,795166,796020,796027,796316,796372,797147,798347,798742,800523,803548,803948,805696,808494,808850,809643,810860,812669,816531,816536,819006,822289,823659,824694,829022,832379,833430,882732,884163
+/db/derby/code/trunk:769596,769602,769606,769962,772090,772337,772449,772534,774281,777105,779681,782991,785131,785139,785163,785570,785662,788369,788670,788674,788968,789264,790218,792434,793089,793588,794106,794303,794955,795166,796020,796027,796316,796372,797147,798347,798742,800523,803548,803948,805696,808494,808850,809643,810860,812669,816531,816536,819006,822289,823659,824694,829022,832379,833430,882732,884163,887246

Modified: db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java?rev=887249&amp;r1=887248&amp;r2=887249&amp;view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java
(original)
+++ db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java
Fri Dec  4 16:17:29 2009
@@ -2202,7 +2202,14 @@
 					{
 						outerJCL.addElement(newPred);
 					}
-					innerJCL.addElement(newPred);
+
+                    if (outerJCL != innerJCL) {
+                        innerJCL.addElement(newPred);
+                    } else {
+                        // DERBY-4387: Avoid adding &lt;t1&gt;.a = &lt;t1&gt;.b twice to
+                        // the same predicate list, so do nothing since we
+                        // already added predicate to outerJCL above.
+                    }
 				}
 			}
 		}

Modified: db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/JoinTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/JoinTest.java?rev=887249&amp;r1=887248&amp;r2=887249&amp;view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/JoinTest.java
(original)
+++ db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/JoinTest.java
Fri Dec  4 16:17:29 2009
@@ -191,4 +191,50 @@
         s.execute("drop table d4372_1");
         s.execute("drop table d4372_2");
     }
+
+
+    /**
+     * Test that computation of transitive closure of equi-join does not give
+     * rise to eternal loop in a case where a predicate of type T1.x = T1.y is
+     * added to the closure.
+     * @throws SQLException
+     */
+    public void testDerby4387() throws SQLException {
+        setAutoCommit(false);
+        Statement s = createStatement();
+        ResultSet rs;
+
+
+        s.executeUpdate("create table c (a int, b int, c int)");
+        s.executeUpdate("create table cc (aa int)");
+
+        // Compiling this query gave an infinite loop (would eventually run out
+        // of memory though) before the fix:
+        rs = s.executeQuery("select * from cc t1, c t2, cc t3 " +
+                            "    where t3.aa = t2.a and " +
+                            "          t3.aa = t2.b and " +
+                            "          t3.aa = t2.c");
+
+        // After the fix the correct joinClauses table should look like this
+        // when done (see PredicateList#joinClauseTransitiveClosure variable
+        // joinClauses), where EC is equivalence class assigned, and a *
+        // denotes a predicate added by the closure computation.
+        //
+        // [0]: (t1)
+        // [1]: (t2)
+        //    [0]: 2.1 = 1.1 EC: 0     i.e.  t3.aa == t2.a
+        //    [1]: 1.1 = 1.3 EC: 0           t2.a  == t2.c *
+        //    [2]: 1.1 = 1.2 EC: 0           t2.a  == t2.b *
+        //    [3]: 2.1 = 1.2 EC: 0           t3.aa == t2.b
+        //    [4]: 2.1 = 1.3 EC: 0           t3.aa == t2.c
+        // [2]: (t3)
+        //    [0]: 2.1 = 1.1 EC: 0           t3.aa == t2.a
+        //    [1]: 2.1 = 1.2 EC: 0           t3.aa == t2.b
+        //    [2]: 2.1 = 1.3 EC: 0           t3.aa == t2.c
+        //
+        // Before the fix, the derived predicates (e.g. t2.a == t2.b) were
+        // added twice and caused an infinite loop.
+
+        rollback();
+    }
 }




</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r887246 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/sql/compile/PredicateList.java testing/org/apache/derbyTesting/functionTests/tests/lang/JoinTest.java</title>
<author><name>dag@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091204161004.91EB523888EC@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091204161004-91EB523888EC@eris-apache-org%3e</id>
<updated>2009-12-04T16:10:04Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: dag
Date: Fri Dec  4 16:10:04 2009
New Revision: 887246

URL: http://svn.apache.org/viewvc?rev=887246&amp;view=rev
Log:
DERBY-4387 Infinite loop in PredicateList.joinClauseTransitiveClosure()

This patch, derby-4387, fixes a corner case of the closure code in
which the outer and the inner table is the same. This led to adding
the same, new predicate twice to the same table, causing the infinite
loop. The patch also adds a test case, which, without the fix, shows
the infinite loop.



Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/JoinTest.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java?rev=887246&amp;r1=887245&amp;r2=887246&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java Fri
Dec  4 16:10:04 2009
@@ -2179,7 +2179,14 @@
 					{
 						outerJCL.addElement(newPred);
 					}
-					innerJCL.addElement(newPred);
+
+                    if (outerJCL != innerJCL) {
+                        innerJCL.addElement(newPred);
+                    } else {
+                        // DERBY-4387: Avoid adding &lt;t1&gt;.a = &lt;t1&gt;.b twice to
+                        // the same predicate list, so do nothing since we
+                        // already added predicate to outerJCL above.
+                    }
 				}
 			}
 		}

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/JoinTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/JoinTest.java?rev=887246&amp;r1=887245&amp;r2=887246&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/JoinTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/JoinTest.java
Fri Dec  4 16:10:04 2009
@@ -739,4 +739,50 @@
             "select * from t1 join t2 on exists " +
             "(select * from t3 x left join t3 y on 1=0 where y.c=1)"));
     }
+
+
+    /**
+     * Test that computation of transitive closure of equi-join does not give
+     * rise to eternal loop in a case where a predicate of type T1.x = T1.y is
+     * added to the closure.
+     * @throws SQLException
+     */
+    public void testDerby4387() throws SQLException {
+        setAutoCommit(false);
+        Statement s = createStatement();
+        ResultSet rs;
+
+
+        s.executeUpdate("create table c (a int, b int, c int)");
+        s.executeUpdate("create table cc (aa int)");
+
+        // Compiling this query gave an infinite loop (would eventually run out
+        // of memory though) before the fix:
+        rs = s.executeQuery("select * from cc t1, c t2, cc t3 " +
+                            "    where t3.aa = t2.a and " +
+                            "          t3.aa = t2.b and " +
+                            "          t3.aa = t2.c");
+
+        // After the fix the correct joinClauses table should look like this
+        // when done (see PredicateList#joinClauseTransitiveClosure variable
+        // joinClauses), where EC is equivalence class assigned, and a *
+        // denotes a predicate added by the closure computation.
+        //
+        // [0]: (t1)
+        // [1]: (t2)
+        //    [0]: 2.1 = 1.1 EC: 0     i.e.  t3.aa == t2.a
+        //    [1]: 1.1 = 1.3 EC: 0           t2.a  == t2.c *
+        //    [2]: 1.1 = 1.2 EC: 0           t2.a  == t2.b *
+        //    [3]: 2.1 = 1.2 EC: 0           t3.aa == t2.b
+        //    [4]: 2.1 = 1.3 EC: 0           t3.aa == t2.c
+        // [2]: (t3)
+        //    [0]: 2.1 = 1.1 EC: 0           t3.aa == t2.a
+        //    [1]: 2.1 = 1.2 EC: 0           t3.aa == t2.b
+        //    [2]: 2.1 = 1.3 EC: 0           t3.aa == t2.c
+        //
+        // Before the fix, the derived predicates (e.g. t2.a == t2.b) were
+        // added twice and caused an infinite loop.
+
+        rollback();
+    }
 }




</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r887156 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/sql/compile/ testing/org/apache/derbyTesting/functionTests/tests/lang/</title>
<author><name>kahatlen@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091204110217.6748323888FD@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091204110217-6748323888FD@eris-apache-org%3e</id>
<updated>2009-12-04T11:02:17Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: kahatlen
Date: Fri Dec  4 11:02:16 2009
New Revision: 887156

URL: http://svn.apache.org/viewvc?rev=887156&amp;view=rev
Log:
DERBY-2282: Incorrect "transitive closure" logic leads to inconsistent behavior for binary
comparison predicates

Made the transitive closure logic normalize predicates so that the
constants are on the right-hand side (e.g., convert 3 &lt; X to X &gt; 3).
This makes it detect more of the potential optimizations.

Added:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/PredicateTest.java
  (with props)
Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryComparisonOperatorNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryOperatorNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryRelationalOperatorNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryComparisonOperatorNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryComparisonOperatorNode.java?rev=887156&amp;r1=887155&amp;r2=887156&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryComparisonOperatorNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryComparisonOperatorNode.java
Fri Dec  4 11:02:16 2009
@@ -336,6 +336,25 @@
 										  ValueNode rightOperand)
 				throws StandardException;
 
+    /**
+     * &lt;p&gt;
+     * Return a node equivalent to this node, but with the left and right
+     * operands swapped. The node type may also be changed if the operator
+     * is not symmetric.
+     * &lt;/p&gt;
+     *
+     * &lt;p&gt;
+     * This method may for instance be used to normalize a predicate by
+     * moving constants to the right-hand side of the comparison. Example:
+     * {@code 1 = A} will be transformed to {@code A = 1}, and {@code 10 &lt; B}
+     * will be transformed to {@code B &gt; 10}.
+     * &lt;/p&gt;
+     *
+     * @return an equivalent expression with the operands swapped
+     * @throws StandardException if an error occurs
+     */
+    abstract BinaryOperatorNode getSwappedEquivalent() throws StandardException;
+
 	/**
 	 * Finish putting an expression into conjunctive normal
 	 * form.  An expression tree in conjunctive normal form meets

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryOperatorNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryOperatorNode.java?rev=887156&amp;r1=887155&amp;r2=887156&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryOperatorNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryOperatorNode.java
Fri Dec  4 11:02:16 2009
@@ -839,20 +839,6 @@
 	}
 
 	/**
-	 * Swap the left and right sides.
-	 */
-	void swapOperands()
-	{
-		String	  tmpInterfaceType = leftInterfaceType;
-		ValueNode tmpVN = leftOperand;
-
-		leftOperand = rightOperand;
-		rightOperand = tmpVN;
-		leftInterfaceType = rightInterfaceType;
-		rightInterfaceType = tmpInterfaceType;
-	}
-
-	/**
 	 * Accept the visitor for all visitable children of this node.
 	 * 
 	 * @param v the visitor

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryRelationalOperatorNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryRelationalOperatorNode.java?rev=887156&amp;r1=887155&amp;r2=887156&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryRelationalOperatorNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BinaryRelationalOperatorNode.java
Fri Dec  4 11:02:16 2009
@@ -1083,7 +1083,54 @@
 
 		return -1;
 	}	
-	
+
+    /**
+     * Return an equivalent node with the operands swapped, and possibly with
+     * the operator type changed in order to preserve the meaning of the
+     * expression.
+     */
+    BinaryOperatorNode getSwappedEquivalent() throws StandardException {
+        BinaryOperatorNode newNode = (BinaryOperatorNode) getNodeFactory().getNode(getNodeTypeForSwap(),
+                rightOperand, leftOperand,
+                getContextManager());
+        newNode.setType(getTypeServices());
+        return newNode;
+    }
+
+    /**
+     * Return the node type that must be used in order to construct an
+     * equivalent expression if the operands are swapped. For symmetric
+     * operators ({@code =} and {@code &lt;&gt;}), the same node type is returned.
+     * Otherwise, the direction of the operator is switched in order to
+     * preserve the meaning (for instance, a node representing less-than will
+     * return the node type for greater-than).
+     *
+     * @return a node type that preserves the meaning of the expression if
+     * the operands are swapped
+     */
+    private int getNodeTypeForSwap() {
+        switch (getNodeType()) {
+            case C_NodeTypes.BINARY_EQUALS_OPERATOR_NODE:
+                return C_NodeTypes.BINARY_EQUALS_OPERATOR_NODE;
+            case C_NodeTypes.BINARY_GREATER_EQUALS_OPERATOR_NODE:
+                return C_NodeTypes.BINARY_LESS_EQUALS_OPERATOR_NODE;
+            case C_NodeTypes.BINARY_GREATER_THAN_OPERATOR_NODE:
+                return C_NodeTypes.BINARY_LESS_THAN_OPERATOR_NODE;
+            case C_NodeTypes.BINARY_LESS_THAN_OPERATOR_NODE:
+                return C_NodeTypes.BINARY_GREATER_THAN_OPERATOR_NODE;
+            case C_NodeTypes.BINARY_LESS_EQUALS_OPERATOR_NODE:
+                return C_NodeTypes.BINARY_GREATER_EQUALS_OPERATOR_NODE;
+            case C_NodeTypes.BINARY_NOT_EQUALS_OPERATOR_NODE:
+                return C_NodeTypes.BINARY_NOT_EQUALS_OPERATOR_NODE;
+            default:
+                if (SanityManager.DEBUG) {
+                    SanityManager.THROWASSERT(
+                            "Invalid nodeType: " + getNodeType());
+                }
+                return -1;
+        }
+    }
+
 	/**
 	 * is this is useful start key? for example a predicate of the from
 	 * &lt;em&gt;column Lessthan 5&lt;/em&gt; is not a useful start key but is a useful stop

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java?rev=887156&amp;r1=887155&amp;r2=887156&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/PredicateList.java Fri
Dec  4 11:02:16 2009
@@ -2271,10 +2271,10 @@
 				{
 					searchClauses.addElement(predicate);
 				}
-				else if (right instanceof ConstantNode &amp;&amp; left instanceof ColumnReference)
+				else if (left instanceof ConstantNode &amp;&amp; right instanceof ColumnReference)
 				{
 					// put the ColumnReference on the left to simplify things
-					bcon.swapOperands();
+					andNode.setLeftOperand(bcon.getSwappedEquivalent());
 					searchClauses.addElement(predicate);
 				}
 				continue;

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/PredicateTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/PredicateTest.java?rev=887156&amp;view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/PredicateTest.java
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/PredicateTest.java
Fri Dec  4 11:02:16 2009
@@ -0,0 +1,137 @@
+/*
+ * Class org.apache.derbyTesting.functionTests.tests.lang.PredicateTest
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.derbyTesting.functionTests.tests.lang;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.StringReader;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import junit.framework.Test;
+import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.JDBC;
+import org.apache.derbyTesting.junit.TestConfiguration;
+
+/**
+ * This class contains test cases for the correct handling of predicates in
+ * SQL queries.
+ */
+public class PredicateTest extends BaseJDBCTestCase {
+    public PredicateTest(String name) {
+        super(name);
+    }
+
+    public static Test suite() {
+        // We're testing engine functionality, so run in embedded only.
+        return TestConfiguration.embeddedSuite(PredicateTest.class);
+    }
+
+    /**
+     * DERBY-2282: Test that we're able to compute the transitive closure of
+     * predicates with constants on the left side of the comparison operator.
+     */
+    public void testTransitiveClosureWithConstantsOnLeftSide()
+            throws SQLException, IOException {
+
+        setAutoCommit(false); // let tables be cleaned up automatically
+
+        Statement s = createStatement();
+
+        // insert test data
+        s.execute("create table t1 (i int)");
+        s.execute("create table t2 (j int)");
+        s.execute("insert into t1 values 1, 5, 7, 11, 13, 17, 19");
+        s.execute("insert into t2 values 23, 29, 31, 37, 43, 47, 53");
+        s.execute("insert into t1 select 23 * i from t1 where i &lt; 19");
+        s.execute("insert into t2 select 23 * j from t2 where j &lt; 55");
+
+        // enable runtime statistics
+        s.execute("call syscs_util.syscs_set_runtimestatistics(1)");
+
+        // Following will show two qualifiers for T2 and three for T1
+        // because transitive closure adds two new qualifiers, "t2.j &gt;= 23"
+        // and "t1.i &lt;= 30" to the list.
+        JDBC.assertSingleValueResultSet(
+                s.executeQuery(
+                    "select i from t1, t2 where " +
+                    "t1.i = t2.j and t1.i &gt;= 23 and t2.j &lt;= 30"),
+                "23");
+
+        List expectedOperators = Arrays.asList(new String[] {
+                    "Operator: &lt;", "Operator: &lt;=",
+                    "Operator: &lt;", "Operator: &lt;=", "Operator: ="
+                });
+
+        assertEquals(expectedOperators, extractOperators(getStatistics()));
+
+        // But if we put the constants on the left-hand side, we didn't
+        // detect the transitive closure and thus we had a single qualifier
+        // for T2 and only two qualifiers for T1.
+        JDBC.assertSingleValueResultSet(
+                s.executeQuery(
+                    "select i from t1, t2 where " +
+                    "t1.i = t2.j and 23 &lt;= t1.i and 30 &gt;= t2.j"),
+                "23");
+
+        // Verify that we now have all the expected qualifiers.
+        assertEquals(expectedOperators, extractOperators(getStatistics()));
+    }
+
+    /**
+     * Get the runtime statistics for the previous statement executed on the
+     * default connection (if collection of runtime statistics has been
+     * enabled).
+     *
+     * @return a string with the runtime statistics
+     */
+    private String getStatistics() throws SQLException {
+        ResultSet rs = createStatement().executeQuery(
+                "values syscs_util.syscs_get_runtimestatistics()");
+        rs.next();
+        String stats = rs.getString(1);
+        JDBC.assertEmpty(rs);
+        return stats;
+    }
+
+    /**
+     * Extract all the operators from the runtime statistics.
+     *
+     * @param stats the runtime statistics
+     * @return a list of all operators
+     */
+    private List extractOperators(String stats) throws IOException {
+        ArrayList ops = new ArrayList();
+        BufferedReader r = new BufferedReader(new StringReader(stats));
+        String line;
+        while ((line = r.readLine()) != null) {
+            line = line.trim();
+            if (line.startsWith("Operator: ")) {
+                ops.add(line);
+            }
+        }
+        return ops;
+    }
+}

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/PredicateTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java?rev=887156&amp;r1=887155&amp;r2=887156&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
Fri Dec  4 11:02:16 2009
@@ -77,6 +77,7 @@
         suite.addTest(JoinTest.suite());
 		suite.addTest(LangScripts.suite());
         suite.addTest(MathTrigFunctionsTest.suite());
+        suite.addTest(PredicateTest.suite());
         suite.addTest(PrepareExecuteDDL.suite());
         suite.addTest(ReferentialActionsTest.suite());
         suite.addTest(RolesTest.suite());




</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r886963 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby151Test.java</title>
<author><name>dag@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091203223242.E0F8D23888E9@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091203223242-E0F8D23888E9@eris-apache-org%3e</id>
<updated>2009-12-03T22:32:42Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: dag
Date: Thu Dec  3 22:32:41 2009
New Revision: 886963

URL: http://svn.apache.org/viewvc?rev=886963&amp;view=rev
Log:
DERBY-151 Thread termination -&gt; XSDG after operation is 'complete' 

Follow-up patch derby-151-followup; improves the test to also use client/server.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby151Test.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby151Test.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby151Test.java?rev=886963&amp;r1=886962&amp;r2=886963&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby151Test.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby151Test.java
Thu Dec  3 22:32:41 2009
@@ -23,6 +23,7 @@
 import org.apache.derbyTesting.junit.CleanDatabaseTestSetup;
 import org.apache.derbyTesting.junit.DatabasePropertyTestSetup;
 import org.apache.derbyTesting.junit.TestConfiguration;
+import org.apache.derbyTesting.junit.JDBC;
 
 import org.apache.derby.shared.common.sanity.SanityManager;
 
@@ -36,6 +37,7 @@
 import java.sql.ResultSet;
 import java.sql.Statement;
 import java.sql.SQLException;
+import java.sql.DriverManager;
 
 /**
  *   Test to reproduce and verify fix for DERBY-151.
@@ -53,11 +55,33 @@
     protected static Test baseSuite(String name)
     {
         TestSuite suite = new TestSuite(name);
-        suite.addTestSuite(Derby151Test.class);
-        return new CleanDatabaseTestSetup(
-            new TestSuite(Derby151Test.class, name));
+
+        if (!JDBC.vmSupportsJSR169()) {
+            // JSR169 cannot run with tests with stored procedures
+            // that do database access - for they require a
+            // DriverManager connection to jdbc:default:connection;
+            // DriverManager is not supported with JSR169.
+            suite.addTestSuite(Derby151Test.class);
+            return new CleanDatabaseTestSetup(
+                new TestSuite(Derby151Test.class, name));
+        } else {
+            return suite;
+        }
     }
 
+    public static Test suite()
+    {
+        TestSuite suite = new TestSuite("Derby151Test");
+
+        suite.addTest(
+            baseSuite("Derby151Test:embedded"));
+
+        suite.addTest(
+            TestConfiguration.clientServerDecorator(
+                baseSuite("Derby151Test:c/s")));
+
+        return suite;
+    }
 
     protected void setUp()
             throws java.lang.Exception {
@@ -67,6 +91,7 @@
         stmt.executeUpdate("CREATE TABLE d151(x int primary key)");
         stmt.close();
     }
+
     /**
      * Clean up the connection maintained by this test.
      */
@@ -80,52 +105,51 @@
         super.tearDown();
     }
 
+    // We do the actual test inside a stored procedure so we can test this for
+    // client/server as well, otherwise we would just interrupt the client
+    // thread.
+    public static void d151() throws SQLException {
+        Connection c = DriverManager.getConnection("jdbc:default:connection");
 
-    public void testD151 () throws SQLException {
-        PreparedStatement insert =
-            prepareStatement("insert into d151 values (?)");
+        PreparedStatement insert = null;
         try {
+            insert = c.prepareStatement("insert into d151 values (?)");
+
             for (int i = 0; i &lt; 10000; i++) {
                 insert.setInt(1, i);
                 insert.executeUpdate();
                 Thread.currentThread().interrupt();
             }
+        } finally {
+            if (insert != null) {
+                try {
+                    insert.close(); // already closed by error
+                } catch (SQLException e) {
+                }
+            }
+
+            c.close();
+        }
+    }
+
+    public void testD151 () throws SQLException {
+        Statement s = createStatement();
+        s.executeUpdate(
+            "create procedure D151 () MODIFIES SQL DATA " +
+            "external name 'org.apache.derbyTesting.functionTests" +
+            ".tests.store.Derby151Test.d151' " +
+            "language java parameter style java");
+
+        try {
+            s.executeUpdate("call D151()");
 
             // We were not able to prokove any error, but that should not fail
-            // the test; the results here may depend on VMs possibly.  So just,
+            // the test; the results here may depend on VMs possibly.  So just
             // report this fact in verbose mode:
 
             println("Not able to test fix for DERBY-151: No interrupt seen");
-
         } catch (SQLException e) {
             assertSQLState("XSDG9", e);
         }
-        insert.close(); // already closed by error
-    }
-
-    public static Test suite()
-    {
-        TestSuite suite = new TestSuite("Derby151Test");
-        suite.addTest(
-            baseSuite("Derby151Test:embedded"));
-
-        // Note: We are not adding a client/Server version since the explicit
-        // interrupt may (will) upset the communication socket to the client.
-        // I see 08006 SQL state on OpenSolaris/JDK1.6.
-        //
-        //    :
-        // org.apache.derby.client.am.DisconnectException:
-        //                    A communications error has been detected: null.
-        //    :
-        // java.io.InterruptedIOException
-        //    at java.net.SocketOutputStream.socketWrite0(Native Method)
-        //    at java.net.SocketOutputStream.socketWrite(
-        //                                         SocketOutputStream.java:92)
-        //    at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
-        //
-        // which happened before any error in RAFContainer4.
-
-
-        return suite;
     }
 }




</pre>
</div>
</content>
</entry>
<entry>
<title>=?utf-8?q?=5BDb-derby_Wiki=5D_Trivial_Update_of_=22CommandHistoryInIj=22_?= =?utf-8?q?by_BerntJohnsen?=</title>
<author><name>Apache Wiki &lt;wikidiffs@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091203215857.22391.76251@eos.apache.org%3e"/>
<id>urn:uuid:%3c20091203215857-22391-76251@eos-apache-org%3e</id>
<updated>2009-12-03T21:58:57Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Db-derby Wiki" for change notification.

The "CommandHistoryInIj" page has been changed by BerntJohnsen.
http://wiki.apache.org/db-derby/CommandHistoryInIj?action=diff&amp;rev1=8&amp;rev2=9

--------------------------------------------------

  
  == Using Emacs ==
  
- ij works pretty well in shell-mode and comint-mode, but the best is a custom-designed SQLi-mode.
Then you may utilize the sql-send-commands in SQL-mode. I once implemented such a file, feel
free to use it, and you fid it here: [[attachment:ij.el]]. 
+ ij works pretty well in shell-mode and comint-mode, but the best is a custom-designed SQLi-mode.
Then you may utilize the sql-send-commands in SQL-mode. I once implemented such a file, feel
free to use it, and you find it here: [[attachment:ij.el]]. 
  
  You may wish to define sql-derby-home and sql-ij-classpath in your .emacs file, e.g. like
this:
  


</pre>
</div>
</content>
</entry>
<entry>
<title>=?utf-8?q?=5BDb-derby_Wiki=5D_Update_of_=22CommandHistoryInIj=22_by_Bernt?= =?utf-8?q?Johnsen?=</title>
<author><name>Apache Wiki &lt;wikidiffs@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091203215620.22392.83256@eos.apache.org%3e"/>
<id>urn:uuid:%3c20091203215620-22392-83256@eos-apache-org%3e</id>
<updated>2009-12-03T21:56:20Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Db-derby Wiki" for change notification.

The "CommandHistoryInIj" page has been changed by BerntJohnsen.
http://wiki.apache.org/db-derby/CommandHistoryInIj?action=diff&amp;rev1=7&amp;rev2=8

--------------------------------------------------

  
  == Using Emacs ==
  
- ij works pretty well in shell-mode and comint-mode, but the best is a custom-designed SQLi-mode.
Then you may utilize the sql-send-commands in SQL-mode. I once implemented such a file, feel
free to use it: [[attachment:ij.el]]. You may wish to define sql-derby-home and sql-ij-classpath
in your .emacs file, e.g. like this:
+ ij works pretty well in shell-mode and comint-mode, but the best is a custom-designed SQLi-mode.
Then you may utilize the sql-send-commands in SQL-mode. I once implemented such a file, feel
free to use it, and you fid it here: [[attachment:ij.el]]. 
+ 
+ You may wish to define sql-derby-home and sql-ij-classpath in your .emacs file, e.g. like
this:
  
  {{{
  (defvar sql-ij-classpath "/usr/local/share/java/derby/lib/derbytools.jar:/usr/local/share/java/derby/lib/derby.jar:/usr/local/share/java/derby/lib/derbyclient.jar")


</pre>
</div>
</content>
</entry>
<entry>
<title>=?utf-8?q?=5BDb-derby_Wiki=5D_Update_of_=22CommandHistoryInIj=22_by_Bernt?= =?utf-8?q?Johnsen?=</title>
<author><name>Apache Wiki &lt;wikidiffs@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091203215453.22392.17436@eos.apache.org%3e"/>
<id>urn:uuid:%3c20091203215453-22392-17436@eos-apache-org%3e</id>
<updated>2009-12-03T21:54:53Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Db-derby Wiki" for change notification.

The "CommandHistoryInIj" page has been changed by BerntJohnsen.
http://wiki.apache.org/db-derby/CommandHistoryInIj?action=diff&amp;rev1=6&amp;rev2=7

--------------------------------------------------

  
  == Using Emacs ==
  
- ij works pretty well in shell-mode and comint-mode, but the best is a custom-designed SQLi-mode.
Then you may utilize the sql-send-commands in SQL-mode. I once implemented such a file, feel
free to use it. You may wish to define sql-derby-home and sql-ij-classpath in your .emacs
file, e.g. like this:
+ ij works pretty well in shell-mode and comint-mode, but the best is a custom-designed SQLi-mode.
Then you may utilize the sql-send-commands in SQL-mode. I once implemented such a file, feel
free to use it: [[attachment:ij.el]]. You may wish to define sql-derby-home and sql-ij-classpath
in your .emacs file, e.g. like this:
  
  {{{
  (defvar sql-ij-classpath "/usr/local/share/java/derby/lib/derbytools.jar:/usr/local/share/java/derby/lib/derby.jar:/usr/local/share/java/derby/lib/derbyclient.jar")


</pre>
</div>
</content>
</entry>
<entry>
<title>=?utf-8?q?New_attachment_added_to_page_CommandHistoryInIj_on_Db-derby_Wik?= =?utf-8?q?i?=</title>
<author><name>Apache Wiki &lt;wikidiffs@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091203215350.26692.41921@eos.apache.org%3e"/>
<id>urn:uuid:%3c20091203215350-26692-41921@eos-apache-org%3e</id>
<updated>2009-12-03T21:53:50Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Dear Wiki user,

You have subscribed to a wiki page "CommandHistoryInIj" for change notification. An attachment
has been added to that page by BerntJohnsen. Following detailed information is available:

Attachment name: ij.el
Attachment size: 4937
Attachment link: http://wiki.apache.org/db-derby/CommandHistoryInIj?action=AttachFile&amp;do=get&amp;target=ij.el
Page link: http://wiki.apache.org/db-derby/CommandHistoryInIj


</pre>
</div>
</content>
</entry>
<entry>
<title>=?utf-8?q?=5BDb-derby_Wiki=5D_Update_of_=22CommandHistoryInIj=22_by_Bernt?= =?utf-8?q?Johnsen?=</title>
<author><name>Apache Wiki &lt;wikidiffs@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091203215328.26692.47464@eos.apache.org%3e"/>
<id>urn:uuid:%3c20091203215328-26692-47464@eos-apache-org%3e</id>
<updated>2009-12-03T21:53:28Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Db-derby Wiki" for change notification.

The "CommandHistoryInIj" page has been changed by BerntJohnsen.
http://wiki.apache.org/db-derby/CommandHistoryInIj?action=diff&amp;rev1=5&amp;rev2=6

--------------------------------------------------

  
  == Using Emacs ==
  
- Emacs has been reported to work with IJ. Emacs users, please add workaround info here...
+ ij works pretty well in shell-mode and comint-mode, but the best is a custom-designed SQLi-mode.
Then you may utilize the sql-send-commands in SQL-mode. I once implemented such a file, feel
free to use it. You may wish to define sql-derby-home and sql-ij-classpath in your .emacs
file, e.g. like this:
  
+ {{{
+ (defvar sql-ij-classpath "/usr/local/share/java/derby/lib/derbytools.jar:/usr/local/share/java/derby/lib/derby.jar:/usr/local/share/java/derby/lib/derbyclient.jar")
+ (defvar sql-derby-home "/var/tmp/myderbyhome")
+ (load-file "ij.el")
+ }}}
+ 


</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r886857 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java</title>
<author><name>myrnavl@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091203172833.BE51F2388962@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091203172833-BE51F2388962@eris-apache-org%3e</id>
<updated>2009-12-03T17:28:21Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: myrnavl
Date: Thu Dec  3 17:27:59 2009
New Revision: 886857

URL: http://svn.apache.org/viewvc?rev=886857&amp;view=rev
Log:
DERBY-3829; convert derbynet/sysinfo and derbynet/sysinfo_with_properties to JUnit; addressing
some final comments

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java?rev=886857&amp;r1=886856&amp;r2=886857&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java Thu Dec
 3 17:27:59 2009
@@ -470,7 +470,7 @@
 	 * @throws InterruptedException
 	 * @throws IOException
 	 */
-	public void assertExecJavaCmdAsExpected(String[] expectedString,
+	public static void assertExecJavaCmdAsExpected(String[] expectedString,
 	        String[] cmd, int expectedExitValue) throws InterruptedException,
 	        IOException {
 
@@ -499,7 +499,7 @@
 	 * @return the process that was started
 	 * @throws IOException
 	 */
-	public Process execJavaCmd(String[] cmd) throws IOException {
+	public static Process execJavaCmd(String[] cmd) throws IOException {
 	    int totalSize = 3 + cmd.length;
 	    String[] tcmd = new String[totalSize];
 	    tcmd[0] = getJavaExecutableName();
@@ -521,11 +521,7 @@
 	            }
 	        });
 	    } catch (PrivilegedActionException pe) {
-	        Exception e = pe.getException();
-	        if (e instanceof IOException)
-	            throw (IOException) e;
-	        else
-	            throw (SecurityException) e;
+            throw (IOException) pe.getException();
 	    }
 	    return pr;
 	}
@@ -552,7 +548,7 @@
     * @return output of the process
     * @throws InterruptedException
     */
-   public String readProcessOutput(Process pr) throws InterruptedException {
+   public static String readProcessOutput(Process pr) throws InterruptedException {
 		InputStream is = pr.getInputStream();
 		if (is == null) {
 			fail("Unexpectedly receiving no text from the process");




</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r886831 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/store/raw/data/ engine/org/apache/derby/loc/ shared/org/apache/derby/shared/common/reference/ testing/org/apache/derbyTesting/functionTests/tests/lang/ testing/org/apache/...</title>
<author><name>dag@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091203155419.0C86C2388962@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091203155419-0C86C2388962@eris-apache-org%3e</id>
<updated>2009-12-03T15:53:51Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: dag
Date: Thu Dec  3 15:53:02 2009
New Revision: 886831

URL: http://svn.apache.org/viewvc?rev=886831&amp;view=rev
Log:
DERBY-151 Thread termination -&gt; XSDG after operation is 'complete'

This patch catches the exception seen by RAFContainer4
readFull/Write/full when the embedding application thread sees an
interrupt, and asks the user to inspect the app to find the cause.
Before this patch, the symptoms were puzzling to the user, suggesting
that the disk might be full.

The database level error seen is XSDG9:
"Derby thread received an interrupt during a disk I/O operation, please check your application
for the source of the interrupt. "

A new store test, Derby151Test, checks this behavior.


Added:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby151Test.java
  (with props)
Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/FileContainer.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer4.java
    db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml
    db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ErrorCodeTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/FileContainer.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/FileContainer.java?rev=886831&amp;r1=886830&amp;r2=886831&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/FileContainer.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/FileContainer.java
Thu Dec  3 15:53:02 2009
@@ -903,9 +903,10 @@
      * @param bytes the bytes to write
      * @param offset the offset to start writing at
      * @throws IOException if an I/O error occurs while writing
+	 * @exception StandardException  Derby Standard error policy
      */
     void writeAtOffset(StorageRandomAccessFile file, byte[] bytes, long offset)
-            throws IOException
+            throws IOException, StandardException
     {
         file.seek(offset);
         file.write(bytes);
@@ -919,8 +920,10 @@
 		positioned at the beginning of the first allocation page.
 
 		@exception IOException error in read the embryonic page from file
+		@exception StandardException  Derby Standard error policy
 	*/
-	protected byte[] getEmbryonicPage(DataInput fileData) throws IOException
+	protected byte[] getEmbryonicPage(DataInput fileData) throws
+		IOException, StandardException
 	{
 		byte[] epage = new byte[AllocPage.MAX_BORROWED_SPACE];
 
@@ -941,9 +944,10 @@
      * {@code FileContainer.FIRST_ALLOC_PAGE_OFFSET})
      * @return a byte array containing the embryonic page
      * @throws IOException if an I/O error occurs while reading
+	 * @throws StandardException  Derby Standard error policy
      */
     byte[] getEmbryonicPage(StorageRandomAccessFile file, long offset)
-            throws IOException
+            throws IOException, StandardException
     {
         file.seek(offset);
         return getEmbryonicPage(file);

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer4.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer4.java?rev=886831&amp;r1=886830&amp;r2=886831&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer4.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer4.java
Thu Dec  3 15:53:02 2009
@@ -23,6 +23,7 @@
 
 
 import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.reference.SQLState;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 
 import org.apache.derby.iapi.store.raw.ContainerKey;
@@ -33,6 +34,7 @@
 import java.nio.ByteBuffer;
 import java.nio.channels.FileChannel;
 import java.nio.channels.ClosedChannelException;
+import java.nio.channels.ClosedByInterruptException;
 import org.apache.derby.io.StorageRandomAccessFile;
 
 /**
@@ -422,7 +424,7 @@
      * @throws IOException if an I/O error occurs while writing
      */
     void writeAtOffset(StorageRandomAccessFile file, byte[] bytes, long offset)
-            throws IOException
+            throws IOException, StandardException
     {
         FileChannel ioChannel = getChannel(file);
         if (ioChannel != null) {
@@ -442,9 +444,10 @@
      * {@code FileContainer.FIRST_ALLOC_PAGE_OFFSET})
      * @return a byte array containing the embryonic page
      * @throws IOException if an I/O error occurs while reading
+     * @throws StandardException if thread is interrupted.
      */
     byte[] getEmbryonicPage(StorageRandomAccessFile file, long offset)
-            throws IOException
+            throws IOException, StandardException
     {
         FileChannel ioChannel = getChannel(file);
         if (ioChannel != null) {
@@ -459,21 +462,32 @@
 
     /**
      * Attempts to fill buf completely from start until it's full.
-     * &lt;p&gt;
+     * &lt;p/&gt;
      * FileChannel has no readFull() method, so we roll our own.
+     * &lt;p/&gt;
+     * @param dstBuffer buffer to read into
+     * @param srcChannel channel to read from
+     * @param position file position from where to read
+     *
+     * @throws IOException if an I/O error occurs while reading
+     * @throws StandardException If thread is interrupted.
      */
     private final void readFull(ByteBuffer dstBuffer,
                                 FileChannel srcChannel,
                                 long position)
-        throws IOException
+            throws IOException, StandardException
     {
         while(dstBuffer.remaining() &gt; 0) {
-            if( srcChannel.read(dstBuffer, position + dstBuffer.position())
-                    == -1)
-            {
-                throw new EOFException(
-                        "Reached end of file while attempting to read a "
-                        + "whole page.");
+            try {
+                if (srcChannel.read(dstBuffer,
+                                    position + dstBuffer.position()) == -1) {
+                        throw new EOFException(
+                            "Reached end of file while attempting to read a "
+                            + "whole page.");
+                }
+            } catch (ClosedByInterruptException e) {
+                throw StandardException.newException(
+                    SQLState.FILE_IO_INTERRUPTED, e);
             }
         }
     }
@@ -481,16 +495,28 @@
     /**
      * Attempts to write buf completely from start until end, at the given
      * position in the destination fileChannel.
-     * &lt;p&gt;
+     * &lt;p/&gt;
      * FileChannel has no writeFull() method, so we roll our own.
+     * &lt;p/&gt;
+     * @param srcBuffer buffer to write
+     * @param dstChannel channel to write to
+     * @param position file position to start writing at
+     *
+     * @throws IOException if an I/O error occurs while writing
+     * @throws StandardException If thread is interrupted.
      */
     private final void writeFull(ByteBuffer srcBuffer,
                                  FileChannel dstChannel,
                                  long position)
-        throws IOException
+            throws IOException, StandardException
     {
         while(srcBuffer.remaining() &gt; 0) {
-            dstChannel.write(srcBuffer, position + srcBuffer.position());
+            try {
+                dstChannel.write(srcBuffer, position + srcBuffer.position());
+            } catch (ClosedByInterruptException e) {
+                throw StandardException.newException(
+                    SQLState.FILE_IO_INTERRUPTED, e);
+            }
         }
     }
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml?rev=886831&amp;r1=886830&amp;r2=886831&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml Thu Dec  3 15:53:02
2009
@@ -5635,6 +5635,11 @@
                 &lt;arg&gt;value&lt;/arg&gt;
             &lt;/msg&gt;
 
+            &lt;msg&gt;
+                &lt;name&gt;XSDG9.D&lt;/name&gt;
+                &lt;text&gt;Derby thread received an interrupt during a disk I/O operation,
please check your application for the source of the interrupt.&lt;/text&gt;
+            &lt;/msg&gt;
+
         &lt;/family&gt;
 
 

Modified: db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java?rev=886831&amp;r1=886830&amp;r2=886831&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
(original)
+++ db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
Thu Dec  3 15:53:02 2009
@@ -531,6 +531,7 @@
 	String DATA_DIRECTORY_NOT_FOUND_IN_BACKUP                   = "XSDG6.D";
 	String UNABLE_TO_REMOVE_DATA_DIRECTORY                      = "XSDG7.D";
 	String UNABLE_TO_COPY_DATA_DIRECTORY                        = "XSDG8.D";
+	String FILE_IO_INTERRUPTED                                  = "XSDG9.D";
 
 
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ErrorCodeTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ErrorCodeTest.java?rev=886831&amp;r1=886830&amp;r2=886831&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ErrorCodeTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ErrorCodeTest.java
Thu Dec  3 15:53:02 2009
@@ -214,6 +214,7 @@
         		{"XSDG6","Data segment directory not found in {0} backup during restore. Please
make sure that backup copy is the right one and it is not corrupted.","45000"},
         		{"XSDG7","Directory {0} could not be removed during restore. Please make sure that
permissions are correct.","45000"},
         		{"XSDG8","Unable to copy directory '{0}' to '{1}' during restore. Please make sure
that there is enough space and permissions are correct. ","45000"},
+        		{"XSDG9","Derby thread received an interrupt during a disk I/O operation, please
check your application for the source of the interrupt.","45000"},
         		{"XSLA0","Cannot flush the log file to disk {0}.","45000"},
         		{"XSLA1","Log Record has been sent to the stream, but it cannot be applied to the
store (Object {0}).  This may cause recovery problems also.","45000"},
         		{"XSLA2","System will shutdown, got I/O Exception while accessing log file.","45000"},

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby151Test.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby151Test.java?rev=886831&amp;view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby151Test.java
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby151Test.java
Thu Dec  3 15:53:02 2009
@@ -0,0 +1,131 @@
+/*
+  Class org.apache.derbyTesting.functionTests.tests.store.Derby151Test
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to you under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+*/
+package org.apache.derbyTesting.functionTests.tests.store;
+
+import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.CleanDatabaseTestSetup;
+import org.apache.derbyTesting.junit.DatabasePropertyTestSetup;
+import org.apache.derbyTesting.junit.TestConfiguration;
+
+import org.apache.derby.shared.common.sanity.SanityManager;
+
+import junit.framework.Assert;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import java.sql.CallableStatement;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.sql.SQLException;
+
+/**
+ *   Test to reproduce and verify fix for DERBY-151.
+ */
+
+public class Derby151Test extends BaseJDBCTestCase
+{
+
+    public Derby151Test(String name)
+    {
+        super(name);
+    }
+
+
+    protected static Test baseSuite(String name)
+    {
+        TestSuite suite = new TestSuite(name);
+        suite.addTestSuite(Derby151Test.class);
+        return new CleanDatabaseTestSetup(
+            new TestSuite(Derby151Test.class, name));
+    }
+
+
+    protected void setUp()
+            throws java.lang.Exception {
+        super.setUp();
+
+        Statement stmt = createStatement();
+        stmt.executeUpdate("CREATE TABLE d151(x int primary key)");
+        stmt.close();
+    }
+    /**
+     * Clean up the connection maintained by this test.
+     */
+    protected void tearDown()
+            throws java.lang.Exception {
+
+        Statement stmt = createStatement();
+        stmt.executeUpdate("DROP TABLE d151");
+        stmt.close();
+
+        super.tearDown();
+    }
+
+
+    public void testD151 () throws SQLException {
+        PreparedStatement insert =
+            prepareStatement("insert into d151 values (?)");
+        try {
+            for (int i = 0; i &lt; 10000; i++) {
+                insert.setInt(1, i);
+                insert.executeUpdate();
+                Thread.currentThread().interrupt();
+            }
+
+            // We were not able to prokove any error, but that should not fail
+            // the test; the results here may depend on VMs possibly.  So just,
+            // report this fact in verbose mode:
+
+            println("Not able to test fix for DERBY-151: No interrupt seen");
+
+        } catch (SQLException e) {
+            assertSQLState("XSDG9", e);
+        }
+        insert.close(); // already closed by error
+    }
+
+    public static Test suite()
+    {
+        TestSuite suite = new TestSuite("Derby151Test");
+        suite.addTest(
+            baseSuite("Derby151Test:embedded"));
+
+        // Note: We are not adding a client/Server version since the explicit
+        // interrupt may (will) upset the communication socket to the client.
+        // I see 08006 SQL state on OpenSolaris/JDK1.6.
+        //
+        //    :
+        // org.apache.derby.client.am.DisconnectException:
+        //                    A communications error has been detected: null.
+        //    :
+        // java.io.InterruptedIOException
+        //    at java.net.SocketOutputStream.socketWrite0(Native Method)
+        //    at java.net.SocketOutputStream.socketWrite(
+        //                                         SocketOutputStream.java:92)
+        //    at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
+        //
+        // which happened before any error in RAFContainer4.
+
+
+        return suite;
+    }
+}

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby151Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java?rev=886831&amp;r1=886830&amp;r2=886831&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java
Thu Dec  3 15:53:02 2009
@@ -56,6 +56,7 @@
         suite.addTest(ClassLoaderBootTest.suite());
         suite.addTest(StreamingColumnTest.suite());
         suite.addTest(Derby3625Test.suite());
+        suite.addTest(Derby151Test.suite());
         suite.addTest(PositionedStoreStreamTest.suite());
         suite.addTest(OSReadOnlyTest.suite());
         suite.addTest(BackupRestoreTest.suite());




</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r886824 - /db/derby/docs/trunk/src/ref/rrefsqljrenametablestatement.dita</title>
<author><name>bpendleton@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091203153802.EB7802388962@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091203153802-EB7802388962@eris-apache-org%3e</id>
<updated>2009-12-03T15:38:02Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: bpendleton
Date: Thu Dec  3 15:38:01 2009
New Revision: 886824

URL: http://svn.apache.org/viewvc?rev=886824&amp;view=rev
Log:
DERBY-3605: Remove confusing statement from RENAME TABLE docs

This change removes a confusing sentence from the RENAME TABLE
documentation. The sentence appeared to be describing a
restriction on the statement's behavior, but in fact it was
describing a non-restriction; that is, it was describing something
that wasn't a problem in a way that was easily mistaken for
a description of a problem.

Since it doesn't seem necessary to describe non-problems
in the documentation, this change removes the sentence.


Modified:
    db/derby/docs/trunk/src/ref/rrefsqljrenametablestatement.dita

Modified: db/derby/docs/trunk/src/ref/rrefsqljrenametablestatement.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/ref/rrefsqljrenametablestatement.dita?rev=886824&amp;r1=886823&amp;r2=886824&amp;view=diff
==============================================================================
--- db/derby/docs/trunk/src/ref/rrefsqljrenametablestatement.dita (original)
+++ db/derby/docs/trunk/src/ref/rrefsqljrenametablestatement.dita Thu Dec  3 15:38:01 2009
@@ -37,8 +37,8 @@
 or triggers on the table, attempts to rename it will also generate an error.&lt;/p&gt; &lt;/refsyn&gt;
 &lt;example&gt; &lt;codeblock&gt;&lt;b&gt;RENAME TABLE SAMP.EMP_ACT TO EMPLOYEE_ACT&lt;/b&gt;&lt;/codeblock&gt;
&lt;p&gt;Also
 see &lt;xref href="rrefsqlj81859.dita#rrefsqlj81859"&gt;&lt;/xref&gt; for more information.&lt;/p&gt;
&lt;/example&gt;
-&lt;section&gt;&lt;title&gt;Statement dependency system&lt;/title&gt; &lt;p&gt;If there is
an index
-defined on the table, the table can be renamed.&lt;/p&gt; &lt;p&gt;The RENAME TABLE statement
+&lt;section&gt;&lt;title&gt;Statement dependency system&lt;/title&gt;
+&lt;p&gt;The RENAME TABLE statement
 is not allowed if there are any open cursors that reference the table that
 is being altered.&lt;/p&gt; &lt;/section&gt;
 &lt;/refbody&gt;




</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r886656 - /db/derby/docs/trunk/src/tools/ctoolsimportidentitycol.dita</title>
<author><name>bpendleton@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091203021859.3D2A223888C5@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091203021859-3D2A223888C5@eris-apache-org%3e</id>
<updated>2009-12-03T02:18:54Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: bpendleton
Date: Thu Dec  3 02:18:44 2009
New Revision: 886656

URL: http://svn.apache.org/viewvc?rev=886656&amp;view=rev
Log:
DERBY-482: Cover GENERATED BY DEFAULT in "Importing with identity cols" page

This change adds and re-organizes the text on the "Importing into tables
with identity columns" page in the Tools guide. Previously, the page
described considerations for a table with a GENERATED ALWAYS column; this
change adds additional information to describe situations that arise with
GENERATED BY DEFAULT columns.


Modified:
    db/derby/docs/trunk/src/tools/ctoolsimportidentitycol.dita

Modified: db/derby/docs/trunk/src/tools/ctoolsimportidentitycol.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/tools/ctoolsimportidentitycol.dita?rev=886656&amp;r1=886655&amp;r2=886656&amp;view=diff
==============================================================================
--- db/derby/docs/trunk/src/tools/ctoolsimportidentitycol.dita (original)
+++ db/derby/docs/trunk/src/tools/ctoolsimportidentitycol.dita Thu Dec  3 02:18:44 2009
@@ -22,25 +22,33 @@
 &lt;title&gt;Import into tables that contain identity columns&lt;/title&gt;
 &lt;shortdesc&gt;You can use the either the SYSCS_UTIL.SYSCS_IMPORT_DATA procedure
 or the SYSCS_UTIL.SYSCS_IMPORT_DATA_LOBS_FROM_EXTFILE procedure to import
-data into a table that contains an identity column. &lt;/shortdesc&gt;
+data into a table that contains an identity column.
+The approach that you take depends on whether the identity column is
+GENERATED ALWAYS or GENERATED BY DEFAULT.
+&lt;/shortdesc&gt;
 &lt;prolog&gt;&lt;metadata&gt;
 &lt;keywords&gt;&lt;indexterm&gt;importing data&lt;indexterm&gt;tables with identity columns&lt;/indexterm&gt;&lt;/indexterm&gt;
 &lt;/keywords&gt;
 &lt;/metadata&gt;&lt;/prolog&gt;
 &lt;conbody&gt;
-&lt;p&gt;If the identity column is defined as GENERATED ALWAYS, an identity value
-is generated for a table row whenever the corresponding row field in the input
-file does not contain a value for the identity column. When a corresponding
-row field in the input file already contains a value for the identity column,
-the row cannot be inserted into the table and the import operation will fail.
-To prevent such scenarios, the following examples show how to specify parameters
-in the SYSCS_UTIL.SYSCS_IMPORT_DATA and SYSCS_UTIL.SYSCS_IMPORT_DATA_LOBS_FROM_EXTFILE
-procedures to ignore data for the identity column from the file, or omit the
-column name from the insert column list.&lt;/p&gt;
+&lt;section&gt;&lt;title&gt;Identity columns and the REPLACE parameter&lt;/title&gt;
 &lt;p&gt;If the &lt;parmname&gt;REPLACE&lt;/parmname&gt; parameter is used during import,
&lt;ph
 conref="../conrefs.dita#prod/productshortname"&gt;&lt;/ph&gt; resets its internal counter
 of the last identity value for a column to the initial value defined for the
 identity column.&lt;/p&gt;
+&lt;/section&gt;
+&lt;section&gt;&lt;title&gt;Identity column is GENERATED ALWAYS&lt;/title&gt;
+&lt;p&gt;If the identity column is defined as GENERATED ALWAYS, an identity value
+is always generated for a table row.
+When a corresponding
+row in the input file already contains a value for the identity column,
+the row cannot be inserted into the table and the import operation will fail.
+&lt;/p&gt;
+&lt;p&gt;
+To prevent such failure, the following examples show how to specify parameters
+in the SYSCS_UTIL.SYSCS_IMPORT_DATA and SYSCS_UTIL.SYSCS_IMPORT_DATA_LOBS_FROM_EXTFILE
+procedures to ignore data for the identity column from the file, and omit the
+column name from the insert column list.&lt;/p&gt;
 &lt;p&gt;The following table definition contains an identity column, &lt;codeph&gt;c2&lt;/codeph&gt;
and
 is used in the examples below:&lt;/p&gt;
 &lt;codeblock&gt;CREATE TABLE tab1 (c1 CHAR(30), c2 INT GENERATED ALWAYS AS IDENTITY, 
@@ -56,7 +64,7 @@
 you call the procedure. For example:   &lt;codeblock&gt;CALL SYSCS_UTIL.SYSCS_IMPORT_DATA
(NULL, 'TAB1', 'C1,C3,C4', 
     null, 'myfile.del',null, null, null, 0)
    &lt;/codeblock&gt;&lt;/li&gt;
-&lt;li&gt;Suppose that you want import data into &lt;codeph&gt;tab1&lt;/codeph&gt; from a
file &lt;codeph&gt;empfile.del&lt;/codeph&gt; that
+&lt;li&gt;Suppose that you want to import data into &lt;codeph&gt;tab1&lt;/codeph&gt; from
a file &lt;codeph&gt;empfile.del&lt;/codeph&gt; that
 also has identity column information. The file contains three fields with
 the following data: &lt;codeblock&gt;Robert,1,45.2,J
 Mike,2,23.4,I
@@ -66,5 +74,71 @@
 procedure. For example: &lt;codeblock&gt;CALL SYSCS_UTIL.SYSCS_IMPORT_DATA (NULL, 'TAB1',
'C1,C3,C4', 
     '1,3,4', 'empfile.del',null, null, null, 0)&lt;/codeblock&gt;&lt;/li&gt;
 &lt;/ul&gt;
+&lt;/section&gt;
+&lt;section&gt;&lt;title&gt;Identity column is GENERATED BY DEFAULT&lt;/title&gt;
+&lt;p&gt;
+If the identity column is defined as GENERATED BY DEFAULT, an identity value
+is only generated for a table row if no explicit value is given.
+This means that you have several options, depending on the contents of your
+input file, and the desired outcome of the import processing:
+&lt;ul&gt;
+&lt;li&gt;You may omit the identity column from the insert column list, in which case 
+&lt;ph conref="../conrefs.dita#prod/productshortname"&gt;&lt;/ph&gt;
+will generate a new value for the identity column for each input row.
+You may use this option whether or not the input file contains values for
+the identity column, but
+note that if the input file contains values for the identity column, you
+must also then omit the identity column from the column indexes when you
+call the procedure.
+&lt;/li&gt;
+&lt;li&gt;You may include the identity column in the insert column list, in which case
+&lt;ph conref="../conrefs.dita#prod/productshortname"&gt;&lt;/ph&gt;
+will use the column values from the input file. Of course, this option is
+only available if the input file actually contains values for the identity
+column.
+&lt;/li&gt;
+&lt;/ul&gt;
+&lt;/p&gt;
+&lt;p&gt;The following table definition contains an identity column,
+&lt;codeph&gt;c2&lt;/codeph&gt; and is used in the examples below:&lt;/p&gt;
+&lt;codeblock&gt;CREATE TABLE tab1 (c1 CHAR(30),
+   c2 INT GENERATED BY DEFAULT AS IDENTITY, 
+   c3 REAL, c4 CHAR(1))&lt;/codeblock&gt;
+&lt;ul&gt;
+&lt;li&gt;Suppose that you want to import data into &lt;codeph&gt;tab1&lt;/codeph&gt; from
a
+file &lt;codeph&gt;myfile.del&lt;/codeph&gt; that does not have identity column information.
+The &lt;codeph&gt;myfile.del&lt;/codeph&gt; file contains three fields with the following
+data: &lt;codeblock&gt;Robert,45.2,J
+Mike,76.9,K
+Leo,23.4,I   &lt;/codeblock&gt; To import the data, you must explicitly list the
+column names in the &lt;codeph&gt;tab1&lt;/codeph&gt; table except for the identity column
&lt;codeph&gt;c2&lt;/codeph&gt; when
+you call the procedure. For example:   &lt;codeblock&gt;CALL SYSCS_UTIL.SYSCS_IMPORT_DATA
(NULL, 'TAB1', 'C1,C3,C4', 
+    null, 'myfile.del',null, null, null, 0)
+   &lt;/codeblock&gt;&lt;/li&gt;
+&lt;li&gt;Suppose that you want to import data into &lt;codeph&gt;tab1&lt;/codeph&gt; from
a file &lt;codeph&gt;empfile.del&lt;/codeph&gt; that
+also has identity column information. The file contains three fields with
+the following data: &lt;codeblock&gt;Robert,1,45.2,J
+Mike,2,23.4,I
+Leo,3,23.4,I   &lt;/codeblock&gt; 
+In this case, suppose that you wish to use the existing identity column values
+from the input file.
+To import the data, you may simply pass &lt;codeph&gt;null&lt;/codeph&gt;
+for the insert column list and column indexes parameters when you call the
+procedure. For example: &lt;codeblock&gt;CALL SYSCS_UTIL.SYSCS_IMPORT_DATA (NULL, 'TAB1',
NULL, 
+    NULL, 'empfile.del',null, null, null, 0)&lt;/codeblock&gt;&lt;/li&gt;
+&lt;li&gt;Suppose (again) that you want to import data into &lt;codeph&gt;tab1&lt;/codeph&gt;
+from a file &lt;codeph&gt;empfile.del&lt;/codeph&gt; that
+also has identity column information, but in this case, suppose that you
+do &lt;b&gt;not&lt;/b&gt; wish to use the identity column values from the input file,
+but would prefer to allow
+&lt;ph conref="../conrefs.dita#prod/productshortname"&gt;&lt;/ph&gt;
+to generate new identity column values instead.
+In this case, to import the data, you must specify
+an insert column list without the identity column &lt;codeph&gt;c2&lt;/codeph&gt; and
+specify the column indexes without identity column data when you call the
+procedure. For example: &lt;codeblock&gt;CALL SYSCS_UTIL.SYSCS_IMPORT_DATA (NULL, 'TAB1',
'C1,C3,C4', 
+    '1,3,4', 'empfile.del',null, null, null, 0)&lt;/codeblock&gt;&lt;/li&gt;
+&lt;/ul&gt;
+&lt;/section&gt;
 &lt;/conbody&gt;
 &lt;/concept&gt;




</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r886277 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java testing/org/apache/derbyTesting/functionTests/tests/lang/RoutineTest.java</title>
<author><name>rhillegas@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091202192833.6F81623888D1@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091202192833-6F81623888D1@eris-apache-org%3e</id>
<updated>2009-12-02T19:28:33Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: rhillegas
Date: Wed Dec  2 19:28:32 2009
New Revision: 886277

URL: http://svn.apache.org/viewvc?rev=886277&amp;view=rev
Log:
DERBY-1030: Remove over-eager optimization which short-circuited NULL ON NULL INPUT processing
when argument values came out of nested function calls.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RoutineTest.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java?rev=886277&amp;r1=886276&amp;r2=886277&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java
Wed Dec  2 19:28:32 2009
@@ -347,8 +347,21 @@
 	 * This can't be done for parameters which are wrappers over SQL function
 	 * defined with RETURN NULL ON NULL INPUT because such functions need
 	 * access to both sql domain value and java domain value. - Derby479
+     * This optimization is not available if the outer function is
+	 * RETURN NULL ON NULL INPUT. That is because the SQLToJavaNode is
+	 * responsible for compiling the byte code which skips the method call if
+     * the parameter is null--if we remove the SQLToJavaNode, then we don't
+     * compile that check and we get bug DERBY-1030.
 	 */
 	private void optimizeDomainValueConversion() throws StandardException {
+
+        //
+        // This optimization is not possible if we are compiling a call to
+        // a NULL ON NULL INPUT method. See DERBY-1030 and the header
+        // comment above.
+        //
+        if ( !routineInfo.calledOnNullInput() ) { return; }
+        
 		int		count = methodParms.length;
 		for (int parm = 0; parm &lt; count; parm++)
 		{

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RoutineTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RoutineTest.java?rev=886277&amp;r1=886276&amp;r2=886277&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RoutineTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RoutineTest.java
Wed Dec  2 19:28:32 2009
@@ -572,7 +572,7 @@
         // noon-&gt;NULL by inner function
         // NULL-&gt;NULL by outer due to RETURN NULL ON NULL INPUT
         ps.setTime(1, noon); // noon-&gt;NULL-&gt;NULL
-        JDBC.assertSingleValueResultSet(ps.executeQuery(), "11:00:00");        
+        JDBC.assertSingleValueResultSet(ps.executeQuery(), null);        
         ps.setTime(1, null); // NULL-&gt;11:00:00-&gt;11:30:00
         JDBC.assertSingleValueResultSet(ps.executeQuery(), "11:30:00");
 




</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r886221 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites: derbynetmats.properties j9derbynetmats.properties</title>
<author><name>myrnavl@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091202174936.84AC423888D1@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091202174936-84AC423888D1@eris-apache-org%3e</id>
<updated>2009-12-02T17:49:36Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: myrnavl
Date: Wed Dec  2 17:49:36 2009
New Revision: 886221

URL: http://svn.apache.org/viewvc?rev=886221&amp;view=rev
Log:
removing jdk14 from 2 suites .properties files; the jdk14.properties and jdk14.runall were
removed with revision 645716 for DERBY-3568

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.properties
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/j9derbynetmats.properties

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.properties
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.properties?rev=886221&amp;r1=886220&amp;r2=886221&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.properties
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.properties
Wed Dec  2 17:49:36 2009
@@ -14,7 +14,7 @@
 # limitations under the License.
 
 framework=DerbyNet
-suites=derbynetmats jdbcapi jdbc20 jdk14
+suites=derbynetmats jdbcapi jdbc20
 jdk12test=true
 runwithj9=false
 #Exclude for J2ME/Foundation - Network Server not supported

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/j9derbynetmats.properties
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/j9derbynetmats.properties?rev=886221&amp;r1=886220&amp;r2=886221&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/j9derbynetmats.properties
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/j9derbynetmats.properties
Wed Dec  2 17:49:36 2009
@@ -14,7 +14,7 @@
 # limitations under the License.
 
 framework=DerbyNet
-suites=j9derbynetmats jdbcapi jdbc20 jdk14
+suites=j9derbynetmats jdbcapi jdbc20
 jdk12test=true
 runwithj9=false
 runwithibm13=false




</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r886162 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/sql/compile/TableElementList.java testing/org/apache/derbyTesting/functionTests/tests/lang/CheckConstraintTest.java</title>
<author><name>bpendleton@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091202144920.17A4B23888EC@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091202144920-17A4B23888EC@eris-apache-org%3e</id>
<updated>2009-12-02T14:49:19Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: bpendleton
Date: Wed Dec  2 14:49:19 2009
New Revision: 886162

URL: http://svn.apache.org/viewvc?rev=886162&amp;view=rev
Log:
DERBY-3947: Cannot insert 994 char string into indexed column

A table created with "CREATE TABLE t (x varchar(1000) primary key)" could
encounter problems when a particularly long value of "x" was inserted,
because the index that was automatically created to support the PRIMARY KEY
constraint was created with a small page size. Such an insert statement
would get an error like: "Limitation: Record of a btree secondary index
cannot be updated or inserted due to lack of space on the page."

This change enhances TableElementList so that, when creating an index for
a constraint, it now checks the approximate length of the columns in the
index, and, if they are sufficiently long, automatically chooses a larger
default page size for the index conglomerate.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CheckConstraintTest.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java?rev=886162&amp;r1=886161&amp;r2=886162&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java
Wed Dec  2 14:49:19 2009
@@ -25,6 +25,8 @@
 import org.apache.derby.iapi.services.sanity.SanityManager;
 
 import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.reference.Property;
+import org.apache.derby.iapi.services.property.PropertyUtil;
 
 import org.apache.derby.iapi.sql.StatementType;
 import org.apache.derby.iapi.sql.compile.CompilerContext;
@@ -61,6 +63,7 @@
 import java.util.ArrayList;
 import java.util.Hashtable;
 import java.util.HashSet;
+import java.util.Properties;
 import java.util.Vector;
 
 /**
@@ -1298,9 +1301,64 @@
                     isAscending,
                     isConstraint,
                     cdn.getBackingIndexUUID(),
-                    cdn.getProperties());
+                    checkIndexPageSizeProperty(cdn));
 		}
 	}
+    /**
+     * Checks if the index should use a larger page size.
+     *
+     * If the columns in the index are large, and if the user hasn't already
+     * specified a page size to use, then we may need to default to the
+     * large page size in order to get an index with sufficiently large pages.
+     * For example, this DDL should use a larger page size for the index
+     * that backs the PRIMARY KEY constraint:
+     *
+     * create table t (x varchar(1000) primary key)
+     *
+     * @param cdn Constraint node
+     *
+     * @return properties to use for creating the index
+     */
+    private Properties checkIndexPageSizeProperty(ConstraintDefinitionNode cdn) 
+        throws StandardException
+    {
+        Properties result = cdn.getProperties();
+        if (result == null)
+            result = new Properties();
+        if ( result.get(Property.PAGE_SIZE_PARAMETER) != null ||
+             PropertyUtil.getServiceProperty(
+                 getLanguageConnectionContext().getTransactionCompile(),
+                 Property.PAGE_SIZE_PARAMETER) != null)
+        {
+            // do not override the user's choice of page size, whether it
+            // is set for the whole database or just set on this statement.
+            return result;
+        }
+        ResultColumnList rcl = cdn.getColumnList();
+        int approxLength = 0;
+        for (int index = 0; index &lt; rcl.size(); index++)
+        {
+            String colName = ((ResultColumn) rcl.elementAt(index)).getName();
+            DataTypeDescriptor dtd;
+            if (td == null)
+                dtd = getColumnDataTypeDescriptor(colName);
+            else
+                dtd = getColumnDataTypeDescriptor(colName, td);
+            // There may be no DTD if the column does not exist. That syntax
+            // error is not caught til later in processing, so here we just
+            // skip the length checking if the column doesn't exist.
+            if (dtd != null)
+                approxLength+=dtd.getTypeId().getApproximateLengthInBytes(dtd);
+        }
+        if (approxLength &gt; Property.IDX_PAGE_SIZE_BUMP_THRESHOLD)
+        {
+            result.put(
+                    Property.PAGE_SIZE_PARAMETER,
+                    Property.PAGE_SIZE_DEFAULT_LONG);
+        }
+        return result;
+    }
+
 
 	/**
 	 * Check to make sure that there are no duplicate column names

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CheckConstraintTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CheckConstraintTest.java?rev=886162&amp;r1=886161&amp;r2=886162&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CheckConstraintTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CheckConstraintTest.java
Wed Dec  2 14:49:19 2009
@@ -904,4 +904,56 @@
         st1.close();
         st.close();
     }
+    // This test verifies that if the PRIMARY KEY constraint mentions a
+    // column which is potentially large, then Derby will automatically
+    // choose a large pagesize for the index's conglomerate (DERBY-3947)
+    //
+    public void testPrimaryKeyPageSizeDerby3947()
+        throws SQLException
+    {
+        st = createStatement();
+        st.executeUpdate("create table d3947 (x varchar(1000) primary key)");
+        char[] chars = new char[994];
+        PreparedStatement ps = prepareStatement("insert into d3947 values (?)");
+        ps.setString(1, new String(chars));
+        ps.executeUpdate();
+        ps.close();
+        checkLargePageSize(st, "D3947");
+        st.executeUpdate("drop table d3947");
+
+        // A second variation is to add the PK constraint using ALTER TABLE;
+        // A third variation is to add a FK constraint
+        st.executeUpdate("create table d3947 (x varchar(1000) not null, " +
+                " y varchar(1000))");
+        st.executeUpdate("alter table d3947 add constraint " +
+                "constraint1 primary key (x)");
+        st.executeUpdate("alter table d3947 add constraint " +
+                "constraint2 foreign key (y) references d3947(x)");
+        checkLargePageSize(st, "D3947");
+        // Ensure we still get the right error message when col doesn't exist:
+        assertStatementError("42X14", st,
+                "alter table d3947 add constraint " +
+                "constraint3 foreign key (z) references d3947(x)");
+        st.executeUpdate("drop table d3947");
+
+        st.close();
+    }
+    private void checkLargePageSize(Statement st, String tblName)
+        throws SQLException
+    {
+        ResultSet rs = st.executeQuery(
+            "select * from TABLE(SYSCS_DIAG.SPACE_TABLE('"+tblName+"')) T");
+        while (rs.next())
+        {
+            if ("1".equals(rs.getString("isindex")))
+                assertEquals(32768, rs.getInt("pagesize"));
+            else
+                assertEquals(4096, rs.getInt("pagesize"));
+
+            //System.out.println(rs.getString("conglomeratename") +
+            //        ","+rs.getString("isindex")+
+            //        ","+rs.getString("pagesize"));
+        }
+        rs.close();
+    }
 }




</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r886008 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsTest.java</title>
<author><name>kahatlen@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091201233954.21CD223888E9@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091201233954-21CD223888E9@eris-apache-org%3e</id>
<updated>2009-12-01T23:39:54Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: kahatlen
Date: Tue Dec  1 23:39:53 2009
New Revision: 886008

URL: http://svn.apache.org/viewvc?rev=886008&amp;view=rev
Log:
DERBY-4460: test_031_derby_4413 failed in nightly regression run

Added an ORDER BY clause to ensure consistent ordering across
different platforms.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsTest.java?rev=886008&amp;r1=886007&amp;r2=886008&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsTest.java
Tue Dec  1 23:39:53 2009
@@ -5442,14 +5442,14 @@
         assertResults
             (
                 conn,
-                "select * from t_4413",
+                "select * from t_4413 order by i, j",
                 new String[][]
                 {
                     { "1", "2", },
-                    { "2", "4", },
                     { "1", "2", },
                     { "1", "2", },
                     { "2", "4", },
+                    { "2", "4", },
                 },
                 false
             );




</pre>
</div>
</content>
</entry>
<entry>
<title>=?utf-8?q?=5BDb-derby_Wiki=5D_Update_of_=22CommandHistoryInIj=22_by_Krist?= =?utf-8?q?ianWaagan?=</title>
<author><name>Apache Wiki &lt;wikidiffs@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091201132351.29377.96025@eos.apache.org%3e"/>
<id>urn:uuid:%3c20091201132351-29377-96025@eos-apache-org%3e</id>
<updated>2009-12-01T13:23:51Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Db-derby Wiki" for change notification.

The "CommandHistoryInIj" page has been changed by KristianWaagan.
http://wiki.apache.org/db-derby/CommandHistoryInIj?action=diff&amp;rev1=4&amp;rev2=5

--------------------------------------------------

  
  == Using JLine ==
  
- JLine has been reported to work with IJ. JLine users, please add workaround info here...
+ You can script starting IJ with JLine like this:
+ {{{
+ java -classpath jline.jar:${IJ_CLASSPATH} ${IJ_OPTIONS} jline.ConsoleRunner org.apache.derby.tools.ij
[$@]
+ }}}
+ 
+ Use an alias or a script to ease the startup.  Depending on how you do it in your shell,
the ''$@'' might not be required to be able to pass arguments to IJ.
+ Modify ''IJ_CLASSPATH'' to specify which Derby version / code base to use. If you want to
start IJ with certain options, add them to ''IJ_OPTIONS'' (these have to be Java properties,
for instance ''-Dij.exceptionTrace=true'').
+ 
+ Note that JLine has problems dealing with commands longer than one line in your terminal.
  
  == Using Emacs ==
  


</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r885726 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DistinctTest.java</title>
<author><name>kahatlen@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091201105512.8BCB3238890A@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091201105512-8BCB3238890A@eris-apache-org%3e</id>
<updated>2009-12-01T10:55:12Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: kahatlen
Date: Tue Dec  1 10:55:12 2009
New Revision: 885726

URL: http://svn.apache.org/viewvc?rev=885726&amp;view=rev
Log:
DERBY-4457: 'Column value mismatch' in 'testDistinctInsertWithGeneratedColumn(...lang.DistinctTest)'
on Jvm 1.5, 1.4, phoneME.

SELECT DISTINCT may return rows in different order on different JVMs. Made the test independent
of the actual ordering.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DistinctTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DistinctTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DistinctTest.java?rev=885726&amp;r1=885725&amp;r2=885726&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DistinctTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DistinctTest.java
Tue Dec  1 10:55:12 2009
@@ -457,14 +457,20 @@
 		assertEquals(2, s.executeUpdate("insert into destWithAI(c12) select distinct(c31) from
source"));
 		
 		// we should not see gaps in the autoincrement column
-		String [][] expected = { {"1", "1"}, 
-				                 {"2", "2"} };
-		JDBC.assertFullResultSet(s.executeQuery("select * from destWithAI"), expected);
+		String [][] expected = { {"1"}, {"2"} };
+		JDBC.assertFullResultSet(
+				s.executeQuery("select c11 from destWithAI order by c11"),
+				expected);
+		JDBC.assertFullResultSet(
+				s.executeQuery("select c12 from destWithAI order by c12"),
+				expected);
 		
 		assertEquals(2, s.executeUpdate("insert into destWithNoAI(c22) select distinct(c31) from
source"));
 		expected = new String [][] { {null, "1"}, 
 				                     {null, "2"} };
-		JDBC.assertFullResultSet(s.executeQuery("select * from destWithNoAI"), expected);
+		JDBC.assertFullResultSet(
+				s.executeQuery("select * from destWithNoAI order by c22"),
+				expected);
 		
 		s.execute("drop table source");
 		s.execute("drop table destWithNoAI");




</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r885669 - in /db/derby/docs/trunk/src/adminguide: radminconfigdb2jdrdatracedirectory.dita tadminadv804410.dita</title>
<author><name>bpendleton@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091201045415.C7AEB23889CB@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091201045415-C7AEB23889CB@eris-apache-org%3e</id>
<updated>2009-12-01T04:54:15Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: bpendleton
Date: Tue Dec  1 04:54:14 2009
New Revision: 885669

URL: http://svn.apache.org/viewvc?rev=885669&amp;view=rev
Log:
DERBY-4153: Document that Network Server will try to create the trace directory

This change adds additional documentation regarding the Network Server's
tracing directory feature, clarifying that, starting with 10.5, Network
Server will attempt to create the trace directory (and any parent
directories) if they do not exist. This will require that derbynet.jar
permit verification of the existence of the named trace directory and
all necessary parent directories.

The new documentation provides example syntax for the security policy
rules needed, and pointers to the other sections of the guide which
discuss security policy issues in greater detail.


Modified:
    db/derby/docs/trunk/src/adminguide/radminconfigdb2jdrdatracedirectory.dita
    db/derby/docs/trunk/src/adminguide/tadminadv804410.dita

Modified: db/derby/docs/trunk/src/adminguide/radminconfigdb2jdrdatracedirectory.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/adminguide/radminconfigdb2jdrdatracedirectory.dita?rev=885669&amp;r1=885668&amp;r2=885669&amp;view=diff
==============================================================================
--- db/derby/docs/trunk/src/adminguide/radminconfigdb2jdrdatracedirectory.dita (original)
+++ db/derby/docs/trunk/src/adminguide/radminconfigdb2jdrdatracedirectory.dita Tue Dec  1
04:54:14 2009
@@ -24,10 +24,33 @@
 &lt;keywords&gt;&lt;indexterm&gt;derby.drda.traceDirectory property&lt;/indexterm&gt;&lt;/keywords&gt;
 &lt;/metadata&gt;&lt;/prolog&gt;
 &lt;refbody&gt;
-&lt;section&gt;Indicates the location of tracing files. &lt;/section&gt;
-&lt;refsyn&gt;&lt;title&gt;Syntax&lt;/title&gt; &lt;codeblock&gt;derby.drda.traceDirectory=&lt;i&gt;tracefiledirectory&lt;/i&gt;&lt;/codeblock&gt;
&lt;/refsyn&gt;
+    &lt;section&gt;Indicates the location of tracing files.&lt;/section&gt;
+&lt;section&gt;&lt;title&gt;Security Considerations&lt;/title&gt;
+&lt;p&gt;
+    The Network Server will attempt to create the trace directory
+    (and any parent directories) if they do not exist.
+    This will require that the Java security policy for 
+    &lt;codeph&gt;derbynet.jar&lt;/codeph&gt;
+    permits verification of the existence of the named trace directory
+    and all necessary parent directories.
+    For each directory created, the policy must allow
+    &lt;codeblock&gt;
+    permission java.io.FilePermission "&amp;lt;&lt;i&gt;directory&lt;/i&gt;&amp;gt;", "read,write";
+    &lt;/codeblock&gt;
+    and for the trace directory itself, the policy must allow
+    &lt;codeblock&gt;
+    permission java.io.FilePermission "&amp;lt;&lt;i&gt;tracedirectory&lt;/i&gt;&amp;gt;${/}-",
"write";
+    &lt;/codeblock&gt;
+&lt;/p&gt;
+&lt;p&gt;
+    See &lt;xref href="tadminnetservcustom.dita#tadminnetservcustom"&gt;&lt;/xref&gt; for
+    information about customizing the Network Server's security policy.
+&lt;/p&gt;
+    &lt;/section&gt;
+&lt;refsyn&gt;&lt;title&gt;Syntax&lt;/title&gt; &lt;codeblock&gt;derby.drda.traceDirectory=&lt;i&gt;tracefiledirectory&lt;/i&gt;&lt;/codeblock&gt;&lt;/refsyn&gt;
 &lt;section&gt;&lt;title&gt;Default&lt;/title&gt; &lt;p&gt;If the derby.system.home property
-has been set, it is the default. Otherwise, the default is the current directory.&lt;/p&gt;
&lt;/section&gt;
+        has been set, it is the default. Otherwise, the default is the current directory.&lt;/p&gt;
+&lt;/section&gt;
 &lt;example&gt; &lt;title&gt;Example&lt;/title&gt;&lt;codeblock&gt;&lt;b&gt;derby.drda.traceDirectory=c:/&lt;ph
 conref="../conrefs.dita#prod/productshortname"&gt;&lt;/ph&gt;/trace&lt;/b&gt;&lt;/codeblock&gt;
&lt;/example&gt;
 &lt;section&gt;&lt;title&gt;Static or dynamic&lt;/title&gt; &lt;p&gt;Dynamic. System values
can be

Modified: db/derby/docs/trunk/src/adminguide/tadminadv804410.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/adminguide/tadminadv804410.dita?rev=885669&amp;r1=885668&amp;r2=885669&amp;view=diff
==============================================================================
--- db/derby/docs/trunk/src/adminguide/tadminadv804410.dita (original)
+++ db/derby/docs/trunk/src/adminguide/tadminadv804410.dita Tue Dec  1 04:54:14 2009
@@ -29,14 +29,34 @@
 &lt;info&gt;If you specify a &amp;lt;&lt;i&gt;connection number&lt;/i&gt;&amp;gt;, tracing
will be turned
 on only for that connection.&lt;/info&gt;&lt;/step&gt;
 &lt;step&gt;&lt;cmd&gt;Set the location of the tracing files by specifying the following
-property:&lt;/cmd&gt;&lt;stepxmp&gt;&lt;codeblock&gt;derby.drda.traceDirectory=&amp;lt;&lt;i&gt;directory
for tracing files&lt;/i&gt;&amp;gt;&lt;/codeblock&gt;&lt;/stepxmp&gt;
-&lt;info&gt;You need to specify only the directory where the tracing files will
+property:&lt;/cmd&gt;&lt;stepxmp&gt;&lt;codeblock&gt;derby.drda.traceDirectory=&amp;lt;&lt;i&gt;directory
for tracing files&lt;/i&gt;&amp;gt;&lt;/codeblock&gt;
+Alternatively,
+while the Network Server is running, enter the following command
+to set the trace directory:&lt;codeblock&gt;java org.apache.derby.drda.NetworkServerControl
traceDirectory 
+&amp;lt;&lt;i&gt;directory for tracing files&lt;/i&gt;&amp;gt; [-h &amp;lt;&lt;i&gt;hostname&lt;/i&gt;&amp;gt;]
[-p &amp;lt;&lt;i&gt;portnumber&lt;/i&gt;&amp;gt;]  &lt;/codeblock&gt; &lt;/stepxmp&gt;
+&lt;p&gt;You need to specify only the directory where the tracing files will
 reside. The names of the tracing files are determined by the system. If you
-do not set a trace directory, the tracing files will be placed in derby.system.home.&lt;/info&gt;
-&lt;/step&gt;
-&lt;step&gt;&lt;cmd&gt;While the Network Server is running, enter the following command
-to set the trace directory:&lt;/cmd&gt;&lt;stepxmp&gt;&lt;codeblock&gt;java org.apache.derby.drda.NetworkServerControl
traceDirectory 
-&amp;lt;&lt;i&gt;directory for tracing files&lt;/i&gt;&amp;gt;[-h &amp;lt;&lt;i&gt;hostname&lt;/i&gt;&amp;gt;]
[-p &amp;lt;&lt;i&gt;portnumber&lt;/i&gt;&amp;gt;]  &lt;/codeblock&gt; &lt;/stepxmp&gt;
+do not set a trace directory, the tracing files will be placed in derby.system.home.&lt;/p&gt;
+&lt;p&gt;
+    The Network Server will attempt to create the trace directory
+    (and any parent directories) if they do not exist.
+    This will require that the Java security policy for 
+    &lt;codeph&gt;derbynet.jar&lt;/codeph&gt;
+    permits verification of the existence of the named trace directory
+    and all necessary parent directories.
+    For each directory created, the policy must allow
+    &lt;codeblock&gt;
+    permission java.io.FilePermission "&amp;lt;&lt;i&gt;directory&lt;/i&gt;&amp;gt;", "read,write";
+    &lt;/codeblock&gt;
+    and for the trace directory itself, the policy must allow
+    &lt;codeblock&gt;
+    permission java.io.FilePermission "&amp;lt;&lt;i&gt;tracedirectory&lt;/i&gt;&amp;gt;${/}-",
"write";
+    &lt;/codeblock&gt;
+&lt;/p&gt;
+&lt;p&gt;
+    See &lt;xref href="tadminnetservcustom.dita#tadminnetservcustom"&gt;&lt;/xref&gt; for
+    information about customizing the Network Server's security policy.
+&lt;/p&gt;
 &lt;/step&gt;
 &lt;/steps&gt;
 &lt;/taskbody&gt;




</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r885659 - in /db/derby/code/trunk/java/engine/org/apache/derby/impl: sql/execute/BasicSortObserver.java store/access/sort/MergeSort.java</title>
<author><name>dag@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200912.mbox/%3c20091201024940.F19E323888C5@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091201024940-F19E323888C5@eris-apache-org%3e</id>
<updated>2009-12-01T02:49:28Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: dag
Date: Tue Dec  1 02:49:15 2009
New Revision: 885659

URL: http://svn.apache.org/viewvc?rev=885659&amp;view=rev
Log:
DERBY-4413 INSERT from SELECT DISTINCT gives assertFailure (sane), or NPE (insane) in presence
of generated columns

After DERBY-4442 went in, the exception to the ASSERT check we made in
the original fix for this issue should be rolled back, so as to
provide a better internal consistency check. Patch derby-4413-rollback
does this.


Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BasicSortObserver.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/sort/MergeSort.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BasicSortObserver.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BasicSortObserver.java?rev=885659&amp;r1=885658&amp;r2=885659&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BasicSortObserver.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BasicSortObserver.java
Tue Dec  1 02:49:15 2009
@@ -168,12 +168,7 @@
 		{
 			// the only difference between getClone and cloneObject is cloneObject does
 			// not objectify a stream.  We use getClone here.  Beetle 4896.
-
-			// DERBY-4413 shows that the value for a generated column will be
-			// null as the result set is computed as part of an INSERT INTO, so
-			// accept a null also.
-			newArray[i] =
-				(origArray[i] != null ? origArray[i].getClone() : null);
+			newArray[i] = origArray[i].getClone();
 		}
 
 		return newArray;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/sort/MergeSort.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/sort/MergeSort.java?rev=885659&amp;r1=885658&amp;r2=885659&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/sort/MergeSort.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/sort/MergeSort.java
Tue Dec  1 02:49:15 2009
@@ -126,12 +126,6 @@
 	**/
 	protected boolean columnOrderingNullsLowMap[];
 
-
-	/**
-    Determine whether a column is used for ordering or not.
-	**/
-	private boolean isOrderingColumn[];
-
 	/**
 	The sort observer.  May be null.  Used as a callback.
 	**/
@@ -461,18 +455,8 @@
                 Object col2 = template[colid];
                 if (col1 == null)
 				{
-					if (!isOrderingColumn[colid]) {
-
-						// DERBY-4413 shows that the value for a generated
-						// column will be null as the result set is computed as
-						// part of an INSERT INTO, so accept a null also.
-						// This column would not be part of the sort key.
-
-						continue;
-
-					} else {
-						SanityManager.THROWASSERT("col[" + colid + "] is null");
-					}
+					SanityManager.THROWASSERT(
+						"col[" + colid + "]  is null");
 				}
 						
                 if (!(col1 instanceof CloneableObject))
@@ -562,27 +546,13 @@
         columnOrderingMap          = new int[columnOrdering.length];
         columnOrderingAscendingMap = new boolean[columnOrdering.length];
         columnOrderingNullsLowMap  = new boolean[columnOrdering.length];
-
-		if (SanityManager.DEBUG) {
-			isOrderingColumn = new boolean[template.length];
-
-			for (int i = 0; i &lt; isOrderingColumn.length; i++) {
-				isOrderingColumn[i] = false;
-			}
-		}
-
-		for (int i = 0; i &lt; columnOrdering.length; i++)
+        for (int i = 0; i &lt; columnOrdering.length; i++)
         {
             columnOrderingMap[i] = columnOrdering[i].getColumnId();
             columnOrderingAscendingMap[i] = columnOrdering[i].getIsAscending();
             columnOrderingNullsLowMap[i] = columnOrdering[i].getIsNullsOrderedLow();
-
-			if (SanityManager.DEBUG) {
-				isOrderingColumn[columnOrderingMap[i]] = true;
-			}
         }
 
-
 		// No inserter or scan yet.
 		this.inserter = null;
 		this.scan = null;




</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r885595 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/sql/compile/ testing/org/apache/derbyTesting/functionTests/tests/lang/</title>
<author><name>dag@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200911.mbox/%3c20091130222217.2349A23888E8@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091130222217-2349A23888E8@eris-apache-org%3e</id>
<updated>2009-11-30T22:22:16Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: dag
Date: Mon Nov 30 22:22:15 2009
New Revision: 885595

URL: http://svn.apache.org/viewvc?rev=885595&amp;view=rev
Log:
DERBY-4426 With generated columns, INSERT with DEFAULT inside a VALUES clause inside a UNION
fails

Patch derby-4426c, which fixes this issue. We ensure that DEFAULT is
only used in a top level VALUES clause, conformant with the standard. 


Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/InsertNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultSetNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RowResultSetNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SelectNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetOperatorNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SingleChildResultSetNode.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableOperatorNode.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ColumnDefaultsTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsHelper.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsTest.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/InsertNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/InsertNode.java?rev=885595&amp;r1=885594&amp;r2=885595&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/InsertNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/InsertNode.java Mon
Nov 30 22:22:15 2009
@@ -295,8 +295,18 @@
 				" on return from RS.bindExpressions()");
 		}
 
-		/* Replace any DEFAULTs with the associated tree */
-		resultSet.replaceDefaults(targetTableDescriptor, targetColumnList);
+        /* Replace any DEFAULTs with the associated tree, or flag DEFAULTs if
+         * not allowed (inside top level set operator nodes). Subqueries are
+         * checked for illegal DEFAULTs elsewhere.
+         */
+        boolean isTableConstructor =
+            (resultSet instanceof UnionNode &amp;&amp;
+             ((UnionNode)resultSet).tableConstructor()) ||
+            resultSet instanceof RowResultSetNode;
+
+        resultSet.replaceOrForbidDefaults(targetTableDescriptor,
+                                          targetColumnList,
+                                          isTableConstructor);
 
 		/* Bind the expressions now that the result columns are bound 
 		 * NOTE: This will be the 2nd time for those underlying ResultSets

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java?rev=885595&amp;r1=885594&amp;r2=885595&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
Mon Nov 30 22:22:15 2009
@@ -3864,14 +3864,18 @@
 	}
 
 	/**
-	 * Replace any DEFAULTs with the associated tree for the default.
+	 * Replace any DEFAULTs with the associated tree for the default if
+	 * allowed, or flag.
 	 *
 	 * @param ttd	The TableDescriptor for the target table.
 	 * @param tcl	The RCL for the target table.
+     * @param allowDefaults true if allowed
 	 *
 	 * @exception StandardException		Thrown on error
 	 */
-	void replaceDefaults(TableDescriptor ttd, ResultColumnList tcl) 
+	void replaceOrForbidDefaults(TableDescriptor ttd,
+                                 ResultColumnList tcl,
+                                 boolean allowDefaults)
 		throws StandardException
 	{
 		int size = size();
@@ -3882,6 +3886,11 @@
 
 			if (rc.isDefaultColumn())
 			{
+                if (!allowDefaults) {
+                    throw StandardException.newException(
+                        SQLState.LANG_INVALID_USE_OF_DEFAULT);
+                }
+
 				//				DefaultNode defaultNode = (DefaultNode) rc.getExpression();
 				// Get ColumnDescriptor by name or by position?
 				ColumnDescriptor cd;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultSetNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultSetNode.java?rev=885595&amp;r1=885594&amp;r2=885595&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultSetNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultSetNode.java Mon
Nov 30 22:22:15 2009
@@ -1763,19 +1763,28 @@
 		return false;
 	}
 
-	/**
-	 * Replace any DEFAULTs with the associated tree for the default.
-	 *
-	 * @param ttd	The TableDescriptor for the target table.
-	 * @param tcl	The RCL for the target table.
-	 *
-	 * @exception StandardException		Thrown on error
-	 */
-	void replaceDefaults(TableDescriptor ttd, ResultColumnList tcl) 
-		throws StandardException
-	{
-		// Only subclasses with something to do override this.
-	}
+    /**
+     * Replace any DEFAULTs with the associated tree for the default if
+     * allowed, or flag (when inside top level set operator nodes). Subqueries
+     * are checked for illegal DEFAULTs elsewhere.
+     *
+     * @param ttd   The TableDescriptor for the target table.
+     * @param tcl   The RCL for the target table.
+     * @param allowDefaults true if allowed
+     *
+     * @exception StandardException         Thrown on error
+     */
+    void replaceOrForbidDefaults(TableDescriptor ttd,
+                                 ResultColumnList tcl,
+                                 boolean allowDefaults)
+        throws StandardException
+    {
+        if (SanityManager.DEBUG) {
+            SanityManager.THROWASSERT(
+                "replaceOrForbidDefaults() not expected to be called for " +
+                this.getClass().getName());
+        }
+    }
 
 	/**
 	 * Is it possible to do a distinct scan on this ResultSet tree.

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RowResultSetNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RowResultSetNode.java?rev=885595&amp;r1=885594&amp;r2=885595&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RowResultSetNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RowResultSetNode.java
Mon Nov 30 22:22:15 2009
@@ -853,17 +853,14 @@
 	}
 
 	/**
-	 * Replace any DEFAULTs with the associated tree for the default.
-	 *
-	 * @param ttd	The TableDescriptor for the target table.
-	 * @param tcl	The RCL for the target table.
-	 *
-	 * @exception StandardException		Thrown on error
+     * {@inheritDoc}
 	 */
-	void replaceDefaults(TableDescriptor ttd, ResultColumnList tcl) 
+	void replaceOrForbidDefaults(TableDescriptor ttd,
+                                 ResultColumnList tcl,
+                                 boolean allowDefaults)
 		throws StandardException
 	{
-		resultColumns.replaceDefaults(ttd, tcl);
+		resultColumns.replaceOrForbidDefaults(ttd, tcl, allowDefaults);
 	}
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SelectNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SelectNode.java?rev=885595&amp;r1=885594&amp;r2=885595&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SelectNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SelectNode.java Mon
Nov 30 22:22:15 2009
@@ -2423,4 +2423,16 @@
 				clauseName);
 		}
 	}
+
+    /**
+     * {@inheritDoc}
+     *
+     * A no-op for SelectNode.
+     */
+    void replaceOrForbidDefaults(TableDescriptor ttd,
+                                 ResultColumnList tcl,
+                                 boolean allowDefaults)
+        throws StandardException
+    {
+    }
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetOperatorNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetOperatorNode.java?rev=885595&amp;r1=885594&amp;r2=885595&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetOperatorNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SetOperatorNode.java
Mon Nov 30 22:22:15 2009
@@ -686,7 +686,20 @@
 		}			
 	}
 
-	/**
+    /**
+     * {@inheritDoc}
+     */
+    void replaceOrForbidDefaults(TableDescriptor ttd,
+                                 ResultColumnList tcl,
+                                 boolean allowDefaults)
+        throws StandardException
+    {
+        leftResultSet.replaceOrForbidDefaults(ttd, tcl, allowDefaults);
+        rightResultSet.replaceOrForbidDefaults(ttd, tcl, allowDefaults);
+    }
+
+
+    /**
 	 * Get the parameter types from the given RowResultSetNode into the
 	 * given array of types.  If an array position is already filled in,
 	 * don't clobber it.

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SingleChildResultSetNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SingleChildResultSetNode.java?rev=885595&amp;r1=885594&amp;r2=885595&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SingleChildResultSetNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SingleChildResultSetNode.java
Mon Nov 30 22:22:15 2009
@@ -555,20 +555,6 @@
 	}
 
 	/**
-	 * Replace any DEFAULTs with the associated tree for the default.
-	 *
-	 * @param ttd	The TableDescriptor for the target table.
-	 * @param tcl	The RCL for the target table.
-	 *
-	 * @exception StandardException		Thrown on error
-	 */
-	void replaceDefaults(TableDescriptor ttd, ResultColumnList tcl) 
-		throws StandardException
-	{
-		childResult.replaceDefaults(ttd, tcl);
-	}
-
-	/**
 	 * @see ResultSetNode#adjustForSortElimination
 	 */
 	void adjustForSortElimination()

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableOperatorNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableOperatorNode.java?rev=885595&amp;r1=885594&amp;r2=885595&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableOperatorNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableOperatorNode.java
Mon Nov 30 22:22:15 2009
@@ -929,21 +929,6 @@
 	}
 
 	/**
-	 * Replace any DEFAULTs with the associated tree for the default.
-	 *
-	 * @param ttd	The TableDescriptor for the target table.
-	 * @param tcl	The RCL for the target table.
-	 *
-	 * @exception StandardException		Thrown on error
-	 */
-	void replaceDefaults(TableDescriptor ttd, ResultColumnList tcl) 
-		throws StandardException
-	{
-		leftResultSet.replaceDefaults(ttd, tcl);
-		rightResultSet.replaceDefaults(ttd, tcl);
-	}
-
-	/**
 	 * @see ResultSetNode#adjustForSortElimination
 	 */
 	void adjustForSortElimination()

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ColumnDefaultsTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ColumnDefaultsTest.java?rev=885595&amp;r1=885594&amp;r2=885595&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ColumnDefaultsTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ColumnDefaultsTest.java
Mon Nov 30 22:22:15 2009
@@ -144,7 +144,19 @@
         
         assertStatementError("42802", st,
             " insert into neg values (default, 1)");
-        
+
+
+        // DERBY-4426
+        assertStatementError("42Y85", st,
+            " insert into neg values (default) union values (default)");
+
+        assertStatementError("42Y85", st,
+            " insert into neg values (default) except values (default)");
+
+        // Make sure sub-queries are inspected for illegal DEFAULT also.
+        assertStatementError("42Y85", st,
+            " insert into neg select * from (values default) t");
+
         st.executeUpdate( " drop table neg");
         
         st.executeUpdate( "drop function asdf");
@@ -402,7 +414,21 @@
         };
         
         JDBC.assertFullResultSet(rs, expRS, true);
-        
+
+        // DERBY-4426: make sure we don't forbid inside a multi-value table
+        // constructor since this is represented as a UnionNode
+        st.executeUpdate( "delete from t7");
+        st.executeUpdate( "insert into t7 values 1, default");
+        rs = st.executeQuery( " select * from t7");
+
+        expRS = new String [][]
+        {
+            {"1"},
+            {"10"}
+        };
+
+        JDBC.assertFullResultSet(rs, expRS, true);
+
         st.executeUpdate( " drop table t1");
         
         st.executeUpdate( " drop table t7");

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsHelper.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsHelper.java?rev=885595&amp;r1=885594&amp;r2=885595&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsHelper.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsHelper.java
Mon Nov 30 22:22:15 2009
@@ -87,7 +87,8 @@
     protected static  final   String  CASCADED_COLUMN_DROP_WARNING = "01009";
     protected static  final   String  CONSTRAINT_DROPPED_WARNING = "01500";
     protected static  final   String  TRIGGER_DROPPED_WARNING = "01502";
-    
+    protected static  final   String  LANG_INVALID_USE_OF_DEFAULT = "42Y85";
+
     ///////////////////////////////////////////////////////////////////////////////////
     //
     // STATE

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsTest.java?rev=885595&amp;r1=885594&amp;r2=885595&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsTest.java
Mon Nov 30 22:22:15 2009
@@ -233,6 +233,43 @@
         rollback();
     }
 
+
+    /**
+     * Test for DERBY-4426
+     */
+    public void testDerby_4426() throws SQLException {
+
+        Statement s = createStatement();
+        ResultSet rs = null;
+        setAutoCommit(false);
+
+        s.execute("create table t(a int, b generated always as (-a))");
+        s.execute("insert into t(b,a) values (default,1)");
+
+        // Wrong use of default
+        expectCompilationError
+            (
+             LANG_INVALID_USE_OF_DEFAULT,
+             "insert into t(b,a) values (default,3) intersect " +
+             "                   values (default,3)"
+             );
+
+        expectCompilationError
+            (
+             LANG_INVALID_USE_OF_DEFAULT,
+             "insert into t(a,b) values (3,default) except values (3,default)"
+             );
+
+        expectCompilationError
+            (
+             LANG_INVALID_USE_OF_DEFAULT,
+             "insert into t values (3,default) union values (3,default)"
+             );
+
+
+        rollback();
+    }
+
     /**
      * &lt;p&gt;
      * Test that the stored system procedures and functions are non-deterministic. If you
want




</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r885531 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UDTTest.java</title>
<author><name>rhillegas@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200911.mbox/%3c20091130184055.DC48923888D1@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091130184055-DC48923888D1@eris-apache-org%3e</id>
<updated>2009-11-30T18:40:55Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: rhillegas
Date: Mon Nov 30 18:40:55 2009
New Revision: 885531

URL: http://svn.apache.org/viewvc?rev=885531&amp;view=rev
Log:
DERBY-4454: Disable a test case on jsr169 because DECIMAL support is not as complete on that
platform.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UDTTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UDTTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UDTTest.java?rev=885531&amp;r1=885530&amp;r2=885531&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UDTTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UDTTest.java
Mon Nov 30 18:40:55 2009
@@ -33,6 +33,7 @@
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
 import org.apache.derbyTesting.junit.TestConfiguration;
 import org.apache.derbyTesting.junit.CleanDatabaseTestSetup;
+import org.apache.derbyTesting.junit.JDBC;
 
 /**
  * &lt;p&gt;
@@ -150,6 +151,10 @@
      */
     public void test_02_basicColumnRetvalParam() throws Exception
     {
+        //
+        // DECIMAL datatype used here and the JSR169 support for it is less complete.
+        //
+        if ( JDBC.vmSupportsJSR169() ) { return; }
         Connection conn = getConnection();
 
         goodStatement( conn, "create type Price external name 'org.apache.derbyTesting.functionTests.tests.lang.Price'
language java\n" );




</pre>
</div>
</content>
</entry>
<entry>
<title>=?utf-8?q?=5BDb-derby_Wiki=5D_Update_of_=22UsesOfDerby=22_by_KatheyMarsde?= =?utf-8?q?n?=</title>
<author><name>Apache Wiki &lt;wikidiffs@apache.org&gt;</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200911.mbox/%3c20091130165407.23555.10620@eos.apache.org%3e"/>
<id>urn:uuid:%3c20091130165407-23555-10620@eos-apache-org%3e</id>
<updated>2009-11-30T16:54:07Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Db-derby Wiki" for change notification.

The "UsesOfDerby" page has been changed by KatheyMarsden.
http://wiki.apache.org/db-derby/UsesOfDerby?action=diff&amp;rev1=86&amp;rev2=87

--------------------------------------------------

  === JDBC Drivers ===
     * [[http://c-jdbc.objectweb.org/|C-JDBC]]
     * [[http://db.apache.org/derby/docs/10.1/adminguide/cadminappsclient.html|Derby Network
Client]]
-    * [[http://www.ibm.com/developerworks/db2/downloads/jcc/|IBM DB2 JDBC Universal Driver]]
     * [[http://sequoia.continuent.org/HomePage|Sequoia]]
     * [[http://www.starquest.com|StarQuest StarSQL for Java]]
  
  === ODBC Drivers ===
     * [[http://carob.continuent.org/HomePage|Carob]]
     * [[http://www.easysoft.com/products/data_access/odbc_jdbc_gateway/index.html|EasySoft
ODBC-JDBC Gateway]]
-    * [[http://www.ibm.com/developerworks/db2/library/techarticle/dm-0409cline2/index.html|IBM
DB2 Runtime Client]]
     * [[http://opendrda.sourceforge.net/|OpenDRDA]]
     * [[http://www.datadirect.com/products/sequelink/matrix/slwebmatrixosvendorview.htm|DataDirect]]
     * [[http://www.starquest.com/|StarQuest]]
@@ -179, +177 @@

     * [[http://avidbuilder.com|AvidBuilder web-based Derby GUI]]
     * [[http://www.eclipse.org/webtools/|Eclipse Web Tools Project (WTP)]] 
     * [[http://mail-archives.apache.org/mod_mbox/db-derby-user/200509.mbox/%3c432F6BDA.8010605@CharlieKelly.com%3e|Eclipse+Hibernate]]
-    * [[http://mail-archives.apache.org/mod_mbox/db-derby-user/200510.mbox/%3c20051004211010.83287.qmail@web81305.mail.yahoo.com%3e|IBM
Cloudscape Workbench]]
     * [[http://isql.sourceforge.net/|iSQL-Viewer]]
     * [[http://www.openoffice.org|OpenOffice]] ([[http://www.eactscongenitaldb.org/docs/OpenOffice_and_JDBC_for_data_access|Derby
instructions]])
     * [[http://squirrel-sql.sourceforge.net/|SQuirrel SQL]] ([[http://db.apache.org/derby/integrate/SQuirreL_Derby.html|Derby
instructions]])


</pre>
</div>
</content>
</entry>
<entry>
<title>svn commit: r885489 - /db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/BaseTypeIdImpl.java</title>
<author><name>rhillegas@apache.org</name></author>
<link rel="alternate" href="http://mail-archives.apache.org/mod_mbox/db-derby-commits/200911.mbox/%3c20091130164924.3B37723888D1@eris.apache.org%3e"/>
<id>urn:uuid:%3c20091130164924-3B37723888D1@eris-apache-org%3e</id>
<updated>2009-11-30T16:49:24Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>
Author: rhillegas
Date: Mon Nov 30 16:49:23 2009
New Revision: 885489

URL: http://svn.apache.org/viewvc?rev=885489&amp;view=rev
Log:
DERBY-651: fix typo in javadoc.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/BaseTypeIdImpl.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/BaseTypeIdImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/BaseTypeIdImpl.java?rev=885489&amp;r1=885488&amp;r2=885489&amp;view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/BaseTypeIdImpl.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/BaseTypeIdImpl.java Mon
Nov 30 16:49:23 2009
@@ -117,7 +117,7 @@
      * Constructor for an BaseTypeIdImpl which describes a UDT
      *
      * @param schemaName The schema that the UDT lives in
-     * @param unqualifiedName The qualified name of the UDT in that schema
+     * @param unqualifiedName The unqualified name of the UDT in that schema
      */
 
     BaseTypeIdImpl(String schemaName, String unqualifiedName )




</pre>
</div>
</content>
</entry>
</feed>
