You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by rh...@apache.org on 2006/08/25 22:02:11 UTC

svn commit: r436921 [5/5] - in /db/derby/code/branches/10.2: ./ java/engine/org/apache/derby/iapi/sql/depend/ java/engine/org/apache/derby/iapi/sql/dictionary/ java/engine/org/apache/derby/iapi/sql/execute/ java/engine/org/apache/derby/impl/sql/catalog...

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BLOBTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BLOBTest.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BLOBTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BLOBTest.java Fri Aug 25 13:02:02 2006
@@ -332,7 +332,7 @@
                                                     final int newSize) 
         throws SQLException, IOException
     {
-        final PreparedStatement preparedStatement = getXConnection().prepareStatement
+        final PreparedStatement preparedStatement = getConnection().prepareStatement
             ("UPDATE " + BLOBDataModelSetup.getBlobTableName() +
              " SET val=?, length = ?, data = ? WHERE CURRENT OF " +
              rs.getCursorName());
@@ -439,6 +439,6 @@
         throws Exception
     {
         println("Setup of: " + getName());
-        getXConnection().setAutoCommit(false);
+        getConnection().setAutoCommit(false);
     }
 }

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ConcurrencyTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ConcurrencyTest.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ConcurrencyTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ConcurrencyTest.java Fri Aug 25 13:02:02 2006
@@ -45,7 +45,7 @@
         // For the concurrency tests, we recreate the model
         // for each testcase (since we do commits)
         SURDataModelSetup.createDataModel
-            (SURDataModelSetup.SURDataModel.MODEL_WITH_PK, getXConnection());
+            (SURDataModelSetup.SURDataModel.MODEL_WITH_PK, getConnection());
         commit();
     }
     
@@ -79,7 +79,7 @@
         while (rs.next());
         
         // Now open up a connection
-        Connection con2 = getNewConnection();
+        Connection con2 = openDefaultConnection();
         Statement s2 = con2.createStatement(ResultSet.TYPE_FORWARD_ONLY, 
                                             ResultSet.CONCUR_UPDATABLE);
         
@@ -116,7 +116,7 @@
         while (rs.next());
         
         // Now open up a connection
-        Connection con2 = getNewConnection();
+        Connection con2 = openDefaultConnection();
         Statement s2 = con2.createStatement(ResultSet.TYPE_FORWARD_ONLY, 
                                             ResultSet.CONCUR_UPDATABLE);
         
@@ -143,7 +143,7 @@
                                           ResultSet.CONCUR_READ_ONLY);
         final ResultSet rs = s.executeQuery("select * from t1");
         scrollForward(rs);
