db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1199096 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SynonymTest.java
Date Tue, 08 Nov 2011 03:45:26 GMT
Author: mamta
Date: Tue Nov  8 03:45:25 2011
New Revision: 1199096

URL: http://svn.apache.org/viewvc?rev=1199096&view=rev
Log:
DERBY-5244 DatabaseMetaData.getColumns(null, null, tableName, null) does not return the columns
meta for a SYNONYM

Adding a test case which confirms the behavior noticed by DERBY-5244.


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

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SynonymTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SynonymTest.java?rev=1199096&r1=1199095&r2=1199096&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SynonymTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SynonymTest.java
Tue Nov  8 03:45:25 2011
@@ -20,8 +20,10 @@
  */
 package org.apache.derbyTesting.functionTests.tests.lang;
 
+import java.sql.DatabaseMetaData;
 import java.sql.SQLException;
 import java.sql.Statement;
+import java.sql.ResultSet;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
@@ -72,6 +74,36 @@ public class SynonymTest extends BaseJDB
     }
 
     /**
+     * DERBY-5244 DatabaseMetaData.getColumns(null, null, tableName, null) 
+     * 	does not return the columns meta for a SYNONYM
+     * 
+     * Test DatabaseMetaData.getColumns call on synonyms
+     *
+     * This test confirms the behavior noticed in DERBY-5244.
+     */
+    public void testMetaDataCallOnSynonymsDERBY5244()
+        throws SQLException
+    {
+            Statement st = createStatement();
+            st.executeUpdate("create table t1Derby5422 "+
+            		"( c11 int not null, c12 char(2) )");
+            //Create a synonym on table t1Derby5422
+            st.executeUpdate("create synonym s1Derby5422 for t1Derby5422");
+            
+            //Verify that the synonym has been created successfully by
+            // doing a select from it
+            ResultSet rs = st.executeQuery("select * from S1DERBY5422");
+            JDBC.assertEmpty(rs);
+            DatabaseMetaData dbmd = getConnection().getMetaData();
+            //Derby can find metadata info for the base table
+            rs = dbmd.getColumns(null, null, "T1DERBY5422", null);
+            JDBC.assertDrainResultsHasData(rs);
+            //But Derby does not locate the metadata info for synonym
+            rs = dbmd.getColumns(null, null, "S1DERBY5422", null);
+            JDBC.assertEmpty(rs);
+    }
+
+    /**
      * Test that synonyms are dereferenced properly for a searched DELETE.
      *
      * This test verifies that DERBY-4110 is fixed.



Mime
View raw message