db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r508208 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests: master/ suites/ tests/lang/
Date Thu, 15 Feb 2007 22:32:08 GMT
Author: djd
Date: Thu Feb 15 14:32:07 2007
New Revision: 508208

URL: http://svn.apache.org/viewvc?view=rev&rev=508208
Log:
DERBY-2332 (partial) Add some more testing to StatementPlanCache and remove old harness tests
that overlap.

Removed:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/repeat.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/stmtCache0.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/stmtCache1.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/repeat.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/stmtCache0.sql
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/stmtCache0_derby.properties
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/stmtCache1.sql
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/stmtCache1_app.properties
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/stmtCache1_derby.properties
Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbylang.runall
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LangHarnessJavaTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/StatementPlanCacheTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbylang.runall
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbylang.runall?view=diff&rev=508208&r1=508207&r2=508208
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbylang.runall
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbylang.runall
Thu Feb 15 14:32:07 2007
@@ -73,8 +73,6 @@
 lang/specjPlans.sql
 lang/SpillHash.java
 lang/staleplans.sql
-lang/stmtCache0.sql
-lang/stmtCache1.sql
 lang/stmtCache3.java
 lang/subquery.sql
 lang/subquery2.sql

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LangHarnessJavaTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LangHarnessJavaTest.java?view=diff&rev=508208&r1=508207&r2=508208
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LangHarnessJavaTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LangHarnessJavaTest.java
Thu Feb 15 14:32:07 2007
@@ -77,7 +77,7 @@
         // "maxMemPerTab", TODO: investigate/convert
         // "outparams", TODO: investigate/convert
         // "procedure", TODO: uses TestUtil.isNetFramework()
-        "repeat", 
+        // "repeat", CONVERTED (StatementPlanCacheTest)
         "simpleThreadWrapper",
         // "SpillHash", TODO: calls System.exit
         // "stmtCache3", TODO: investigate/convert

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/StatementPlanCacheTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/StatementPlanCacheTest.java?view=diff&rev=508208&r1=508207&r2=508208
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/StatementPlanCacheTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/StatementPlanCacheTest.java
Thu Feb 15 14:32:07 2007
@@ -19,6 +19,8 @@
 */
 package org.apache.derbyTesting.functionTests.tests.lang;
 
+import java.sql.CallableStatement;
+import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
@@ -153,6 +155,34 @@
     }
     
     /**
+     * Check that the same plan can be shared across
+     * Statement, PreparedStatement and CallableStatement.
+     */
+    public void testAcrossStatementObjects() throws SQLException
+    {
+        String schema = this.getTestConfiguration().getUserName();
+        
+        String sql = sql = "CALL SYSCS_UTIL.SYSCS_SET_STATISTICS_TIMING(0)";
+        Statement s = createStatement();
+        s.execute(sql);
+        s.close();
+        
+        assertTrue(sql, isPlanInCache(schema, sql));
+        
+        PreparedStatement ps = prepareStatement(sql);
+        assertTrue(sql, isPlanInCache(ps));
+               
+        CallableStatement cs = prepareCall(sql);      
+        assertTrue(sql, isPlanInCache(cs));
+             
+        // Check the prepared statement matches the callable
+        assertEquals(ps.toString(), cs.toString());
+        
+        ps.close();
+        cs.close();
+    }
+    
+    /**
      * Test that statements that fail to compile do not end up in the cache.
      */
     public void testCompileFailuresNotInCache() throws SQLException
@@ -229,6 +259,7 @@
         
         for (int i = 0; i < firstCompileID.length; i++ )
         {
+            // Check caching is across statements
             PreparedStatement ps = isCall ?
                     prepareCall(sql[i]) : prepareStatement(sql[i]);
             PreparedStatement ps2 = isCall ?
@@ -238,6 +269,16 @@
             assertEquals(sql[i], ps.toString(), ps2.toString());
             ps.close();
             ps2.close();
+            
+            // Check the caching is across connections
+            Connection c2 = openDefaultConnection();
+            PreparedStatement psD = isCall ?
+                    c2.prepareCall(sql[i]) : c2.prepareStatement(sql[i]);
+            
+            assertEquals(sql[i], firstCompileID[i], psD.toString());
+            psD.close();
+            c2.close();
+            
         }
         
         String schema = this.getTestConfiguration().getUserName();



Mime
View raw message