-        Connection con2 = getNewConnection();
+        Connection con2 = openDefaultConnection();
         Statement s2 = con2.createStatement(ResultSet.TYPE_FORWARD_ONLY, 
                                             ResultSet.CONCUR_READ_ONLY);
         try {
@@ -168,7 +168,7 @@
         Statement s = createStatement();
         ResultSet rs = s.executeQuery("select * from t1");
         scrollForward(rs);
-        Connection con2 = getNewConnection();
+        Connection con2 = openDefaultConnection();
         Statement s2 = con2.createStatement();
         try {
             final ResultSet rs2 = s2.executeQuery("select * from t1");
@@ -192,7 +192,7 @@
         
         ResultSet rs = s.executeQuery("select * from t1");
         scrollForward(rs);
-        Connection con2 = getNewConnection();
+        Connection con2 = openDefaultConnection();
         Statement s2 = con2.createStatement(ResultSet.TYPE_FORWARD_ONLY, 
                                             ResultSet.CONCUR_READ_ONLY);
         try {
@@ -218,7 +218,7 @@
                                           ResultSet.CONCUR_UPDATABLE);
         ResultSet rs = s.executeQuery("select * from t1 for update");
         scrollForward(rs);
-        Connection con2 = getNewConnection();
+        Connection con2 = openDefaultConnection();
         Statement s2 = con2.createStatement(ResultSet.TYPE_FORWARD_ONLY, 
                                             ResultSet.CONCUR_READ_ONLY);
         try {
@@ -241,7 +241,7 @@
     public void testUpdatePurgedTuple1()
         throws SQLException
     {
-        getXConnection().setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
+        getConnection().setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
         Statement s = createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, 
                                           ResultSet.CONCUR_UPDATABLE);
         ResultSet rs = s.executeQuery("select * from t1");
@@ -258,7 +258,7 @@
                     rs.getInt(3) + ")");
         }
         
-        Connection con2 = getNewConnection();
+        Connection con2 = openDefaultConnection();
         con2.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
         try {
             PreparedStatement ps2 = con2.prepareStatement
@@ -325,7 +325,7 @@
     public void testUpdatePurgedTuple2()
         throws SQLException 
     {
-        getXConnection().setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
+        getConnection().setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
         Statement s = createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, 
                                           ResultSet.CONCUR_UPDATABLE);
         ResultSet rs = s.executeQuery("select * from t1");
@@ -338,7 +338,7 @@
         println("T1: Read next Tuple:(" + rs.getInt(1) + "," +
                 rs.getInt(2) + "," +
                 rs.getInt(3) + ")");
-        Connection con2 = getNewConnection();
+        Connection con2 = openDefaultConnection();
         con2.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
         try {
             PreparedStatement ps2 = con2.prepareStatement
@@ -384,7 +384,7 @@
     public void testUpdatePurgedTuple3()
         throws SQLException 
     {
-        getXConnection().setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
+        getConnection().setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
         Statement s = createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, 
                                           ResultSet.CONCUR_UPDATABLE);
         ResultSet rs = s.executeQuery("select * from t1");
@@ -393,7 +393,7 @@
         println("T1: read tuple with key " + firstKey);
         rs.next(); // Go to next
         println("T1: read next tuple");
-        Connection con2 = getNewConnection();
+        Connection con2 = openDefaultConnection();
         con2.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
         try {
             PreparedStatement ps2 = con2.prepareStatement
@@ -459,7 +459,7 @@
     public void testUpdatePurgedTuple4()
         throws SQLException 
     {
-        getXConnection().setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
+        getConnection().setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
         Statement s = createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, 
                                           ResultSet.CONCUR_UPDATABLE);
         ResultSet rs = s.executeQuery("select * from t1");
@@ -476,7 +476,7 @@
         println("T1: Read next Tuple:(" + rs.getInt(1) + "," +
                 rs.getInt(2) + "," +
                 rs.getInt(3) + ")");
-        Connection con2 = getNewConnection();
+        Connection con2 = openDefaultConnection();
         con2.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
         try {
             PreparedStatement ps2 = con2.prepareStatement
@@ -544,7 +544,7 @@
     public void testUpdateModifiedTuple1()
         throws SQLException 
     {
-        getXConnection().setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
+        getConnection().setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
         Statement s = createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, 
                                           ResultSet.CONCUR_UPDATABLE);
         ResultSet rs = s.executeQuery("select * from t1");
@@ -557,7 +557,7 @@
         println("T1: Read next Tuple:(" + rs.getInt(1) + "," +
                 rs.getInt(2) + "," +
                 rs.getInt(3) + ")");
-        Connection con2 = getNewConnection();
+        Connection con2 = openDefaultConnection();
         con2.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
         try {
             PreparedStatement ps2 = con2.prepareStatement
@@ -598,7 +598,7 @@
     public void testUpdateModifiedTuple2()
         throws SQLException 
     {
-        getXConnection().setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
+        getConnection().setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
         Statement s = createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, 
                                           ResultSet.CONCUR_UPDATABLE);
         ResultSet rs = s.executeQuery("select * from t1");
@@ -611,7 +611,7 @@
         println("T1: Read next Tuple:(" + rs.getInt(1) + "," +
                 rs.getInt(2) + "," +
                 rs.getInt(3) + ")");
-        Connection con2 = getNewConnection();
+        Connection con2 = openDefaultConnection();
         con2.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
         try {
             PreparedStatement ps2 = con2.prepareStatement
@@ -653,7 +653,7 @@
     public void testTableIntentLock1()
         throws SQLException 
     {
-        getXConnection().setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
+        getConnection().setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
         Statement s = createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, 
                                           ResultSet.CONCUR_UPDATABLE);
         println("T1: select * from t1");
@@ -665,7 +665,7 @@
         } // Now the cursor does not point to any tuples
         
         // Compressing the table in another transaction:
-        Connection con2 = getNewConnection();
+        Connection con2 = openDefaultConnection();
         try {
             con2.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
             PreparedStatement ps2 = con2.prepareStatement
@@ -694,7 +694,7 @@
     public void testUpdateLockInReadUncommitted()
         throws SQLException 
     {
-        getXConnection().setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
+        getConnection().setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
         Statement s = createStatement(ResultSet.TYPE_FORWARD_ONLY, 
                                           ResultSet.CONCUR_UPDATABLE);
         ResultSet rs = s.executeQuery("select * from t1");
@@ -703,7 +703,7 @@
         println("T1: Read next Tuple:(" + rs.getInt(1) + "," +
                 rs.getInt(2) + "," +
                 rs.getInt(3) + ")");
-        Connection con2 = getNewConnection();
+        Connection con2 = openDefaultConnection();
         con2.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
         try {
             PreparedStatement ps2 = con2.prepareStatement
@@ -749,7 +749,7 @@
                                         boolean testTruncate)
         throws SQLException 
     {
-        getXConnection().setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
+        getConnection().setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
         Statement delStatement = createStatement();
         // First delete all records except the last and first
         int deleted = delStatement.executeUpdate
@@ -777,7 +777,7 @@
                     rs.getInt(3) + ")");
         }
         
-        final Connection con2 = getNewConnection();
+        final Connection con2 = openDefaultConnection();
         con2.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
         final PreparedStatement ps2 = con2.prepareStatement
             ("call SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE(?,?,?,?,?)");

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/HoldabilityTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/HoldabilityTest.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/HoldabilityTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/HoldabilityTest.java Fri Aug 25 13:02:02 2006
@@ -58,7 +58,7 @@
         // We also use more records to ensure that the disk
         // is being used.
         SURDataModelSetup.createDataModel
-            (SURDataModelSetup.SURDataModel.MODEL_WITH_PK, getXConnection(),
+            (SURDataModelSetup.SURDataModel.MODEL_WITH_PK, getConnection(),
              recordCount);
         commit();
     }
@@ -613,7 +613,7 @@
         throws SQLException
     {
                // Use a new connection to compress the table        
-        final Connection con2 = getNewConnection();
+        final Connection con2 = openDefaultConnection();
         final String connId = con2.toString();
         con2.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
         

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java Fri Aug 25 13:02:02 2006
@@ -109,7 +109,7 @@
     public void xtestExecuteUpdateWithNoDynamicResultSets()
         throws SQLException
     {
-        Statement stmt = getXConnection().createStatement();
+        Statement stmt = getConnection().createStatement();
         int count = stmt.executeUpdate("CALL RETRIEVE_DYNAMIC_RESULTS(0)");
         assertEquals("Wrong update count.", 0, count);
         stmt.close();
@@ -140,7 +140,7 @@
         throws SQLException
     {
         PreparedStatement ps =
-            getXConnection().prepareStatement("CALL RETRIEVE_DYNAMIC_RESULTS(?)");
+            getConnection().prepareStatement("CALL RETRIEVE_DYNAMIC_RESULTS(?)");
         ps.setInt(1, 0);
         try {
             ps.executeQuery();
@@ -161,7 +161,7 @@
         throws SQLException
     {
         PreparedStatement ps =
-            getXConnection().prepareStatement("CALL RETRIEVE_DYNAMIC_RESULTS(?)");
+            getConnection().prepareStatement("CALL RETRIEVE_DYNAMIC_RESULTS(?)");
         ps.setInt(1, 1);
         ResultSet rs = ps.executeQuery();
         assertNotNull("executeQuery() returned null.", rs);
@@ -179,7 +179,7 @@
         throws SQLException
     {
         PreparedStatement ps =
-            getXConnection().prepareStatement("CALL RETRIEVE_DYNAMIC_RESULTS(?)");
+            getConnection().prepareStatement("CALL RETRIEVE_DYNAMIC_RESULTS(?)");
         ps.setInt(1, 2);
         try {
             ps.executeQuery();
@@ -202,7 +202,7 @@
         throws SQLException
     {
         PreparedStatement ps =
-            getXConnection().prepareStatement("CALL RETRIEVE_DYNAMIC_RESULTS(?)");
+            getConnection().prepareStatement("CALL RETRIEVE_DYNAMIC_RESULTS(?)");
         ps.setInt(1, 0);
         int count = ps.executeUpdate();
         assertEquals("Wrong update count.", 0, count);
@@ -224,7 +224,7 @@
         throws SQLException
     {
         PreparedStatement ps =
-            getXConnection().prepareStatement("CALL RETRIEVE_DYNAMIC_RESULTS(?)");
+            getConnection().prepareStatement("CALL RETRIEVE_DYNAMIC_RESULTS(?)");
         ps.setInt(1, 1);
         try {
             ps.executeUpdate();
@@ -244,7 +244,7 @@
         throws SQLException
     {
         CallableStatement cs =
-            getXConnection().prepareCall("CALL RETRIEVE_DYNAMIC_RESULTS(?)");
+            getConnection().prepareCall("CALL RETRIEVE_DYNAMIC_RESULTS(?)");
         cs.setInt(1, 0);
         try {
             cs.executeQuery();
@@ -264,7 +264,7 @@
         throws SQLException
     {
         CallableStatement cs =
-            getXConnection().prepareCall("CALL RETRIEVE_DYNAMIC_RESULTS(?)");
+            getConnection().prepareCall("CALL RETRIEVE_DYNAMIC_RESULTS(?)");
         cs.setInt(1, 1);
         ResultSet rs = cs.executeQuery();
         assertNotNull("executeQuery() returned null.", rs);
@@ -282,7 +282,7 @@
         throws SQLException
     {
         CallableStatement cs =
-            getXConnection().prepareCall("CALL RETRIEVE_DYNAMIC_RESULTS(?)");
+            getConnection().prepareCall("CALL RETRIEVE_DYNAMIC_RESULTS(?)");
         cs.setInt(1, 2);
         try {
             cs.executeQuery();
@@ -304,7 +304,7 @@
         throws SQLException
     {
         CallableStatement cs =
-            getXConnection().prepareCall("CALL RETRIEVE_DYNAMIC_RESULTS(?)");
+            getConnection().prepareCall("CALL RETRIEVE_DYNAMIC_RESULTS(?)");
         cs.setInt(1, 0);
         int count = cs.executeUpdate();
         assertEquals("Wrong update count.", 0, count);
@@ -320,7 +320,7 @@
         throws SQLException
     {
         CallableStatement cs =
-            getXConnection().prepareCall("CALL RETRIEVE_DYNAMIC_RESULTS(?)");
+            getConnection().prepareCall("CALL RETRIEVE_DYNAMIC_RESULTS(?)");
         cs.setInt(1, 1);
         try {
             cs.executeUpdate();
@@ -381,7 +381,7 @@
     public void xtestRollbackStoredProcWhenExecuteQueryReturnsNothing()
         throws SQLException
     {
-        Connection conn = getXConnection();
+        Connection conn = getConnection();
         conn.setAutoCommit(true);
         Statement stmt = conn.createStatement();
         try {
@@ -410,7 +410,7 @@
     public void xtestRollbackStoredProcWhenExecuteQueryReturnsTooMuch()
         throws SQLException
     {
-        Connection conn = getXConnection();
+        Connection conn = getConnection();
         conn.setAutoCommit(true);
         Statement stmt = conn.createStatement();
         try {
@@ -438,7 +438,7 @@
     public void xtestRollbackStoredProcWhenExecuteUpdateReturnsResults()
         throws SQLException
     {
-        Connection conn = getXConnection();
+        Connection conn = getConnection();
         conn.setAutoCommit(true);
         Statement stmt = conn.createStatement();
         try {
@@ -466,7 +466,7 @@
     public void xtestRollbackStoredProcWhenExecuteQueryReturnsNothing_prepared()
         throws SQLException
     {
-        Connection conn = getXConnection();
+        Connection conn = getConnection();
         conn.setAutoCommit(true);
         PreparedStatement ps =
             conn.prepareStatement("CALL PROC_WITH_SIDE_EFFECTS(?)");
@@ -499,7 +499,7 @@
     public void xtestRollbackStoredProcWhenExecuteQueryReturnsTooMuch_prepared()
         throws SQLException
     {
-        Connection conn = getXConnection();
+        Connection conn = getConnection();
         conn.setAutoCommit(true);
         PreparedStatement ps =
             conn.prepareStatement("CALL PROC_WITH_SIDE_EFFECTS(?)");
@@ -532,7 +532,7 @@
         xtestRollbackStoredProcWhenExecuteUpdateReturnsResults_prepared()
         throws SQLException
     {
-        Connection conn = getXConnection();
+        Connection conn = getConnection();
         conn.setAutoCommit(true);
         PreparedStatement ps =
             conn.prepareStatement("CALL PROC_WITH_SIDE_EFFECTS(?)");
@@ -592,7 +592,7 @@
         throws SQLException
     {
         PreparedStatement ps =
-            getXConnection().prepareStatement("CALL RETRIEVE_EXTERNAL_RESULT(?,?,?)");
+            getConnection().prepareStatement("CALL RETRIEVE_EXTERNAL_RESULT(?,?,?)");
         
         ps.setString(1, getTestConfiguration().getDatabaseName());
         ps.setString(2, getTestConfiguration().getUserName());
@@ -615,7 +615,7 @@
         throws SQLException
     {
         PreparedStatement ps =
-            getXConnection().prepareStatement("CALL RETRIEVE_EXTERNAL_RESULT(?,?,?)");
+            getConnection().prepareStatement("CALL RETRIEVE_EXTERNAL_RESULT(?,?,?)");
         
         ps.setString(1, getTestConfiguration().getDatabaseName());
         ps.setString(2, getTestConfiguration().getUserName());
@@ -772,7 +772,7 @@
      * @exception SQLException if a database error occurs
      */
     public void setUp() throws SQLException {
-        Connection conn = getXConnection();
+        Connection conn = getConnection();
         conn.setAutoCommit(false);
         Statement s = conn.createStatement();
         for (int i = 0; i < TABLES.length; i++) {

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ResultSetCloseTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ResultSetCloseTest.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ResultSetCloseTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ResultSetCloseTest.java Fri Aug 25 13:02:02 2006
@@ -51,7 +51,7 @@
      */
     public void setUp()
     throws SQLException {
-        Connection con = getXConnection();
+        Connection con = getConnection();
         con.setAutoCommit(false);
         
         Statement s = con.createStatement();

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURBaseTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURBaseTest.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURBaseTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURBaseTest.java Fri Aug 25 13:02:02 2006
@@ -48,7 +48,7 @@
     }
     
     /**
-     * Override the default connection's to ensure it
+     * Override a connection's  default state to ensure it
      * is always in autocommit false and repeatable
      * read as a starting point.
      */
@@ -56,19 +56,6 @@
         conn.setAutoCommit(false);
         conn.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);   
     }
-    
-    /**
-     * Get a JDBC Connection to the Derby database.
-     * The autocommit flag is set to false, and the isolation level
-     * for the transactions is set to repeatable read.
-     */
-    protected Connection getNewConnection() 
-        throws SQLException
-    {
-        final Connection rcon = openDefaultConnection();
-        initializeConnection(rcon);
-       return rcon;
-    }
 
     /**
      * Set up the connection to the database.
@@ -77,7 +64,7 @@
         println("SetUp");
         // temp save the connection in this class as con
         // as well as the default connection in the parent
-        con = getXConnection();
+        con = getConnection();
     }
     
     /**

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURQueryMixTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURQueryMixTest.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURQueryMixTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/SURQueryMixTest.java Fri Aug 25 13:02:02 2006
@@ -73,7 +73,7 @@
         throws SQLException
     {
         println(query);
-        DatabaseMetaData dbMeta = getXConnection().getMetaData();
+        DatabaseMetaData dbMeta = getConnection().getMetaData();
                 
         if (dbMeta.ownDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)) {
             checkRowDeleted = true;

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ScrollResultSetTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ScrollResultSetTest.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ScrollResultSetTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ScrollResultSetTest.java Fri Aug 25 13:02:02 2006
@@ -65,7 +65,7 @@
      * Set up the connection to the database.
      */
     public void setUp() throws  Exception {       
-        Connection con = getXConnection();
+        Connection con = getConnection();
         con.setAutoCommit(true);
 
         String createTableWithPK = "CREATE TABLE tableWithPK (" +
@@ -85,7 +85,7 @@
      */
     public void tearDown() throws Exception {
         println("TearDown");
-        Statement s = getXConnection().createStatement();
+        Statement s = getConnection().createStatement();
         try { 
             
             s.executeUpdate("DROP TABLE tableWithPK");
@@ -103,7 +103,7 @@
      */
     public void testNextOnLastRowForwardOnly()  throws SQLException{
 
-        Connection con = getXConnection();
+        Connection con = getConnection();
         con.setAutoCommit(true);
         con.setHoldability(ResultSet.CLOSE_CURSORS_AT_COMMIT);
         Statement roStmt = con.createStatement(
@@ -136,7 +136,7 @@
      */
     public void testNextOnLastRowScrollable()  throws SQLException{
 
-        Connection con = getXConnection();
+        Connection con = getConnection();
         con.setAutoCommit(true);
         con.setHoldability(ResultSet.CLOSE_CURSORS_AT_COMMIT);
         Statement roStmt = con.createStatement(

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/URCoveringIndexTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/URCoveringIndexTest.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/URCoveringIndexTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/URCoveringIndexTest.java Fri Aug 25 13:02:02 2006
@@ -44,7 +44,7 @@
      * Set up the connection to the database.
      */
     public void setUp() throws  Exception {       
-        Connection con = getXConnection();
+        Connection con = getConnection();
         con.setAutoCommit(false);
 
         String createTableWithPK = "CREATE TABLE tableWithPK (" +
@@ -67,7 +67,7 @@
         int resultsetType = scroll ? ResultSet.TYPE_SCROLL_INSENSITIVE :
                 ResultSet.TYPE_FORWARD_ONLY;
         
-        Connection con = getXConnection();
+        Connection con = getConnection();
         
         if (!(con.getMetaData().supportsResultSetConcurrency(resultsetType,
                 ResultSet.CONCUR_UPDATABLE))) {

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/UpdateXXXTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/UpdateXXXTest.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/UpdateXXXTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/UpdateXXXTest.java Fri Aug 25 13:02:02 2006
@@ -76,7 +76,7 @@
     public void setUp()
         throws Exception
     {
-        Connection con = getXConnection();
+        Connection con = getConnection();
         try {
             
             con.setAutoCommit(false);

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/PrepareExecuteDDL.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/PrepareExecuteDDL.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/PrepareExecuteDDL.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/PrepareExecuteDDL.java Fri Aug 25 13:02:02 2006
@@ -37,6 +37,13 @@
  */
 public class PrepareExecuteDDL extends BaseJDBCTestCase {
 	
+    /**
+     * Connection to execute the DDL on. Needs
+     * to be different to the single connection
+     * provided by the super-class. This connection
+     * is used to execute DDL while the other connection
+     * has open objcts dependent on the objct changed by the DDL.
+     */
 	private Connection connDDL;
 	
 	/**
@@ -95,7 +102,7 @@
 	
 	public void testPrepareExcute() throws SQLException
 	{
-        Connection conn = getXConnection();
+        Connection conn = getConnection();
         
 		PreparedStatement[] psa= new PreparedStatement[STMTS.length];
 		for (int i = 0; i < STMTS.length; i++)

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/grantRevokeDDL.sql
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/grantRevokeDDL.sql?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/grantRevokeDDL.sql (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/grantRevokeDDL.sql Fri Aug 25 13:02:02 2006
@@ -23,9 +23,14 @@
 
 set connection satConnection;
 
--- Revoke permissions not granted already
+-- Revoke table permissions not granted already. This should raise warnings.
 revoke trigger on satheesh.tsat from foo;
 revoke references on satheesh.tsat from foo;
+-- This should raise warnings for bar
+revoke insert on satheesh.tsat from foo, bar;
+-- This should raise warnings for both foo and bar
+revoke insert on satheesh.tsat from foo, bar;
+grant insert on satheesh.tsat to foo;
 
 -- Following revokes should revoke permissions
 revoke update on satheesh.tsat from foo;
@@ -48,6 +53,9 @@
 RETURNS NULL ON NULL INPUT
 EXTERNAL NAME 'java.lang.Math.abs'
 LANGUAGE JAVA PARAMETER STYLE JAVA;
+
+-- Revoke routine permission not granted already. This should raise a warning.
+revoke execute on function F_ABS(int) from bar RESTRICT;
 
 grant execute on function F_ABS to foo;
 grant execute on function F_ABS(int) to bar;

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/largeCodeGen.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/largeCodeGen.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/largeCodeGen.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/largeCodeGen.java Fri Aug 25 13:02:02 2006
@@ -60,7 +60,7 @@
        
     protected void setUp() throws SQLException
     {
-        getXConnection().setAutoCommit(false);
+        getConnection().setAutoCommit(false);
     	Statement stmt = createStatement();
 		
 		String createSQL = 	"create table t0 " +

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/predicatePushdown.sql
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/predicatePushdown.sql?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/predicatePushdown.sql (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/predicatePushdown.sql Fri Aug 25 13:02:02 2006
@@ -102,6 +102,11 @@
   select distinct xx1.c1, xx1.c2, 'bokibob' bb, xx1.c from
     (select c1, c, c2, c3 from tc) xx1;
 
+create view vz3 (z1, z2, z3, z4) as
+  select distinct xx1.c1, xx1.c2, 'bokibob' bb, xx1.c from
+    (select c1, c, c2, 28 from tc) xx1
+      union select 'i','j','j',i from t2;
+
 -- Both sides of predicate reference aggregates.
 select x1.c1 from
   (select count(*) from t1 union select count(*) from t2) x1 (c1),
@@ -242,6 +247,15 @@
   (select distinct j from t2 union select j from t1) x2 (c2)
 where x1.z4 = x2.c2;
 
+-- Same as above but with an expression ("i+1") instead of
+-- a numeric literal.
+select x1.z4, x2.c2 from
+  (select z1, z4, z3 from vz
+    union select '1', i+1, '3' from t1
+  ) x1 (z1, z4, z3),
+  (select distinct j from t2 union select j from t1) x2 (c2)
+where x1.z4 = x2.c2;
+
 -- Same as previous query but with a different nested
 -- view (vz2) that is missing the nested union found
 -- in vz.
@@ -252,9 +266,119 @@
   (select distinct j from t2 union select j from t1) x2 (c2)
 where x1.z4 = x2.c2;
 
+-- Queries with Select->Union->Select chains having differently-
+-- ordered result column lists with some non-column reference
+-- expressions.  In all of these queries we specify LEFT join
+-- and force NESTEDLOOP in order to coerce the optimizer to
+-- push predicates to a specific subquery.  We do this to
+-- ensure that we test predicate pushdown during compilation
+-- AND during execution.  It's the execution-time testing
+-- that is particular important for verifying DERBY-1633
+-- functionality.
+
+-- Push predicate to union whose left child has a Select
+-- within a Select, both of which have the same result column
+-- ordering.
+select x1.z4, x2.c2 from
+  (select z1, z4, z3 from vz
+    union select '1', i+1, '3' from t1
+  ) x1 (z1, z4, z3)
+  left join
+  (select distinct i,j from (select distinct i,j from t2) x3
+    union select i, j from t1
+  ) x2 (c1, c2) --DERBY-PROPERTIES joinStrategy=NESTEDLOOP  
+on x1.z4 = x2.c2;
+
+-- Push predicate to union whose left child has a Select
+-- within a Select, where the result column lists for the
+-- two Selects are different ("i,j" vs "j,i").
+select x1.z4, x2.c2 from
+  (select z1, z4, z3 from vz
+    union select '1', i+1, '3' from t1
+  ) x1 (z1, z4, z3)
+  left join
+  (select distinct i,j from (select distinct j,i from t2) x3
+   union select i, j from t1
+  ) x2 (c1, c2) --DERBY-PROPERTIES joinStrategy=NESTEDLOOP  
+on x1.z4 = x2.c2;
+
+-- Push predicate to union whose left child is itself a
+-- nested subquery (through use of the view "vz") and
+-- whose right child has an expression in its result
+-- column list.
+select x1.z4, x2.c2 from
+  (select distinct i,j from (select distinct j,i from t2) x3
+    union select i, j from t1) x2 (c1, c2)
+  left join
+  (select z1, z4, z3 from vz
+    union select '1', i+1, '3' from t1
+  ) x1 (z1, z4, z3) --DERBY-PROPERTIES joinStrategy=NESTEDLOOP 
+on x1.z4 = x2.c2;
+
+-- Same as previous but with a different expression.
+select x1.z4, x2.c2 from
+  (select distinct i,j from (select distinct j,i from t2) x3
+    union select i, j from t1) x2 (c1, c2)
+  left join
+  (select z1, z4, z3 from vz
+    union select '1', sin(i), '3' from t1
+  ) x1 (z1, z4, z3) --DERBY-PROPERTIES joinStrategy=NESTEDLOOP 
+on x1.z4 = x2.c2;
+
+-- Same as previous but expression replaced with a regular
+-- column reference.
+select x1.z4, x2.c2 from
+  (select distinct i,j from (select distinct j,i from t2) x3
+    union select i, j from t1) x2 (c1, c2)
+  left join
+  (select z1, z4, z3 from vz
+    union select '1', i, '3' from t1
+  ) x1 (z1, z4, z3) --DERBY-PROPERTIES joinStrategy=NESTEDLOOP 
+on x1.z4 = x2.c2;
+
+-- Same as previous but with a different expression and
+-- a different subquery (this time using view "vz3").
+select x1.z4, x2.c2 from
+  (select distinct i,j from (select distinct j,i from t2) x3
+    union select i, j from t1) x2 (c1, c2)
+  left join
+  (select z1, z4, z3 from vz3
+    union select '1', sin(i), '3' from t1
+  ) x1 (z1, z4, z3) --DERBY-PROPERTIES joinStrategy=NESTEDLOOP 
+on x1.z4 = x2.c2;
+
+-- Push predicate to chain of unions whose left-most child
+-- is itself a nested subquery (through use of the view "vz")
+-- and in which the other unions have expressions in their
+-- result column lists.
+select x1.z4, x2.c2 from
+  (select distinct i,j from (select distinct j,i from t2) x3
+    union select i, j from t1) x2 (c1, c2)
+  left join
+  (select z1, z4, z3 from vz
+    union select '1', sin(i), '3' from t1
+    union select '1', 14, '3' from t1
+  ) x1 (z1, z4, z3) --DERBY-PROPERTIES joinStrategy=NESTEDLOOP 
+on x1.z4 = x2.c2;
+
+-- Push predicate to chain of unions whose right-most child
+-- is itself a nested subquery (through use of the view "vz")
+-- and in which the other unions have expressions in their
+-- result column lists.
+select x1.z4, x2.c2 from
+  (select distinct i,j from (select distinct j,i from t2) x3
+    union select i, j from t1) x2 (c1, c2)
+  left join
+  (select '1', sin(i), '3' from t1
+    union select '1', 14, '3' from t1
+    union select z1, z4, z3 from vz
+  ) x1 (z1, z4, z3) --DERBY-PROPERTIES joinStrategy=NESTEDLOOP 
+on x1.z4 = x2.c2;
+
 -- Cleanup from this set of tests.
 drop view vz;
 drop view vz2;
+drop view vz3;
 drop table tc;
 
 -- Now bump up the size of tables T3 and T4 to the point where
@@ -744,3 +868,263 @@
 drop table xx1;
 drop table yy1;
 
+
+-- DERBY-1633: Nested UNIONs of views with different column orderings
+-- leads to incorrectly scoped predicates.  We have a lot of different
+-- tables and views here to try to cover several different situations.
+-- Note that all of the views use DISTINCT because we don't want
+-- the views to be flattened and Derby doesn't flatten select
+-- queries with DISTINCT in them.
+
+CREATE TABLE "APP"."T1" ("I" INTEGER, "D" DOUBLE, "C" CHAR(10));
+CREATE TABLE "APP"."T2" ("I2" INTEGER, "D2" DOUBLE, "C2" CHAR(10));
+CREATE TABLE "APP"."T3" ("I3" INTEGER, "D3" DOUBLE, "C3" CHAR(10));
+
+insert into t1 values (1, -1, '1'), (2, -2, '2');
+insert into t2 values (2, -2, '2'), (4, -4, '4'), (8, -8, '8');
+insert into t3 values (3, -3, '3'), (6, -6, '6'), (9, -9, '9');
+
+CREATE TABLE "APP"."T4" ("C4" CHAR(10));
+insert into t4 values '1', '2', '3', '4', '5', '6', '7', '8', '9';
+insert into t4 select rtrim(c4) || rtrim(c4) from t4;
+
+CREATE TABLE "APP"."T5" ("I5" INTEGER, "D5" DOUBLE, "C5" CHAR(10));
+CREATE TABLE "APP"."T6" ("I6" INTEGER, "D6" DOUBLE, "C6" CHAR(10));
+
+insert into t5
+  values (100, 100.0, '100'), (200, 200.0, '200'), (300, 300.0, '300');
+
+insert into t6
+  values (400, 400.0, '400'), (200, 200.0, '200'), (300, 300.0, '300');
+
+create view v_keycol_at_pos_3 as
+  select distinct i col1, d col2, c col3 from t1;
+
+create view v1_keycol_at_pos_2 as
+  select distinct i2 col1, c2 col3, d2 col2 from t2;
+
+create view v2_keycol_at_pos_2 as
+  select distinct i3 col1, c3 col3, d3 col2 from t3;
+
+create view v1_intersect as
+  select distinct i5 col1, c5 col3, d5 col2 from t5;
+
+create view v2_intersect as
+  select distinct i6 col1, c6 col3, d6 col2 from t6;
+
+create view v1_values as
+  select distinct vals1 col1, vals2 col2, vals3 col3 from
+    (values (321, 321.0, '321'), (432, 432.0, '432'),
+      (654, 654.0, '654')
+    ) VT(vals1, vals2, vals3);
+
+create view v_union as
+  select distinct i col1, d col2, c col3 from t1
+    union select distinct i3 col1, d3 col2, c3 col3 from t3;
+
+-- Chain of UNIONs with left-most child as a view with a
+-- an RCL that is ordered differently than that of the
+-- UNIONs above it.  The right child of the top-level
+-- node is a view that is a simple select from a table.
+create view topview as
+  (select distinct 'other:' col0, vpos3.col3, vpos3.col1
+    from v_keycol_at_pos_3 vpos3
+   union
+    select distinct 't2stuff:' col0, vpos2_1.col3, vpos2_1.col1
+     from v1_keycol_at_pos_2 vpos2_1
+   union
+    select distinct 't3stuff:' col0, vpos2_2.col3, vpos2_2.col1
+     from v2_keycol_at_pos_2 vpos2_2
+  );
+
+-- Chain of UNIONs with left-most child as a view with a
+-- an RCL that is ordered differently than that of the
+-- UNIONs above it.  The right child of the top-level
+-- node is a view that is a select from yet another
+-- UNION node.
+create view topview2 as
+  (select distinct 'other:' col0, vpos3.col3, vpos3.col1
+    from v_keycol_at_pos_3 vpos3
+   union
+    select distinct 't2stuff:' col0, vpos2_1.col3, vpos2_1.col1
+     from v1_keycol_at_pos_2 vpos2_1
+   union
+    select distinct 't3stuff:' col0, vpos2_2.col3, vpos2_2.col1
+     from v2_keycol_at_pos_2 vpos2_2
+   union
+    select distinct 'morestuff:' col0, vu.col3, vu.col1
+     from v_union vu
+  );
+
+-- Chain of UNIONs with left-most child as a view with a
+-- an RCL that is ordered differently than that of the
+-- UNIONs above it.  The left-most child of the last
+-- UNION in the chain is an INTERSECT node to which
+-- predicates cannot (currently) be pushed.  In this
+-- case the intersect returns an empty result set.
+create view topview3 (col0, col3, col1) as
+  (select distinct 'other:' col0, vpos3.col3, vpos3.col1
+    from v_keycol_at_pos_3 vpos3
+   intersect
+    select distinct 't2stuff:' col0, vpos2_1.col3, vpos2_1.col1
+     from v1_keycol_at_pos_2 vpos2_1
+   union
+    select distinct 't3stuff:' col0, vpos2_2.col3, vpos2_2.col1
+     from v2_keycol_at_pos_2 vpos2_2
+   union
+    select distinct 'morestuff:' col0, vu.col3, vu.col1
+     from v_union vu
+  );
+
+-- Chain of UNIONs with left-most child as a view with a
+-- an RCL that is ordered differently than that of the
+-- UNIONs above it.  The left-most child of the last
+-- UNION in the chain is an INTERSECT node to which
+-- predicates cannot (currently) be pushed.  In this
+-- case the intersect returns a couple of rows.
+create view topview4 (col0, col3, col1) as
+  (select distinct 'intersect:' col0, vi1.col3, vi1.col1
+    from v1_intersect vi1
+   intersect
+    select distinct 'intersect:' col0, vi2.col3, vi2.col1
+     from v2_intersect vi2
+   union
+    select distinct 't3stuff:' col0, vpos2_2.col3, vpos2_2.col1
+     from v2_keycol_at_pos_2 vpos2_2
+   union
+    select distinct 'morestuff:' col0, vu.col3, vu.col1
+   from v_union vu
+  );
+
+-- Chain of UNIONs with left-most child as a view with a
+-- an RCL that is ordered differently than that of the
+-- UNIONs above it.  The left-most child of the last
+-- UNION in the chain is a view that is a selet from
+-- a VALUES list (i.e. no base table).
+create view topview5 (col0, col3, col1) as
+  (select distinct 'values:' col0, vv1.col3, vv1.col1
+    from v1_values vv1
+   union
+    select distinct 'intersect:' col0, vi2.col3, vi2.col1
+     from v2_intersect vi2
+   union
+    select distinct 't3stuff:' col0, vpos2_2.col3, vpos2_2.col1
+     from v2_keycol_at_pos_2 vpos2_2
+   union
+    select distinct 'morestuff:' col0, vu.col3, vu.col1
+   from v_union vu
+  );
+
+-- All of the following queries failed at some point while finalizing
+-- the fix for DERBY-1633; some failed with error 42818, others
+-- failed with execution-time NPEs caused by incorrect (esp. double)
+-- remapping.  The point here is to see how the top-level
+-- predicates are pushed through the nested unions to the
+-- bottom-most children.  Use of LEFT JOINs with NESTEDLOOP
+-- effectively allows us to force the join order and thus to
+-- ensure the predicates are pushed to the desired top-level
+-- at execution time.  All such queries are run once with
+-- NESTEDLOOP and once without, to make sure things work
+-- in both cases.
+
+select * from t4, topview where t4.c4 = topview.col3;
+select * from t4, topview where topview.col3 = t4.c4;
+select * from topview x1, topview where topview.col3 = x1.col3;
+
+select * from t4, topview2 where t4.c4 = topview2.col3;
+select * from topview2 x1, topview where topview.col3 = x1.col3;
+
+select * from t4
+  left join topview
+  on t4.c4 = topview.col3;
+
+select * from t4
+  left join topview --DERBY-PROPERTIES joinStrategy=NESTEDLOOP
+  on t4.c4 = topview.col3;
+
+select * from t4
+  left join topview
+  on topview.col3 = t4.c4;
+
+select * from t4
+  left join topview --DERBY-PROPERTIES joinStrategy=NESTEDLOOP
+  on topview.col3 = t4.c4;
+
+select * from topview x1
+  left join topview
+  on topview.col3 = x1.col3;
+
+select * from topview x1
+  left join topview --DERBY-PROPERTIES joinStrategy=NESTEDLOOP
+  on topview.col3 = x1.col3;
+
+select * from t4
+  left join topview2
+  on t4.c4 = topview2.col3;
+
+select * from t4
+  left join topview2 --DERBY-PROPERTIES joinStrategy=NESTEDLOOP
+  on t4.c4 = topview2.col3;
+
+select * from topview2 x1
+  left join topview
+  on topview.col3 = x1.col3;
+
+select * from topview2 x1
+  left join topview --DERBY-PROPERTIES joinStrategy=NESTEDLOOP
+  on topview.col3 = x1.col3;
+
+select * from topview x1
+  left join topview2
+  on topview2.col3 = x1.col3;
+
+select * from topview x1
+  left join topview2 --DERBY-PROPERTIES joinStrategy=NESTEDLOOP
+  on topview2.col3 = x1.col3;
+
+select * from topview x1
+  left join topview3
+  on topview3.col3 = x1.col3;
+
+select * from topview x1
+  left join topview3 --DERBY-PROPERTIES joinStrategy=NESTEDLOOP
+  on topview3.col3 = x1.col3;
+
+select * from topview x1
+  left join topview4
+  on topview4.col3 = x1.col3;
+
+select * from topview x1
+  left join topview4 --DERBY-PROPERTIES joinStrategy=NESTEDLOOP
+  on topview4.col3 = x1.col3;
+
+select * from topview x1
+  left join topview5
+  on topview5.col3 = x1.col3;
+
+select * from topview x1
+  left join topview5 --DERBY-PROPERTIES joinStrategy=NESTEDLOOP
+  on topview5.col3 = x1.col3;
+
+-- Clean-up from DERBY-1633.
+
+drop view topview;
+drop view topview2;
+drop view topview3;
+drop view topview4;
+drop view topview5;
+
+drop view v_keycol_at_pos_3;
+drop view v1_keycol_at_pos_2;
+drop view v2_keycol_at_pos_2;
+drop view v1_intersect;
+drop view v2_intersect;
+drop view v1_values;
+drop view v_union;
+
+drop table t1;
+drop table t2;
+drop table t3;
+drop table t4;
+drop table t5;
+drop table t6;

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/triggerGeneral.sql
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/triggerGeneral.sql?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/triggerGeneral.sql (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/triggerGeneral.sql Fri Aug 25 13:02:02 2006
@@ -624,7 +624,7 @@
 SELECT * FROM T10641;
 SELECT * FROM T10642;
 SELECT * FROM T10641_DELETIONS;
-SELECT * FROM T10642_DELETIONS;
+SELECT * FROM T10642_DELETIONS; 
 
 -- DERBY-1652
 create table test (testid integer not null 
@@ -637,3 +637,75 @@
     update test set ts=current_timestamp where testid=old.testid;
 insert into test(info) values (1),(2),(3);
 UPDATE TEST SET INFO = 1 WHERE TESTID = 2;
+drop table test;
+
+-- DERBY-1621
+-- creating and dropping index on the table in the trigger action
+create table t1 (i int);
+create table t2 (i int);
+create trigger tt after insert on t1 for each statement mode db2sql insert into t2 values 1;
+insert into t1 values 1;
+create unique index tu on t2(i);
+insert into t1 values 1;
+select * from t2;
+insert into t1 values 1;
+select * from t2;
+drop index tu;
+select * from t2;
+insert into t1 values 1;
+select * from t2;
+drop trigger tt;
+
+-- dropping and recreating a table which the trigger references
+create table t3 (i int);
+create table t4 (i int);
+create trigger tt2 after insert on t3 for each statement mode db2sql insert into t4 values 1;
+insert into t3 values 1;
+select * from t4;
+drop table t4;
+insert into t3 values 1;
+create table t4 (i int);
+insert into t3 values 1;
+select * from t4;
+
+-- dropping a function which the trigger references
+create function max_value(x int, y int) returns int language java parameter style java external name 'java.lang.Math.max';
+create table test(a integer);
+create trigger test_trigger AFTER insert on test FOR EACH ROW MODE DB2SQL values max_value(2,4);
+
+insert into test values(1);
+
+--- drop function and again do inserts. these should not work as the trigger would be invalid
+drop function max_value;
+insert into test values(2);
+insert into test values(1);
+
+
+-- dropping a view which the trigger references
+create table t11TriggerTest (c111 int not null primary key, c112 int);
+insert into t11TriggerTest values(1,1);
+insert into t11TriggerTest values(2,2);
+
+-- create a view based on table t11TriggerTest
+create view v21ViewTest as select * from t11TriggerTest;
+
+-- get ready to create a trigger. Trigger is created on t31TriggerTest and it inserts into t32TriggerTest
+create table t31TriggerTest (c311 int);
+create table t32TriggerTest (c321 int);
+create trigger tr31t31TriggerTest after insert on t31TriggerTest for each statement mode db2sql
+   insert into t32TriggerTest values (select c111 from v21ViewTest where c112=1);
+
+-- try an insert which will fire the trigger
+insert into t31TriggerTest values(1);
+select * from t31TriggerTest;
+-- we know the trigger got fired if there is one row in t32TriggerTest
+select * from t32TriggerTest;
+
+-- drop the view used by the trigger.
+drop view v21ViewTest;
+
+-- try an insert which would cause insert trigger to fire. The insert trigger should have failed because view doesn't
+-- exist anymore.
+insert into t31TriggerTest values(1);
+select * from t31TriggerTest;
+select * from t32TriggerTest;

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootAllTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootAllTest.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootAllTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootAllTest.java Fri Aug 25 13:02:02 2006
@@ -37,8 +37,6 @@
  */
 public class BootAllTest  extends BaseJDBCTestCase {
 
-    /** JDBC Connection */
-    private Connection con;
     private Driver driver;
     private String databases[] = new String[] {"wombat1", "wombat2", "wombat3"};
     
@@ -57,16 +55,16 @@
      */
     public void setUp() throws Exception {
         for (int i = 0; i < databases.length; i++) {
-            con = openConnection(databases[i]);
+            Connection con = openConnection(databases[i]);
             con.close();
             try {
-                con = openConnection(databases[i] + ";shutdown=true");
+                openConnection(databases[i] + ";shutdown=true");
             } catch (SQLException se) {
                 assertEquals("Expected exception on setUp " + se.getSQLState(), 
                         DATABASE_SHUT_DOWN, se.getSQLState());
             }
         }
-        String url = CONFIG.getJDBCUrl("");
+        String url = getTestConfiguration().getJDBCUrl("");
         driver = DriverManager.getDriver(url);
         DriverManager.deregisterDriver(driver);
         try {
@@ -83,11 +81,11 @@
      * Shutdown all databases
      */
     public void tearDown() throws Exception {
-        String driverName = CONFIG.getJDBCClient().getJDBCDriverName();
+        String driverName = getTestConfiguration().getJDBCClient().getJDBCDriverName();
         Class.forName(driverName);
         println("Teardown of: " + getName());
         try {
-            con = openConnection(";shutdown=true");
+            openConnection(";shutdown=true");
         } catch (SQLException se) {
             assertEquals("Expected exception on tearDown " + se.getSQLState(), 
                     ALL_DATABASES_SHUT_DOWN, se.getSQLState());
@@ -111,8 +109,8 @@
 
         setSystemProperty("derby.system.bootAll", "true");
 
-        String driverName = CONFIG.getJDBCClient().getJDBCDriverName();
-        String url = CONFIG.getJDBCUrl("");
+        String driverName = getTestConfiguration().getJDBCClient().getJDBCDriverName();
+        String url = getTestConfiguration().getJDBCUrl("");
 
         Class.forName(driverName).newInstance();
         DriverManager.registerDriver(driver);

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/tools/IJRunScriptTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/tools/IJRunScriptTest.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/tools/IJRunScriptTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/tools/IJRunScriptTest.java Fri Aug 25 13:02:02 2006
@@ -95,7 +95,7 @@
     public void testAutoCommitCommand()
         throws SQLException, UnsupportedEncodingException
     {      
-        Connection conn = getXConnection();
+        Connection conn = getConnection();
         assertTrue(conn.getAutoCommit());
         runTestingScript("AUTOCOMMIT OFF;", 0);
         

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/tools/sysinfo_api.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/tools/sysinfo_api.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/tools/sysinfo_api.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/tools/sysinfo_api.java Fri Aug 25 13:02:02 2006
@@ -138,7 +138,7 @@
      *              with sysinfo
      */
     public void setUp() throws SQLException {
-        dm = getXConnection().getMetaData();
+        dm = getConnection().getMetaData();
     }
 
 

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/util/ScriptTestCase.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/util/ScriptTestCase.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/util/ScriptTestCase.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/util/ScriptTestCase.java Fri Aug 25 13:02:02 2006
@@ -113,7 +113,7 @@
 		ByteArrayOutputStream rawBytes =
 			new ByteArrayOutputStream(20 * 1024);
 			
-		Connection conn = getXConnection();
+		Connection conn = getConnection();
 		org.apache.derby.tools.ij.runScript(
 				conn,
 				sqlIn,

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java Fri Aug 25 13:02:02 2006
@@ -70,7 +70,7 @@
      */
     // TEMP NAME - WILL BE getConnection() once all uses of the
     // static getConnection() have been converted to openDefaultConnection
-    public Connection getXConnection() throws SQLException
+    public Connection getConnection() throws SQLException
     {
         if (conn != null)
         {
@@ -78,14 +78,18 @@
                 return conn;
             conn = null;
         }
-        conn = getTestConfiguration().openDefaultConnection();
-        initializeConnection(conn);
-        return conn;
+        return conn = openDefaultConnection();
     }
     
     /**
      * Allow a sub-class to initialize a connection to provide
-     * consistent connection state for its tests. Called only
+     * consistent connection state for its tests. Called once
+     * for each time these method calls open a connection:
+     * <UL>
+     * <LI> getConnection()
+     * <LI> openDefaultConnection()
+     * <LI> openConnection(database)
+     * </UL>
      * when getConnection() opens a new connection. Default
      * action is to not modify the connection's state from
      * the initialization provided by the data source.
@@ -104,7 +108,7 @@
      */
     public Statement createStatement() throws SQLException
     {
-        return getXConnection().createStatement();
+        return getConnection().createStatement();
     }
 
     /**
@@ -117,19 +121,31 @@
     public Statement createStatement(int resultSetType,
             int resultSetConcurrency) throws SQLException
     {
-        return getXConnection().createStatement(resultSetType, resultSetConcurrency);
+        return getConnection().createStatement(resultSetType, resultSetConcurrency);
     }
     /**
      * Utility method to create a PreparedStatement using the connection
      * returned by getConnection.
      * @return Statement object from
-     * getConnection.createStatement(resultSetType, resultSetConcurrency)
+     * getConnection.prepareStatement(sql)
      * @throws SQLException
      */
     public PreparedStatement prepareStatement(String sql) throws SQLException
     {
-        return getXConnection().prepareStatement(sql);
+        return getConnection().prepareStatement(sql);
     }    
+
+    /**
+     * Utility method to create a CallableStatement using the connection
+     * returned by getConnection.
+     * @return Statement object from
+     * getConnection().prepareCall(sql)
+     * @throws SQLException
+     */
+    public CallableStatement prepareCall(String sql) throws SQLException
+    {
+        return getConnection().prepareCall(sql);
+    }
     
     /**
      * Utility method to commit using the connection
@@ -138,7 +154,7 @@
      */
     public void commit() throws SQLException
     {
-        getXConnection().commit();
+        getConnection().commit();
     }  
     /**
      * Utility method to rollback using the connection
@@ -147,7 +163,7 @@
      */
     public void rollback() throws SQLException
     {
-        getXConnection().rollback();
+        getConnection().rollback();
     } 
     /**
      * Tear down this fixture, sub-classes should call
@@ -161,12 +177,6 @@
         conn = null;
     }
 
-    // TEMP
-    public static Connection getConnection() throws SQLException
-    {
-        return openDefaultConnection();
-    }
-
     /**
      * Open a connection to the default database.
      * If the database does not exist, it will be created.
@@ -175,14 +185,18 @@
      * @return connection to default database.
      * @see TestConfiguration#openDefaultConnection()
      */
-    public static Connection openDefaultConnection()
+    public Connection openDefaultConnection()
         throws SQLException {
-        return CONFIG.openDefaultConnection();
+        Connection conn =  getTestConfiguration().openDefaultConnection();
+        initializeConnection(conn);
+        return conn;
     }
     
     public Connection openConnection(String databaseName) throws SQLException
     {
-        return getTestConfiguration().openConnection(databaseName);
+        Connection conn = getTestConfiguration().openConnection(databaseName);
+        initializeConnection(conn);
+        return conn;        
     }
     
     /**
@@ -202,7 +216,7 @@
         };
         
         // Use the same encoding as the input for the output.    
-        return ij.runScript(getXConnection(), script, encoding,
+        return ij.runScript(getConnection(), script, encoding,
                 sink, encoding);       
     }
     
@@ -231,7 +245,7 @@
      *         <code>false</code> otherwise.
      */
      public static boolean usingEmbedded() {
-         return CONFIG.getJDBCClient().isEmbedded();
+         return TestConfiguration.getCurrent().getJDBCClient().isEmbedded();
      }
     
     /**
@@ -241,7 +255,7 @@
     *         <code>false</code> otherwise.
     */
     public static boolean usingDerbyNetClient() {
-        return CONFIG.getJDBCClient().isDerbyNetClient();
+        return TestConfiguration.getCurrent().getJDBCClient().isDerbyNetClient();
     }
     
     /**
@@ -251,7 +265,7 @@
     *         <code>false</code> otherwise.
     */
     public static boolean usingDerbyNet() {
-        return CONFIG.getJDBCClient().isDB2Client();
+        return TestConfiguration.getCurrent().getJDBCClient().isDB2Client();
     }
 
     /**

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestSetup.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestSetup.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestSetup.java Fri Aug 25 13:02:02 2006
@@ -48,7 +48,7 @@
      */
     public final TestConfiguration getTestConfiguration()
     {
-    	return TestConfiguration.DERBY_TEST_CONFIG;
+    	return TestConfiguration.getCurrent();
     }
     
     /**

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java Fri Aug 25 13:02:02 2006
@@ -37,15 +37,6 @@
  */
 public abstract class BaseTestCase
     extends TestCase {
-
-    /**
-     * Configuration for the test case.
-     * The configuration is created based on system properties.
-     *
-     * @see TestConfiguration
-     */
-    public static final TestConfiguration CONFIG = 
-        TestConfiguration.DERBY_TEST_CONFIG;
     
     /**
      * No argument constructor made private to enforce naming of test cases.
@@ -90,7 +81,7 @@
      */
     public final TestConfiguration getTestConfiguration()
     {
-    	return CONFIG;
+    	return TestConfiguration.getCurrent();
     }
     
     /**
@@ -106,7 +97,7 @@
      * @param text String to print
      */
     public static void println(final String text) {
-        if (CONFIG.isVerbose()) {
+        if (TestConfiguration.getCurrent().isVerbose()) {
             out.println("DEBUG: " + text);
         }
     }

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java Fri Aug 25 13:02:02 2006
@@ -43,9 +43,6 @@
      */
     public NetworkServerTestSetup(Test test) {
         super(test);
-        
-        this.config = TestConfiguration.DERBY_TEST_CONFIG;
-        this.networkServerController = null;
     }
 
     /**
@@ -53,6 +50,8 @@
      */
     protected void setUp() throws Exception {
         
+        TestConfiguration config = TestConfiguration.getCurrent();
+        
         if (!config.getJDBCClient().isEmbedded()) {
             BaseTestCase.println("Starting network server:");
             networkServerController = new NetworkServerControl
@@ -87,9 +86,6 @@
     
     /* Network Server Control */
     private NetworkServerControl networkServerController;
-    
-    /* Configuration of test */
-    private final TestConfiguration config;
     
     /** Wait maximum 1 minute for server to start */
     private static final int WAIT_TIME = 60000;

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java?rev=436921&r1=436920&r2=436921&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java Fri Aug 25 13:02:02 2006
@@ -31,12 +31,41 @@
  * Class which holds information about the configuration of a Test.
  */
 public class TestConfiguration {
-    
+
     /**
      * Default Derby test configuration object.
      */
-    public static final TestConfiguration DERBY_TEST_CONFIG = 
+    private static final TestConfiguration DERBY_TEST_CONFIG = 
         new TestConfiguration(getSystemProperties());
+    
+    /**
+     * Current configuration is stored in a ThreadLocal to
+     * allow the potential for multiple tests to be running
+     * concurrently with different configurations.
+     */
+    private static final ThreadLocal CURRENT_CONFIG = new ThreadLocal() {
+        protected Object initialValue() {
+            return DERBY_TEST_CONFIG;
+        }
+    };
+   
+    /**
+     * Get this Thread's current configuraiton for running
+     * the tests.
+     * @return TestConfiguration to use.
+     */
+    public static TestConfiguration getCurrent() {
+        return (TestConfiguration) CURRENT_CONFIG.get();
+    }
+    
+    /**
+     * Set this Thread's current configuration for running tests.
+     * @param config Configuration to set it to.
+     */
+    private static void setCurrent(TestConfiguration config)
+    {
+        CURRENT_CONFIG.set(config);
+    }
     
     /**
      * This constructor creates a TestConfiguration from a Properties object.