db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r441540 [2/6] - in /db/derby/code/branches/10.2/java: client/ client/org/apache/derby/client/am/ client/org/apache/derby/jdbc/ drda/org/apache/derby/impl/drda/ engine/org/apache/derby/impl/jdbc/ engine/org/apache/derby/impl/sql/catalog/ eng...
Date Fri, 08 Sep 2006 15:35:37 GMT
Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/OnceResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/OnceResultSet.java?view=diff&rev=441540&r1=441539&r2=441540
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/OnceResultSet.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/OnceResultSet.java Fri Sep  8 08:35:32 2006
@@ -265,7 +265,6 @@
 			// block, to ensure that it is executed?
 		    clearCurrentRow();
 
-			currentRow = null;
 	        source.close();
 
 			super.close();

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/ProjectRestrictResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/ProjectRestrictResultSet.java?view=diff&rev=441540&r1=441539&r2=441540
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/ProjectRestrictResultSet.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/ProjectRestrictResultSet.java Fri Sep  8 08:35:32 2006
@@ -54,7 +54,7 @@
  *
  * @author ames
  */
-public class ProjectRestrictResultSet extends NoPutResultSetImpl
+class ProjectRestrictResultSet extends NoPutResultSetImpl
 	implements CursorResultSet 
 {
 	/* Run time statistics variables */
@@ -69,7 +69,6 @@
 	public boolean doesProjection;
     private GeneratedMethod projection;
 	private int[]			projectMapping;
-    private GeneratedMethod closeCleanup;
 	private boolean runTimeStatsOn;
 	private ExecRow			mappedResultRow;
 	public boolean reuseResult;
@@ -81,7 +80,7 @@
     //
     // class interface
     //
-    public ProjectRestrictResultSet(NoPutResultSet s,
+    ProjectRestrictResultSet(NoPutResultSet s,
 					Activation a,
 					GeneratedMethod r,
 					GeneratedMethod p,
@@ -91,8 +90,7 @@
 					boolean reuseResult,
 					boolean doesProjection,
 				    double optimizerEstimatedRowCount,
-					double optimizerEstimatedCost,
-					GeneratedMethod c) 
+					double optimizerEstimatedCost) 
 		throws StandardException
 	{
 		super(a, resultSetNumber, optimizerEstimatedRowCount, optimizerEstimatedCost);
@@ -110,7 +108,6 @@
 		projectMapping = ((ReferencedColumnsDescriptorImpl) a.getPreparedStatement().getSavedObject(mapRefItem)).getReferencedColumnPositions();
 		this.reuseResult = reuseResult;
 		this.doesProjection = doesProjection;
-        closeCleanup = c;
 
 		// Allocate a result row if all of the columns are mapped from the source
 		if (projection == null)
@@ -367,11 +364,7 @@
 			// REVISIT: does this need to be in a finally
 			// block, to ensure that it is executed?
 	    	clearCurrentRow();
-			if (closeCleanup != null) 
-			{
-				closeCleanup.invoke(activation); // let activation tidy up
-			}
-			currentRow = null;
+
 	        source.close();
 
 			super.close();

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/RowResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/RowResultSet.java?view=diff&rev=441540&r1=441539&r2=441540
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/RowResultSet.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/RowResultSet.java Fri Sep  8 08:35:32 2006
@@ -61,7 +61,6 @@
 	private boolean canCacheRow;
 	private boolean next;
 	private GeneratedMethod row;
-	protected GeneratedMethod closeCleanup;
 	private ExecRow		cachedRow;
 
     //
@@ -74,15 +73,13 @@
 		boolean 		canCacheRow,
 		int 			resultSetNumber,
 		double 			optimizerEstimatedRowCount,
-		double 			optimizerEstimatedCost,
-		GeneratedMethod closeCleanup
+		double 			optimizerEstimatedCost
 	)
 	{
 		super(activation, resultSetNumber, 
 			  optimizerEstimatedRowCount, optimizerEstimatedCost);
 
         this.row = row;
-		this.closeCleanup = closeCleanup;
 		this.canCacheRow = canCacheRow;
 		constructorTime += getElapsedMillis(beginTime);
     }
@@ -97,8 +94,7 @@
 		boolean 		canCacheRow,
 		int 			resultSetNumber,
 		double 			optimizerEstimatedRowCount,
-		double 			optimizerEstimatedCost,
-		GeneratedMethod closeCleanup
+		double 			optimizerEstimatedCost
 	)
 	{
 		super(activation, resultSetNumber, 
@@ -106,7 +102,6 @@
 
 		beginTime = getCurrentTimeMillis();
         this.cachedRow = constantRow;
-		this.closeCleanup = closeCleanup;
 		this.canCacheRow = canCacheRow;
 		constructorTime += getElapsedMillis(beginTime);
     }
@@ -178,9 +173,6 @@
 	{
 		beginTime = getCurrentTimeMillis();
 		if (isOpen) {
-			if (closeCleanup != null) {
-				closeCleanup.invoke(activation); // let activation tidy up
-			}
 
 			// we don't want to keep around a pointer to the
 			// row ... so it can be thrown away.

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/ScalarAggregateResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/ScalarAggregateResultSet.java?view=diff&rev=441540&r1=441539&r2=441540
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/ScalarAggregateResultSet.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/ScalarAggregateResultSet.java Fri Sep  8 08:35:32 2006
@@ -63,7 +63,7 @@
  *
  * @author jerry (broken out from SortResultSet)
  */
-public class ScalarAggregateResultSet extends GenericAggregateResultSet
+class ScalarAggregateResultSet extends GenericAggregateResultSet
 	implements CursorResultSet 
 {
 
@@ -97,7 +97,7 @@
 	 *
 	 * @exception StandardException Thrown on error
 	 */
-    public ScalarAggregateResultSet(NoPutResultSet s,
+    ScalarAggregateResultSet(NoPutResultSet s,
 					boolean isInSortedOrder,
 					int	aggregateItem,
 					Activation a,
@@ -105,10 +105,9 @@
 					int resultSetNumber,
 					boolean singleInputRow,
 				    double optimizerEstimatedRowCount,
-				    double optimizerEstimatedCost,
-					GeneratedMethod c) throws StandardException 
+				    double optimizerEstimatedCost) throws StandardException 
 	{
-		super(s, aggregateItem, a, ra, resultSetNumber, optimizerEstimatedRowCount, optimizerEstimatedCost, c);
+		super(s, aggregateItem, a, ra, resultSetNumber, optimizerEstimatedRowCount, optimizerEstimatedCost);
 		this.isInSortedOrder = isInSortedOrder;
 		// source expected to be non-null, mystery stress test bug
 		// - sometimes get NullPointerException in openCore().
@@ -282,12 +281,8 @@
 			// REVISIT: does this need to be in a finally
 			// block, to ensure that it is executed?
 		    clearCurrentRow();
-			if (closeCleanup != null) {
-				closeCleanup.invoke(activation); // let activation tidy up
-			}
 
 	        countOfRows = 0;
-			currentRow = null;
 			sourceExecIndexRow = null;
 			source.close();
 

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/ScrollInsensitiveResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/ScrollInsensitiveResultSet.java?view=diff&rev=441540&r1=441539&r2=441540
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/ScrollInsensitiveResultSet.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/ScrollInsensitiveResultSet.java Fri Sep  8 08:35:32 2006
@@ -119,8 +119,6 @@
 
 	private int maxRows;
 
-    private GeneratedMethod closeCleanup;
-
     private boolean keepAfterCommit;
 
 	/* The hash table will contain a different number of extra columns depending
@@ -172,8 +170,7 @@
 							  Activation activation, int resultSetNumber,
 							  int sourceRowWidth,
 							  double optimizerEstimatedRowCount,
-							  double optimizerEstimatedCost,
-							  GeneratedMethod c) throws StandardException
+							  double optimizerEstimatedCost) throws StandardException
 	{
 		super(activation, resultSetNumber, 
 			  optimizerEstimatedRowCount, optimizerEstimatedCost);
@@ -187,7 +184,6 @@
 				"maxRows not expected to be -1");
 		}
 
-        closeCleanup = c;
 		constructorTime += getElapsedMillis(beginTime);
 
 		positionInHashTable = new SQLInteger();
@@ -862,10 +858,6 @@
 		beginTime = getCurrentTimeMillis();
 	    if ( isOpen )
 	    {
-			if (closeCleanup != null) 
-			{
-				closeCleanup.invoke(activation); // let activation tidy up
-			} 
 			currentRow = null;
 	        source.close();
 

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/SetOpResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/SetOpResultSet.java?view=diff&rev=441540&r1=441539&r2=441540
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/SetOpResultSet.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/SetOpResultSet.java Fri Sep  8 08:35:32 2006
@@ -45,12 +45,11 @@
  * the INTERSECT or EXCEPT of the two input result sets. This also projects out the tag, the last column
  * of the input rows.
  */
-public class SetOpResultSet extends NoPutResultSetImpl
+class SetOpResultSet extends NoPutResultSetImpl
     implements CursorResultSet
 {
     private final NoPutResultSet leftSource;
     private final NoPutResultSet rightSource;
-    private final GeneratedMethod closeCleanup;
     private final Activation activation;
     private final int opType;
     private final boolean all;
@@ -78,7 +77,6 @@
                     double optimizerEstimatedCost,
                     int opType,
                     boolean all,
-                    GeneratedMethod closeCleanup,
                     int intermediateOrderByColumnsSavedObject,
                     int intermediateOrderByDirectionSavedObject)
     {
@@ -90,7 +88,7 @@
         this.resultSetNumber = resultSetNumber;
         this.opType = opType;
         this.all = all;
-        this.closeCleanup = closeCleanup;
+
         ExecPreparedStatement eps = activation.getPreparedStatement();
         intermediateOrderByColumns = (int[]) eps.getSavedObject(intermediateOrderByColumnsSavedObject);
         intermediateOrderByDirection = (int[]) eps.getSavedObject(intermediateOrderByDirectionSavedObject);
@@ -261,10 +259,7 @@
 		beginTime = getCurrentTimeMillis();
 		if ( isOpen )
         {
-			if (closeCleanup != null)
-				closeCleanup.invoke(activation); // let activation tidy up
 	    	clearCurrentRow();
-			currentRow = null;
             prevCols = null;
             leftSource.close();
             rightSource.close();

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/SortResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/SortResultSet.java?view=diff&rev=441540&r1=441539&r2=441540
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/SortResultSet.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/SortResultSet.java Fri Sep  8 08:35:32 2006
@@ -111,7 +111,7 @@
  *
  * @author ames, rewrite for aggregates by jamie, aggregate removal by jerry
  */
-public class SortResultSet extends NoPutResultSetImpl
+class SortResultSet extends NoPutResultSetImpl
 	implements CursorResultSet 
 {
 
@@ -123,7 +123,6 @@
     // set in constructor and not altered during
     // life of object.
     public NoPutResultSet source;
-    private GeneratedMethod closeCleanup;
 	private GeneratedMethod rowAllocator;
 	private ColumnOrdering[] order;
 	private ColumnOrdering[] savedOrder;
@@ -182,8 +181,7 @@
 					int maxRowSize,
 					int resultSetNumber,
 				    double optimizerEstimatedRowCount,
-				    double optimizerEstimatedCost,
-					GeneratedMethod c) throws StandardException 
+				    double optimizerEstimatedCost) throws StandardException 
 	{
 		super(a, resultSetNumber, optimizerEstimatedRowCount, optimizerEstimatedCost);
 		this.distinct = distinct;
@@ -192,7 +190,6 @@
         originalSource = s;
 		rowAllocator = ra;
 		this.maxRowSize = maxRowSize;
-        closeCleanup = c;
 		sortTemplateRow = (ExecRow) rowAllocator.invoke(activation);
 		order = (ColumnOrdering[])
 					((FormatableArrayHolder)
@@ -450,11 +447,7 @@
 			// REVISIT: does this need to be in a finally
 			// block, to ensure that it is executed?
 		    clearCurrentRow();
-			if (closeCleanup != null) {
-				closeCleanup.invoke(activation); // let activation tidy up
-			}
 
-			currentRow = null;
 			sortResultRow = null;
 			closeSource();
 

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/TablePrivilegeInfo.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/TablePrivilegeInfo.java?view=diff&rev=441540&r1=441539&r2=441540
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/TablePrivilegeInfo.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/TablePrivilegeInfo.java Fri Sep  8 08:35:32 2006
@@ -28,12 +28,17 @@
 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
 import org.apache.derby.iapi.store.access.TransactionController;
 import org.apache.derby.iapi.sql.depend.DependencyManager;
+import org.apache.derby.iapi.sql.dictionary.AliasDescriptor;
 import org.apache.derby.iapi.sql.dictionary.PermissionsDescriptor;
+import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;
 import org.apache.derby.iapi.sql.dictionary.TablePermsDescriptor;
 import org.apache.derby.iapi.sql.dictionary.ColPermsDescriptor;
 import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
+import org.apache.derby.iapi.sql.dictionary.ViewDescriptor;
 import org.apache.derby.iapi.sql.dictionary.DataDictionary;
 import org.apache.derby.iapi.sql.dictionary.DataDescriptorGenerator;
+import org.apache.derby.iapi.sql.dictionary.TupleDescriptor;
+import org.apache.derby.iapi.reference.SQLState;
 
 import java.util.List;
 import java.util.Iterator;
@@ -59,17 +64,123 @@
 	private TableDescriptor td;
 	private boolean[] actionAllowed;
 	private FormatableBitSet[] columnBitSets;
+	private List descriptorList;
 	
 	/**
 	 * @param actionAllowed actionAllowed[action] is true if action is in the privilege set.
 	 */
 	public TablePrivilegeInfo( TableDescriptor td,
 							   boolean[] actionAllowed,
-							   FormatableBitSet[] columnBitSets)
+							   FormatableBitSet[] columnBitSets,
+							   List descriptorList)
 	{
 		this.actionAllowed = actionAllowed;
 		this.columnBitSets = columnBitSets;
 		this.td = td;
+		this.descriptorList = descriptorList;
+	}
+	
+	/**
+	 * Determines whether a user is the owner of an object
+	 * (table, function, or procedure). Note that the database 
+	 * creator can access database objects without needing to be 
+	 * their owner.
+	 *
+	 * @param user					authorizationId of current user
+	 * @param td       		        table descriptor being checked against
+	 * @param sd					SchemaDescriptor
+	 * @param dd					DataDictionary
+	 * @param lcc                   LanguageConnectionContext
+	 * @param grant                 grant if true; revoke if false
+	 *
+	 * @exception StandardException if user does not own the object
+	 */
+	protected void checkOwnership( String user,
+								   TableDescriptor td,
+								   SchemaDescriptor sd,
+								   DataDictionary dd,
+								   LanguageConnectionContext lcc,
+								   boolean grant)
+		throws StandardException
+	{
+		super.checkOwnership(user, td, sd, dd);
+		
+		// additional check specific to this subclass
+		if (grant)
+		{
+			checkPrivileges(user, td, sd, dd, lcc);
+		}
+	}
+	
+	/**
+	 * Determines if the privilege is grantable by this grantor
+	 * for the given view.
+	 * 
+	 * Note that the database owner can access database objects 
+	 * without needing to be their owner.  This method should only 
+	 * be called if it is a GRANT.
+	 * 
+	 * @param user					authorizationId of current user
+	 * @param td		            TableDescriptor to be checked against
+	 * @param sd					SchemaDescriptor
+	 * @param dd					DataDictionary
+	 * @param lcc                   LanguageConnectionContext
+	 *
+	 * @exception StandardException if user does not have permission to grant
+	 */
+	private void checkPrivileges( String user,
+								   TableDescriptor td,
+								   SchemaDescriptor sd,
+								   DataDictionary dd,
+								   LanguageConnectionContext lcc)
+		throws StandardException
+	{
+		if (user.equals(dd.getAuthorizationDBA())) return;
+		
+		//  check view specific
+		if (td.getTableType() == TableDescriptor.VIEW_TYPE) 
+		{
+			if (descriptorList != null )
+			{			    		   
+				TransactionController tc = lcc.getTransactionExecute();
+				int siz = descriptorList.size();
+				for (int i=0; i < siz; i++)
+				{
+					TupleDescriptor p;
+					SchemaDescriptor s = null;
+
+					p = (TupleDescriptor)descriptorList.get(i);
+					if (p instanceof TableDescriptor)
+					{
+						TableDescriptor t = (TableDescriptor)p;
+						s = t.getSchemaDescriptor();
+			    	}
+					else if (p instanceof ViewDescriptor)
+					{
+						ViewDescriptor v = (ViewDescriptor)p;	
+						s = dd.getSchemaDescriptor(v.getCompSchemaId(), tc);
+					}
+			    	else if (p instanceof AliasDescriptor)
+			    	{
+			    		AliasDescriptor a = (AliasDescriptor)p;
+						s = dd.getSchemaDescriptor( a.getSchemaUUID(), tc);
+			    	}
+								
+					if (s != null && !user.equals(s.getAuthorizationId()) ) 
+					{
+						throw StandardException.newException(
+				    			   SQLState.AUTH_NO_OBJECT_PERMISSION,
+				    			   user,
+				    			   "grant",
+				    			   sd.getSchemaName(),
+								   td.getName());		  
+					}
+			    			   
+			    	// FUTURE: if object is not own by grantor then check if 
+			    	//         the grantor have grant option.
+				}
+			}
+		}
 	}
 	
 	/**
@@ -90,9 +201,10 @@
 		DataDictionary dd = lcc.getDataDictionary();
 		String currentUser = lcc.getAuthorizationId();
 		TransactionController tc = lcc.getTransactionExecute();
-
+		SchemaDescriptor sd = td.getSchemaDescriptor();
+		
 		// Check that the current user has permission to grant the privileges.
-		checkOwnership( currentUser, td, td.getSchemaDescriptor(), dd);
+		checkOwnership( currentUser, td, sd, dd, lcc, grant);
 		
 		DataDescriptorGenerator ddg = dd.getDataDescriptorGenerator();
 

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/TableScanResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/TableScanResultSet.java?view=diff&rev=441540&r1=441539&r2=441540
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/TableScanResultSet.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/TableScanResultSet.java Fri Sep  8 08:35:32 2006
@@ -72,7 +72,7 @@
  *
  * @author ames
  */
-public class TableScanResultSet extends NoPutResultSetImpl
+class TableScanResultSet extends NoPutResultSetImpl
 	implements CursorResultSet, Cloneable
 {
     protected ScanController scanController;
@@ -94,7 +94,6 @@
 	protected GeneratedMethod stopKeyGetter;
 	protected int stopSearchOperator;
 	public    Qualifier[][] qualifiers;
-	protected GeneratedMethod closeCleanup;
 	public String tableName;
 	public String userSuppliedOptimizerOverrides;
 	public String indexName;
@@ -157,7 +156,7 @@
     //
     // class interface
     //
-    public TableScanResultSet(long conglomId,
+    TableScanResultSet(long conglomId,
 		StaticCompiledOpenConglomInfo scoci, 
 		Activation activation, 
 		GeneratedMethod resultRowAllocator, 
@@ -179,8 +178,7 @@
 		int rowsPerRead,
 		boolean oneRowScan,
 		double optimizerEstimatedRowCount,
-		double optimizerEstimatedCost,
-		GeneratedMethod closeCleanup)
+		double optimizerEstimatedCost)
 			throws StandardException
     {
 		super(activation,
@@ -324,8 +322,6 @@
                 "Invalid isolation level - " + isolationLevel);
         }
 
-		this.closeCleanup = closeCleanup;
-
 		runTimeStatisticsOn = (activation != null &&
 							   activation.getLanguageConnectionContext().getRunTimeStatisticsMode());
 
@@ -796,16 +792,7 @@
 			// REVISIT: does this need to be in a finally
 			// block, to ensure that it is executed?
 		    clearCurrentRow();
-			if (closeCleanup != null) {
-				try {
-					closeCleanup.invoke(activation); // let activation tidy up
-				} catch (StandardException se) {
-					if (SanityManager.DEBUG)
-						SanityManager.THROWASSERT(se);
-				}
-			}
-
-			currentRow = null;
+;
 			if (scanController != null)
 			{
 				// This is where we get the positioner info for inner tables

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/UnionResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/UnionResultSet.java?view=diff&rev=441540&r1=441539&r2=441540
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/UnionResultSet.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/UnionResultSet.java Fri Sep  8 08:35:32 2006
@@ -49,7 +49,7 @@
  *
  * @author ames
  */
-public class UnionResultSet extends NoPutResultSetImpl
+class UnionResultSet extends NoPutResultSetImpl
 	implements CursorResultSet {
 
 	/* Run time statistics variables */
@@ -63,7 +63,7 @@
 	// these are set in the constructor and never altered
     public NoPutResultSet source1;
     public NoPutResultSet source2;
-    protected GeneratedMethod closeCleanup;
+
 
     //
     // class interface
@@ -76,15 +76,13 @@
 						  Activation activation, 
 						  int resultSetNumber, 
 					      double optimizerEstimatedRowCount,
-						  double optimizerEstimatedCost,
-						  GeneratedMethod closeCleanup) 
+						  double optimizerEstimatedCost) 
 	{
 		
 		super(activation, resultSetNumber, 
 			  optimizerEstimatedRowCount, optimizerEstimatedCost);
         this.source1 = source1;
         this.source2 = source2;
-		this.closeCleanup = closeCleanup;
 		constructorTime += getElapsedMillis(beginTime);
     }
 
@@ -181,16 +179,13 @@
 	{
 		beginTime = getCurrentTimeMillis();
 		if ( isOpen ) {
-			if (closeCleanup != null) {
-				closeCleanup.invoke(activation); // let activation tidy up
-			}
 
 			// we don't want to keep around a pointer to the
 			// row ... so it can be thrown away.
 			// REVISIT: does this need to be in a finally
 			// block, to ensure that it is executed?
 	    	clearCurrentRow();
-			currentRow = null;
+
 	        switch (whichSource) {
 	            case 1 : source1.close();
 	                     break;

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/VTIResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/VTIResultSet.java?view=diff&rev=441540&r1=441539&r2=441540
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/VTIResultSet.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/execute/VTIResultSet.java Fri Sep  8 08:35:32 2006
@@ -64,7 +64,7 @@
 
 /**
  */
-public class VTIResultSet extends NoPutResultSetImpl
+class VTIResultSet extends NoPutResultSetImpl
 	implements CursorResultSet, VTIEnvironment {
 
 	/* Run time statistics variables */
@@ -75,7 +75,6 @@
 	private ClassInspector classInspector;
     private GeneratedMethod row;
     private GeneratedMethod constructor;
-    protected GeneratedMethod closeCleanup;
 	private PreparedStatement userPS;
 	private ResultSet userVTI;
 	private ExecRow allocatedRow;
@@ -112,8 +111,7 @@
 				 boolean isTarget,
 				 int scanIsolationLevel,
 			     double optimizerEstimatedRowCount,
-				 double optimizerEstimatedCost,
-				 GeneratedMethod closeCleanup) 
+				 double optimizerEstimatedCost) 
 		throws StandardException
 	{
 		super(activation, resultSetNumber, 
@@ -137,7 +135,6 @@
 		compileTimeConstants = (FormatableHashtable) (activation.getPreparedStatement().
 								getSavedObject(ctcNumber));
 
-		this.closeCleanup = closeCleanup;
 		constructorTime += getElapsedMillis(beginTime);
     }
 
@@ -353,9 +350,6 @@
 	{
 		beginTime = getCurrentTimeMillis();
 		if (isOpen) {
-			if (closeCleanup != null) {
-				closeCleanup.invoke(activation); // let activation tidy up
-			}
 
 			// we don't want to keep around a pointer to the
 			// row ... so it can be thrown away.

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/jdbc/Driver40.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/jdbc/Driver40.java?view=diff&rev=441540&r1=441539&r2=441540
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/jdbc/Driver40.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/jdbc/Driver40.java Fri Sep  8 08:35:32 2006
@@ -32,7 +32,6 @@
 import org.apache.derby.impl.jdbc.EmbedConnection30;
 import org.apache.derby.impl.jdbc.EmbedPreparedStatement40;
 import org.apache.derby.impl.jdbc.EmbedCallableStatement40;
-import org.apache.derby.impl.jdbc.EmbedRowId;
 import org.apache.derby.impl.jdbc.EmbedConnection40;
 import org.apache.derby.impl.jdbc.EmbedResultSet;
 import org.apache.derby.impl.jdbc.EmbedResultSet40;
@@ -132,10 +131,6 @@
     public EmbedResultSet newEmbedResultSet(EmbedConnection conn, ResultSet results, boolean forMetaData, org.apache.derby.impl.jdbc.EmbedStatement statement,boolean isAtomic) throws SQLException {
         return new EmbedResultSet40(conn, results, forMetaData, statement,
             isAtomic);
-    }
-    
-    public EmbedRowId newEmbedRowId() throws SQLException {
-        return new EmbedRowId();
     }
     
     /**

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/loc/messages_en.properties
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/loc/messages_en.properties?view=diff&rev=441540&r1=441539&r2=441540
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/loc/messages_en.properties (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/loc/messages_en.properties Fri Sep  8 08:35:32 2006
@@ -1166,6 +1166,7 @@
 2850D=User ''{0}'' can not perform the operation in schema ''{1}''.
 2850E=User ''{0}'' can not create schema ''{1}''. Only database owner could issue this statement.
 2850F=Specified grant or revoke operation is not allowed on object ''{0}''.
+2850G=User ''{0}'' does not have {1} permission on object ''{2}''.''{3}''.
 04501.C=Database connection refused.
 
 

Modified: db/derby/code/branches/10.2/java/shared/org/apache/derby/shared/common/reference/JDBC40Translation.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/shared/org/apache/derby/shared/common/reference/JDBC40Translation.java?view=diff&rev=441540&r1=441539&r2=441540
==============================================================================
--- db/derby/code/branches/10.2/java/shared/org/apache/derby/shared/common/reference/JDBC40Translation.java (original)
+++ db/derby/code/branches/10.2/java/shared/org/apache/derby/shared/common/reference/JDBC40Translation.java Fri Sep  8 08:35:32 2006
@@ -56,10 +56,10 @@
     public static final int FUNCTION_NULLABLE_UNKNOWN  = 2;
 
     // constants from java.sql.Types
-    public static final int NCHAR = -8;
+    public static final int NCHAR = -15;
     public static final int NVARCHAR = -9;
-    public static final int LONGNVARCHAR = -10;
-    public static final int NCLOB = 2007;
-    public static final int ROWID = 2008;
+    public static final int LONGNVARCHAR = -16;
+    public static final int NCLOB = 2011;
+    public static final int ROWID = -8;
     public static final int SQLXML = 2009;
 }

Modified: db/derby/code/branches/10.2/java/shared/org/apache/derby/shared/common/reference/SQLState.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/shared/org/apache/derby/shared/common/reference/SQLState.java?view=diff&rev=441540&r1=441539&r2=441540
==============================================================================
--- db/derby/code/branches/10.2/java/shared/org/apache/derby/shared/common/reference/SQLState.java (original)
+++ db/derby/code/branches/10.2/java/shared/org/apache/derby/shared/common/reference/SQLState.java Fri Sep  8 08:35:32 2006
@@ -1372,6 +1372,7 @@
 	String AUTH_NO_ACCESS_NOT_OWNER                                    = "2850D";
 	String AUTH_NOT_DATABASE_OWNER                                     = "2850E";
 	String AUTH_GRANT_REVOKE_NOT_ALLOWED                               = "2850F";
+	String AUTH_NO_OBJECT_PERMISSION                                   = "2850G";
 
 	/*
 	** Dependency manager

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/harness/jvm.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/harness/jvm.java?view=diff&rev=441540&r1=441539&r2=441540
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/harness/jvm.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/harness/jvm.java Fri Sep  8 08:35:32 2006
@@ -21,12 +21,15 @@
 
 package org.apache.derbyTesting.functionTests.harness;
 
+import java.util.Enumeration;
+import java.util.Properties;
 import java.util.Vector;
 import java.util.StringTokenizer;
 import java.io.File;
 import java.io.IOException;
 
 import org.apache.derby.impl.tools.sysinfo.ZipInfoProperties;
+import org.apache.derbyTesting.junit.SecurityManagerSetup;
 
 
 /**
@@ -347,10 +350,12 @@
 		if (serverCodeBase == null)
 			serverCodeBase = findCodeBase(isJar);
    
+        
 		if (serverCodeBase == null)
 		{
 			String ws = guessWSHome();
 			serverCodeBase = ws + DEFAULT_CODEBASE;
+                 
 		}
 		
 		File pf = new File(policyFile);
@@ -367,12 +372,19 @@
 		
 		D.addElement("java.security.manager");
 		D.addElement("java.security.policy=" + pf.getAbsolutePath());
+ 
+        Properties jusetup =
+            SecurityManagerSetup.getPolicyFilePropertiesForOldHarness();
+        // Take the definitions from the way JUnit tests
+        // set them up. This then supports the jar files being
+        // in different locations.
+        for (Enumeration p = jusetup.keys(); p.hasMoreElements(); )
+        {
+            String key = (String) p.nextElement();
+            D.addElement(key + "=" + jusetup.getProperty(key));
+        }
 		
-		String codebaseType = isJar[0] ? "derbyTesting.codejar" : "derbyTesting.codeclasses";
-		String unusedType = isJar[0] ? "derbyTesting.codeclasses" : "derbyTesting.codejar";
 
-		// URL of the codebase
-		D.addElement(codebaseType + "=" + cb.toURL());
 		// file path to the codebase
 		D.addElement("derbyTesting.codedir=" + cb.getAbsolutePath());
 		String hostName = (System.getProperty("hostName"));
@@ -381,10 +393,7 @@
 		D.addElement("derbyTesting.serverhost=" + hostName);
 		// in the case of testing with a remote host, this is irrelevant, 
 		// when testing 'normal' it is also localhost:
-		D.addElement("derbyTesting.clienthost=" + hostName);	 
-		
-		// add an invalid path to the unused type 
-		D.addElement(unusedType + "=file://unused/");
+		D.addElement("derbyTesting.clienthost=" + hostName);	 	
 		
 		return D;
 		

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/ibm14/testSecMec.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/ibm14/testSecMec.out?view=diff&rev=441540&r1=441539&r2=441540
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/ibm14/testSecMec.out (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/ibm14/testSecMec.out Fri Sep  8 08:35:32 2006
@@ -130,7 +130,7 @@
 T4: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee;securityMechanism=3
 T1: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat - EXCEPTION Connection authentication failure occurred.  Reason: security mechanism not supported.
 T2: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=max - EXCEPTION Connection authentication failure occurred.  Reason: security mechanism not supported.
-T3: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee - EXCEPTION Connection authentication failure occurred.  Reason: security mechanism not supported.
+T3: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee
 T5: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee;securityMechanism=9 - EXCEPTION Connection authentication failure occurred.  Reason: security mechanism not supported.
 T6: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;securityMechanism=4 - EXCEPTION Connection authentication failure occurred.  Reason: security mechanism not supported.
 T8: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee;securityMechanism=4 - EXCEPTION Connection authentication failure occurred.  Reason: security mechanism not supported.
@@ -142,8 +142,8 @@
 withConnectionPooling
 DERBY-1080  EXCEPTION ()  Connection authentication failure occurred.  Reason: security mechanism not supported.
 ******testAllCombinationsOfUserPasswordsSecMecInput***
-Test: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=calvin;password=hobbes - EXCEPTION Connection authentication failure occurred.  Reason: security mechanism not supported.
-TEST_DS(user=calvin;password=hobbes)EXCEPTION getDataSourceConnection()  Connection authentication failure occurred.  Reason: security mechanism not supported.
+Test: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=calvin;password=hobbes
+TEST_DS(user=calvin;password=hobbes) OK
 # jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=calvin;password=hobbes;securityMechanism=4 - EXCEPTION Connection authentication failure occurred.  Reason: security mechanism not supported.
 TEST_DS (user=calvin;password=hobbes,securityMechanism=4)EXCEPTION testSecurityMechanism()  Connection authentication failure occurred.  Reason: security mechanism not supported.
 # jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=calvin;password=hobbes;securityMechanism=3
@@ -162,8 +162,8 @@
 TEST_DS (user=calvin,securityMechanism=9)EXCEPTION testSecurityMechanism()  Password can not be null.
 # jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=calvin;securityMechanism=8 - EXCEPTION Password can not be null.
 TEST_DS (user=calvin,securityMechanism=8)EXCEPTION testSecurityMechanism()  Password can not be null.
-Test: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;password=hobbes - EXCEPTION Connection authentication failure occurred.  Reason: security mechanism not supported.
-TEST_DS(password=hobbes)EXCEPTION getDataSourceConnection()  Connection authentication failure occurred.  Reason: security mechanism not supported.
+Test: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;password=hobbes
+TEST_DS(password=hobbes) OK
 # jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;password=hobbes;securityMechanism=4 - EXCEPTION Connection authentication failure occurred.  Reason: security mechanism not supported.
 TEST_DS (password=hobbes,securityMechanism=4)EXCEPTION testSecurityMechanism()  Connection authentication failure occurred.  Reason: security mechanism not supported.
 # jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;password=hobbes;securityMechanism=3
@@ -188,7 +188,7 @@
 T4: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee;securityMechanism=3 - EXCEPTION Connection authentication failure occurred.  Reason: security mechanism not supported.
 T1: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat - EXCEPTION Connection authentication failure occurred.  Reason: security mechanism not supported.
 T2: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=max - EXCEPTION Connection authentication failure occurred.  Reason: security mechanism not supported.
-T3: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee
+T3: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee - EXCEPTION Connection authentication failure occurred.  Reason: security mechanism not supported.
 T5: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee;securityMechanism=9
 T6: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;securityMechanism=4 - EXCEPTION Connection authentication failure occurred.  Reason: security mechanism not supported.
 T8: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=neelima;password=lee;securityMechanism=4 - EXCEPTION Connection authentication failure occurred.  Reason: security mechanism not supported.
@@ -201,8 +201,8 @@
  query ok 
 OK
 ******testAllCombinationsOfUserPasswordsSecMecInput***
-Test: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=calvin;password=hobbes
-TEST_DS(user=calvin;password=hobbes) OK
+Test: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=calvin;password=hobbes - EXCEPTION Connection authentication failure occurred.  Reason: security mechanism not supported.
+TEST_DS(user=calvin;password=hobbes)EXCEPTION getDataSourceConnection()  Connection authentication failure occurred.  Reason: security mechanism not supported.
 # jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=calvin;password=hobbes;securityMechanism=4 - EXCEPTION Connection authentication failure occurred.  Reason: security mechanism not supported.
 TEST_DS (user=calvin;password=hobbes,securityMechanism=4)EXCEPTION testSecurityMechanism()  Connection authentication failure occurred.  Reason: security mechanism not supported.
 # jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=calvin;password=hobbes;securityMechanism=3 - EXCEPTION Connection authentication failure occurred.  Reason: security mechanism not supported.
@@ -221,8 +221,8 @@
 TEST_DS (user=calvin,securityMechanism=9)EXCEPTION testSecurityMechanism()  Password can not be null.
 # jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;user=calvin;securityMechanism=8 - EXCEPTION Password can not be null.
 TEST_DS (user=calvin,securityMechanism=8)EXCEPTION testSecurityMechanism()  Password can not be null.
-Test: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;password=hobbes
-TEST_DS(password=hobbes) OK
+Test: jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;password=hobbes - EXCEPTION Connection authentication failure occurred.  Reason: security mechanism not supported.
+TEST_DS(password=hobbes)EXCEPTION getDataSourceConnection()  Connection authentication failure occurred.  Reason: security mechanism not supported.
 # jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;password=hobbes;securityMechanism=4 - EXCEPTION Connection authentication failure occurred.  Reason: security mechanism not supported.
 TEST_DS (password=hobbes,securityMechanism=4)EXCEPTION testSecurityMechanism()  Connection authentication failure occurred.  Reason: security mechanism not supported.
 # jdbc:derby://xxxFILTERED_HOSTNAMExxx:xxxFILTEREDPORTxxx/wombat;password=hobbes;securityMechanism=3 - EXCEPTION Connection authentication failure occurred.  Reason: security mechanism not supported.

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/altertable.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/altertable.out?view=diff&rev=441540&r1=441539&r2=441540
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/altertable.out (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/altertable.out Fri Sep  8 08:35:32 2006
@@ -927,4 +927,35 @@
 0 rows inserted/updated/deleted
 ij> alter table atmcn_5 alter column b null;
 ERROR 42Z20: Column 'B' cannot be made nullable. It is part of a primary key or unique constraint, which cannot have any nullable columns.
+ij> -- tests for ALTER TABLE ALTER COLUMN DEFAULT
+create table atmod_1 (a integer, b varchar(10));
+0 rows inserted/updated/deleted
+ij> insert into atmod_1 values (1, 'one');
+1 row inserted/updated/deleted
+ij> alter table atmod_1 alter column a default -1;
+0 rows inserted/updated/deleted
+ij> insert into atmod_1 values (default, 'minus one');
+1 row inserted/updated/deleted
+ij> insert into atmod_1 (b) values ('b');
+1 row inserted/updated/deleted
+ij> select * from atmod_1;
+A          |B         
+----------------------
+1          |one       
+-1         |minus one 
+-1         |b         
+ij> alter table atmod_1 alter a default 42;
+0 rows inserted/updated/deleted
+ij> insert into atmod_1 values(3, 'three');
+1 row inserted/updated/deleted
+ij> insert into atmod_1 values (default, 'forty two');
+1 row inserted/updated/deleted
+ij> select * from atmod_1;
+A          |B         
+----------------------
+1          |one       
+-1         |minus one 
+-1         |b         
+3          |three     
+42         |forty two 
 ij> 

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/grantRevokeDDL.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/grantRevokeDDL.out?view=diff&rev=441540&r1=441539&r2=441540
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/grantRevokeDDL.out (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/grantRevokeDDL.out Fri Sep  8 08:35:32 2006
@@ -705,31 +705,30 @@
 ERROR: Failed with SQLSTATE 28508
 ij(MAMTA3)> -- connect as mamta2 and give select privilege on v22 to mamta3
 set connection mamta2;
-ij(MAMTA2)> grant select on v22 to mamta3;
-0 rows inserted/updated/deleted
+ij(MAMTA2)> -- should fail
+grant select on v22 to mamta3;
+ERROR: Failed with SQLSTATE 2850G
 ij(MAMTA2)> set connection mamta3;
-ij(MAMTA3)> -- mamta3 has the required privileges now, so following should work
+ij(MAMTA3)> -- should fail
 create view v31 as select * from mamta2.v22;
-0 rows inserted/updated/deleted
-ij(MAMTA3)> -- following will pass because mamta3 has direct access to v22 and public access to t11
+ERROR: Failed with SQLSTATE 28508
+ij(MAMTA3)> -- following will fail because mamta3 has no access to v22
 create view v32 as select v22.c111 as a, t11.c111 as b from mamta2.v22 v22, mamta1.t11 t11;
-0 rows inserted/updated/deleted
+ERROR: Failed with SQLSTATE 28508
 ij(MAMTA3)> -- following will still fail because mamta3 doesn't have access to mamta1.t12.c121
 create view v33 as select v22.c111 as a, t12.c121 as b from mamta2.v22 v22, mamta1.t12 t12;
 ERROR: Failed with SQLSTATE 28508
 ij(MAMTA3)> -- connect as mamta2 and give select privilege on v23 to mamta3
 set connection mamta2;
 ij(MAMTA2)> grant select on v23 to mamta3;
-0 rows inserted/updated/deleted
+ERROR: Failed with SQLSTATE 2850G
 ij(MAMTA2)> set connection mamta3;
-ij(MAMTA3)> -- although mamta3 doesn't have direct access to mamta1.t12, it can look at it through view mamta2.v23 since mamta3 has select privilege
--- on mamta2.v23
+ij(MAMTA3)> -- should fail
 create view v34 as select * from mamta2.v23;
-0 rows inserted/updated/deleted
-ij(MAMTA3)> -- following should work fine because mamta3 has access to all the
--- objects in it's schema
+ERROR: Failed with SQLSTATE 28508
+ij(MAMTA3)> -- should fail
 create view v35 as select * from v34;
-0 rows inserted/updated/deleted
+ERROR: Failed with SQLSTATE 42X05
 ij(MAMTA3)> -- Write some views based on a routine
 set connection mamta1;
 ij(MAMTA1)> drop function f_abs1;
@@ -974,21 +973,18 @@
 select * from mamta2.v21ViewTest;
 ERROR: Failed with SQLSTATE 28508
 ij(MAMTA3)> set connection mamta2;
-ij(MAMTA2)> -- give select privileges on the view to mamta3
+ij(MAMTA2)> -- give select privileges on the view to mamta3, should fail
 grant select on v21ViewTest to mamta3;
-0 rows inserted/updated/deleted
+ERROR: Failed with SQLSTATE 2850G
 ij(MAMTA2)> set connection mamta3;
-ij(MAMTA3)> -- select from mamta2.v21ViewTest will pass this time for mamta3 because mamta3 has select privilege on mamta2.v21ViewTest
+ij(MAMTA3)> -- select from mamta2.v21ViewTest will fail for mamta3 because mamta3 has no select privilege on mamta2.v21ViewTest
 select * from mamta2.v21ViewTest;
-C111       |C122
-----------------
-1          |1   
-2          |1   
-2 rows selected
+ERROR: Failed with SQLSTATE 28508
 ij(MAMTA3)> set connection satConnection;
 ij(SATCONNECTION)> -- have the dba take away select privilege on mamta2.v21ViewTest from mamta3
 revoke select on mamta2.v21ViewTest from mamta3;
 0 rows inserted/updated/deleted
+WARNING 01006: Privilege not revoked from MAMTA3.
 ij(SATCONNECTION)> set connection mamta3;
 ij(MAMTA3)> -- select from mamta2.v21ViewTest will fail this time for mamta3 because dba took away the select privilege on mamta2.v21ViewTest
 select * from mamta2.v21ViewTest;
@@ -1198,8 +1194,9 @@
 ij(MAMTA1)> set connection mamta2;
 ij(MAMTA2)> create view v21ViewTest as select * from mamta1.t11TriggerTest;
 0 rows inserted/updated/deleted
-ij(MAMTA2)> grant select on v21ViewTest to mamta3;
-0 rows inserted/updated/deleted
+ij(MAMTA2)> -- should fail
+grant select on v21ViewTest to mamta3;
+ERROR: Failed with SQLSTATE 2850G
 ij(MAMTA2)> select * from v21ViewTest;
 C111       |C112       
 -----------------------
@@ -1215,10 +1212,10 @@
 ERROR: Failed with SQLSTATE 42Y55
 ij(MAMTA3)> create table t32TriggerTest (c321 int);
 0 rows inserted/updated/deleted
-ij(MAMTA3)> -- following should pass because all the privileges are in place
+ij(MAMTA3)> -- following should fail because not all the privileges are in place
 create trigger tr31t31TriggerTest after insert on t31TriggerTest for each statement mode db2sql
 	insert into t32TriggerTest values (select c111 from mamta2.v21ViewTest where c112=1);
-0 rows inserted/updated/deleted
+ERROR: Failed with SQLSTATE 28508
 ij(MAMTA3)> insert into t31TriggerTest values(1);
 1 row inserted/updated/deleted
 ij(MAMTA3)> select * from t31TriggerTest;
@@ -1229,8 +1226,7 @@
 ij(MAMTA3)> select * from t32TriggerTest;
 C321       
 -----------
-1          
-1 row selected
+0 rows selected
 ij(MAMTA3)> set connection mamta1;
 ij(MAMTA1)> -- This will drop the dependent view 
 revoke select on t11TriggerTest from mamta2;
@@ -1245,17 +1241,17 @@
 --  After DERBY-1613 is fixed, we should consistently get error from insert below because the
 --  insert trigger can't find the view it uses.
 insert into t31TriggerTest values(1);
-ERROR: Failed with SQLSTATE 42X05
+1 row inserted/updated/deleted
 ij(MAMTA3)> select * from t31TriggerTest;
 C311       
 -----------
 1          
-1 row selected
+1          
+2 rows selected
 ij(MAMTA3)> select * from t32TriggerTest;
 C321       
 -----------
-1          
-1 row selected
+0 rows selected
 ij(MAMTA3)> -- cleanup
 set connection mamta3;
 ij(MAMTA3)> drop table t31TriggerTest;
@@ -1458,40 +1454,31 @@
 1          |1   
 2          |1   
 2 rows selected
-ij(MAMTA2)> -- grant permission to mamta3 so mamta3 can create a view based on v21ViewTest
+ij(MAMTA2)> -- grant permission to mamta3, should fail
 grant select on v21ViewTest to mamta3;
-0 rows inserted/updated/deleted
+ERROR: Failed with SQLSTATE 2850G
 ij(MAMTA2)> set connection mamta3;
 ij(MAMTA3)> create view v31ViewTest as select * from mamta2.v21ViewTest;
-0 rows inserted/updated/deleted
+ERROR: Failed with SQLSTATE 28508
 ij(MAMTA3)> select * from v31ViewTest;
-C111       |C122
-----------------
-1          |1   
-2          |1   
-2 rows selected
+ERROR: Failed with SQLSTATE 42X05
 ij(MAMTA3)> set connection mamta1;
-ij(MAMTA1)> -- can't revoke the privilege because the view that relies on this privilege has another view defined on it and since Derby does not
---   support cascade view drop, we can't automatically drop view relying on the privilege below
+ij(MAMTA1)> -- revoke the privilege from mamta2, should be ok, previous view is not created. 
 revoke select on t11ViewTest from mamta2;
-ERROR: Failed with SQLSTATE X0Y23
+0 rows inserted/updated/deleted
 ij(MAMTA1)> set connection mamta2;
-ij(MAMTA2)> -- view is still around, it couldn't be dropped automatically as a result of the revoke because there is another view dependent on the
---   view below. Need to drop that dependent view first in order for revoke to drop following view automatically 
+ij(MAMTA2)> -- this view is not created, should fail
 select * from v21ViewTest;
-C111       |C122
-----------------
-1          |1   
-2          |1   
-2 rows selected
+ERROR: Failed with SQLSTATE 42X05
 ij(MAMTA2)> set connection mamta3;
 ij(MAMTA3)> -- drop the dependent view
 drop view v31ViewTest;
-0 rows inserted/updated/deleted
+ERROR: Failed with SQLSTATE X0X05
 ij(MAMTA3)> set connection mamta1;
 ij(MAMTA1)> -- revoke privilege will succeed this time and will drop the dependent view on that privilege
 revoke select on t11ViewTest from mamta2;
 0 rows inserted/updated/deleted
+WARNING 01006: Privilege not revoked from MAMTA2.
 ij(MAMTA1)> set connection mamta2;
 ij(MAMTA2)> -- view doesn't exist anymore
 select * from v21ViewTest;
@@ -2218,26 +2205,20 @@
 1          
 1 row selected
 ij(MAMTA3)> grant select on v21ViewTest to mamta2;
-0 rows inserted/updated/deleted
+ERROR: Failed with SQLSTATE 2850G
 ij(MAMTA3)> set connection mamta2;
 ij(MAMTA2)> -- Although mamta2 has SELECT privileges on mamta3.v21ViewTest, mamta2 doesn't have
 --    SELECT privileges on table mamta1.t12RoutineTest accessed by the routine
 --    (which is underneath the view) and hence select from view will fail
 select * from mamta3.v21ViewTest;
-C211       
------------
-ERROR: Failed with SQLSTATE 38000
 ERROR: Failed with SQLSTATE 28508
 ij(MAMTA2)> set connection mamta1;
 ij(MAMTA1)> grant select  on t12RoutineTest to mamta2;
 0 rows inserted/updated/deleted
 ij(MAMTA1)> set connection mamta2;
-ij(MAMTA2)> -- now the view select will succeed
+ij(MAMTA2)> -- should fail
 select * from mamta3.v21ViewTest;
-C211       
------------
-1          
-1 row selected
+ERROR: Failed with SQLSTATE 28508
 ij(MAMTA2)> -- In this test, the trigger is accessing a view. Any user that has insert privilege
 --  on trigger table will be able to make an insert even if that user doesn't have
 --  privileges on objects referenced by the trigger.
@@ -2258,7 +2239,7 @@
 ij(MAMTA2)> create view v21ViewTest as select * from mamta1.t11TriggerTest;
 0 rows inserted/updated/deleted
 ij(MAMTA2)> grant select on v21ViewTest to mamta4;
-0 rows inserted/updated/deleted
+ERROR: Failed with SQLSTATE 2850G
 ij(MAMTA2)> set connection mamta3;
 ij(MAMTA3)> drop table t31TriggerTest;
 ERROR: Failed with SQLSTATE 42Y55
@@ -2275,7 +2256,7 @@
 ERROR: Failed with SQLSTATE 42X94
 ij(MAMTA4)> create trigger tr41t41 after insert on t41TriggerTest for each statement mode db2sql
         insert into mamta3.t31TriggerTest (select * from mamta2.v21ViewTest);
-0 rows inserted/updated/deleted
+ERROR: Failed with SQLSTATE 28508
 ij(MAMTA4)> insert into t41TriggerTest values(1);
 1 row inserted/updated/deleted
 ij(MAMTA4)> insert into t41TriggerTest values(2);
@@ -2304,11 +2285,7 @@
 ij(MAMTA3)> select * from t31TriggerTest;
 C311       
 -----------
-1          
-2          
-1          
-2          
-4 rows selected
+0 rows selected
 ij(MAMTA3)> -- will fail because no permissions on mamta4.t41TriggerTest
 insert into mamta4.t41TriggerTest values(1);
 ERROR: Failed with SQLSTATE 28506
@@ -2935,6 +2912,34 @@
 ij(USER2)> lock table user1.t100 in share mode;
 ERROR: Failed with SQLSTATE 28506
 ij(USER2)> commit;
+ij(USER2)> autocommit on;
+ij(USER2)> -- DERBY-1686
+set connection user1;
+ij(USER1)> create table t1 (i int);
+0 rows inserted/updated/deleted
+ij(USER1)> insert into t1 values 1,2,3;
+3 rows inserted/updated/deleted
+ij(USER1)> grant select on t1 to user2;
+0 rows inserted/updated/deleted
+ij(USER1)> set connection user2;
+ij(USER2)> create view v1 as select * from user1.t1;
+0 rows inserted/updated/deleted
+ij(USER2)> -- attempt to grant this view to others, should fail since user2
+-- does not have grant privilege on object user1.t1
+grant select on user1.t1 to user3;
+ERROR: Failed with SQLSTATE 2850C
+ij(USER2)> -- expect error
+grant select on v1 to user3;
+ERROR: Failed with SQLSTATE 2850G
+ij(USER2)> -- cleanup
+set connection user2;
+ij(USER2)> drop view v1;
+0 rows inserted/updated/deleted
+ij(USER2)> set connection user1;
+ij(USER1)> drop table t1;
+0 rows inserted/updated/deleted
+ij(USER1)> autocommit on;
+ij(USER1)> set connection user2;
 ij(USER2)> autocommit on;
 ij(USER2)> -- Simple test case for DERBY-1583: column privilege checking should not
 -- assume column descriptors have non-null table references.



Mime
View raw message