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 ka...@apache.org on 2011/06/23 11:25:58 UTC
svn commit: r1138787 - in /db/derby/code/trunk/java:
engine/org/apache/derby/impl/sql/GenericStatement.java
testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java
Author: kahatlen
Date: Thu Jun 23 09:25:58 2011
New Revision: 1138787
URL: http://svn.apache.org/viewvc?rev=1138787&view=rev
Log:
DERBY-5280: Large batch of DDL in a database procedure dies on a transaction severity error
Backed out the fix for DERBY-5161 since it's causing a regression and
shouldn't be needed after DERBY-5157.
Modified:
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericStatement.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericStatement.java?rev=1138787&r1=1138786&r2=1138787&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericStatement.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/GenericStatement.java Thu Jun 23 09:25:58 2011
@@ -553,10 +553,6 @@ public class GenericStatement
if (foundInCache)
((GenericLanguageConnectionContext)lcc).removeStatement(this);
- if (statementContext != null) {
- statementContext.cleanupOnError(se);
- }
-
throw se;
}
finally
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java?rev=1138787&r1=1138786&r2=1138787&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java Thu Jun 23 09:25:58 2011
@@ -641,6 +641,40 @@ public class ProcedureTest extends BaseJ
}
/**
+ * Test that a statement severity error inside a procedure doesn't kill
+ * the top-level statement that executes the stored procedure. Regression
+ * test case for DERBY-5280.
+ */
+ public void testStatementSeverityErrorInProcedure() throws SQLException {
+ Statement s = createStatement();
+ s.execute("create procedure proc_5280() language java " +
+ "parameter style java external name '" +
+ getClass().getName() + ".proc_5280' reads sql data");
+ s.execute("call proc_5280()");
+ }
+
+ /**
+ * Procedure that drops a non-existent table and ignores the exception
+ * thrown because of it. Used by the regression test case for DERBY-5280.
+ */
+ public static void proc_5280() throws SQLException {
+ Connection c = DriverManager.getConnection("jdbc:default:connection");
+ Statement s = c.createStatement();
+
+ // Drop a non-existent table and verify that it fails with the
+ // expected exception. Ignore the exception.
+ try {
+ s.execute("drop table this_table_does_not_exist");
+ fail("dropping non-existent table should fail");
+ } catch (SQLException sqle) {
+ assertSQLState("42Y55", sqle);
+ }
+
+ // The statement should still work.
+ JDBC.assertSingleValueResultSet(s.executeQuery("values 1"), "1");
+ }
+
+ /**
* Test that INOUT args are preserved over procedure invocations.
* See DERBY-2515.
*/