db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r580068 - in /db/derby/code/branches/10.1/java: engine/org/apache/derby/impl/sql/compile/DropViewNode.java testing/org/apache/derbyTesting/functionTests/master/views.out testing/org/apache/derbyTesting/functionTests/tests/lang/views.sql
Date Thu, 27 Sep 2007 15:42:28 GMT
Author: kmarsden
Date: Thu Sep 27 08:42:27 2007
New Revision: 580068

URL: http://svn.apache.org/viewvc?rev=580068&view=rev
Log:
DERBY-1304 DROP view does not always completely remove view

port from trunk


Modified:
    db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/DropViewNode.java
    db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/views.out
    db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/lang/views.sql

Modified: db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/DropViewNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/DropViewNode.java?rev=580068&r1=580067&r2=580068&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/DropViewNode.java
(original)
+++ db/derby/code/branches/10.1/java/engine/org/apache/derby/impl/sql/compile/DropViewNode.java
Thu Sep 27 08:42:27 2007
@@ -29,8 +29,10 @@
 import org.apache.derby.iapi.sql.ResultSet;
 
 import org.apache.derby.iapi.error.StandardException;
-
+import org.apache.derby.iapi.sql.compile.CompilerContext;
+import org.apache.derby.iapi.sql.dictionary.DataDictionary;
 import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;
+import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
 
 import org.apache.derby.iapi.services.sanity.SanityManager;
 
@@ -62,6 +64,36 @@
 		return "DROP VIEW";
 	}
 
+ 	/**
+ 	 *  Bind the drop view node
+ 	 *
+ 	 * @return	The bound query tree
+ 	 *
+ 	 * @exception StandardException		Thrown on error
+ 	 */
+	
+	public QueryTreeNode bind() throws StandardException
+	{
+		DataDictionary dd = getDataDictionary();
+		CompilerContext cc = getCompilerContext();
+				
+		TableDescriptor td = dd.getTableDescriptor(getRelativeName(), 
+					getSchemaDescriptor());
+	
+		/* 
+		 * Statement is dependent on the TableDescriptor 
+		 * If td is null, let execution throw the error like
+		 * it is before.
+		 */
+		if (td != null)
+		{
+			cc.createDependency(td);
+		}
+			
+		return this;
+	}
+		
+	
 	// inherit generate() method from DDLStatementNode
 
 

Modified: db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/views.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/views.out?rev=580068&r1=580067&r2=580068&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/views.out
(original)
+++ db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/views.out
Thu Sep 27 08:42:27 2007
@@ -334,4 +334,32 @@
 0 rows inserted/updated/deleted
 ij> -- reset autocommit
 autocommit on;
+ij> -- DERBY-1304
+-- view not getting dropped 
+-- The second drop view statement fails before the patch
+CREATE SCHEMA TEST_SCHEMA;
+0 rows inserted/updated/deleted
+ij> CREATE TABLE TEST_SCHEMA.T1 (TABLE_COLUMN LONG VARCHAR);
+0 rows inserted/updated/deleted
+ij> CREATE VIEW TEST_SCHEMA.V1 AS SELECT TABLE_COLUMN AS VIEW_COLUMN FROM TEST_SCHEMA.T1;
+0 rows inserted/updated/deleted
+ij> DROP VIEW TEST_SCHEMA.V1;
+0 rows inserted/updated/deleted
+ij> DROP TABLE TEST_SCHEMA.T1;
+0 rows inserted/updated/deleted
+ij> DROP SCHEMA TEST_SCHEMA RESTRICT;
+0 rows inserted/updated/deleted
+ij> -- reiterate
+CREATE SCHEMA TEST_SCHEMA;
+0 rows inserted/updated/deleted
+ij> CREATE TABLE TEST_SCHEMA.T1 (TABLE_COLUMN LONG VARCHAR);
+0 rows inserted/updated/deleted
+ij> CREATE VIEW TEST_SCHEMA.V1 AS SELECT TABLE_COLUMN AS VIEW_COLUMN FROM TEST_SCHEMA.T1;
+0 rows inserted/updated/deleted
+ij> DROP VIEW TEST_SCHEMA.V1;
+0 rows inserted/updated/deleted
+ij> DROP TABLE TEST_SCHEMA.T1;
+0 rows inserted/updated/deleted
+ij> DROP SCHEMA TEST_SCHEMA RESTRICT;
+0 rows inserted/updated/deleted
 ij> 

Modified: db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/lang/views.sql
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/lang/views.sql?rev=580068&r1=580067&r2=580068&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/lang/views.sql
(original)
+++ db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/lang/views.sql
Thu Sep 27 08:42:27 2007
@@ -163,3 +163,23 @@
 
 -- reset autocommit
 autocommit on;
+
+-- DERBY-1304
+-- view not getting dropped 
+-- The second drop view statement fails before the patch
+CREATE SCHEMA TEST_SCHEMA;
+CREATE TABLE TEST_SCHEMA.T1 (TABLE_COLUMN LONG VARCHAR);
+CREATE VIEW TEST_SCHEMA.V1 AS SELECT TABLE_COLUMN AS VIEW_COLUMN FROM TEST_SCHEMA.T1;
+
+DROP VIEW TEST_SCHEMA.V1;
+DROP TABLE TEST_SCHEMA.T1;
+DROP SCHEMA TEST_SCHEMA RESTRICT;
+
+-- reiterate
+CREATE SCHEMA TEST_SCHEMA;
+CREATE TABLE TEST_SCHEMA.T1 (TABLE_COLUMN LONG VARCHAR);
+CREATE VIEW TEST_SCHEMA.V1 AS SELECT TABLE_COLUMN AS VIEW_COLUMN FROM TEST_SCHEMA.T1;
+
+DROP VIEW TEST_SCHEMA.V1; 
+DROP TABLE TEST_SCHEMA.T1;
+DROP SCHEMA TEST_SCHEMA RESTRICT; 



Mime
View raw message