db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r439845 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java
Date Sun, 03 Sep 2006 21:09:19 GMT
Author: djd
Date: Sun Sep  3 14:09:19 2006
New Revision: 439845

URL: http://svn.apache.org/viewvc?view=rev&rev=439845
Log:
Improve JDBC.dropSchema to include dropping synoyms based upon JDBC metadata. Includes a workaround
for DERBY-1790.

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

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java?view=diff&rev=439845&r1=439844&r2=439845
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java Sun Sep  3 14:09:19
2006
@@ -154,7 +154,6 @@
 	 * way until everything can be dropped.
 	 * 
 	 * TODO: Drop Functions
-	 * TODO: Drop Synonyms
 	 * 
 	 * @param dmd DatabaseMetaData object for database
 	 * @param schema Name of the schema
@@ -182,7 +181,14 @@
 				new String[] {"TABLE"});
 		
 		dropUsingDMD(s, rs, schema, "TABLE_NAME", "TABLE");
-		
+
+        // Synonyms - need work around for DERBY-1790 where
+        // passing a table type of SYNONYM fails.
+        rs = dmd.getTables((String) null, schema, (String) null,
+                new String[] {"AA_DERBY-1790-SYNONYM"});
+        
+        dropUsingDMD(s, rs, schema, "TABLE_NAME", "SYNONYM");
+        
 		// Finally drop the schema if it is not APP
 		if (!schema.equals("APP")) {
 			s.execute("DROP SCHEMA " + JDBC.escape(schema) + " RESTRICT");
@@ -217,8 +223,8 @@
 		int batchCount = 0;
 		while (rs.next())
 		{
-			String view = rs.getString(mdColumn);
-			s.addBatch(dropLeadIn + JDBC.escape(schema, view));
+            String objectName = rs.getString(mdColumn);
+			s.addBatch(dropLeadIn + JDBC.escape(schema, objectName));
 			batchCount++;
 		}
 		rs.close();



Mime
View raw message