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 ma...@apache.org on 2008/01/22 20:29:53 UTC

svn commit: r614292 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LangProcedureTest.java

Author: mamta
Date: Tue Jan 22 11:29:50 2008
New Revision: 614292

URL: http://svn.apache.org/viewvc?rev=614292&view=rev
Log:
Adding a junit test for the standalone test case provided by Dag for DERBY-3304. Here, we 
are adding a Java procedure which does a commit and then returns a resultset back to the 
caller. The resultset should not get closed as part of the commit.


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

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LangProcedureTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LangProcedureTest.java?rev=614292&r1=614291&r2=614292&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LangProcedureTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LangProcedureTest.java Tue Jan 22 11:29:50 2008
@@ -260,7 +260,35 @@
                 "CALL APP.SIGNATURE_BUG_DERBY_258_I(4)");
         s.execute("DROP PROCEDURE SIGNATURE_BUG_DERBY_258_I");
 
+        s.execute("CREATE PROCEDURE DERBY_3304() "
+                + " DYNAMIC RESULT SETS 1 LANGUAGE JAVA PARAMETER STYLE JAVA " 
+                + " EXTERNAL NAME 'org.apache.derbyTesting.functionTests.tests.lang.LangProcedureTest.DERBY_3304'"
+                + " MODIFIES SQL DATA");               
+        String[][] t1Results = { { "APP"} };
+        ResultSet rs = s.executeQuery("CALL APP.DERBY_3304()");
+        JDBC.assertFullResultSet(rs, t1Results);
+        s.execute("DROP PROCEDURE DERBY_3304");
+
         s.close();
+    }
+
+    /**
+     * This procedure does an explicit commit and then creates a resultset
+     * to be passed back to the caller. As part of commit, we should not
+     * close the resultset that will be returned by this procedure.
+     * 
+     * @param rs1
+     * @throws SQLException
+     */
+    public static void DERBY_3304(ResultSet[] rs1) throws SQLException 
+    {
+        Connection conn = null;
+        Statement stm = null;
+        conn = DriverManager.getConnection("jdbc:default:connection");
+        stm = conn.createStatement();
+        conn.commit();
+        ResultSet rs = stm.executeQuery("values current_user");
+        rs1[0] = rs;
     }
 
     /**