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 14:43:46 UTC

svn commit: r1138856 - in /db/derby/code/branches/10.8: ./ java/engine/org/apache/derby/impl/sql/GenericStatement.java java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java

Author: kahatlen
Date: Thu Jun 23 12:43:45 2011
New Revision: 1138856

URL: http://svn.apache.org/viewvc?rev=1138856&view=rev
Log:
DERBY-5280: Large batch of DDL in a database procedure dies on a transaction severity error

Merged fix from trunk (revision 1138787).

Modified:
    db/derby/code/branches/10.8/   (props changed)
    db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/sql/GenericStatement.java
    db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java

Propchange: db/derby/code/branches/10.8/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jun 23 12:43:45 2011
@@ -1,2 +1,2 @@
 /db/derby/code/branches/10.7:1061570,1061578,1082235
-/db/derby/code/trunk:1063809,1088633,1091000,1091221,1091285,1092067,1092795,1094315,1094572,1094728,1096741,1096890,1097247,1097249,1097460,1097469,1097471,1101059,1101839,1102620,1102826,1103681,1103718,1103742,1125305,1126358,1126468,1127825,1127883,1129136,1129764,1129797,1130077,1130084,1130632,1130895,1131030,1131272,1132546,1132664,1132860,1132928,1133741,1133752,1136371,1136397,1136844
+/db/derby/code/trunk:1063809,1088633,1091000,1091221,1091285,1092067,1092795,1094315,1094572,1094728,1096741,1096890,1097247,1097249,1097460,1097469,1097471,1101059,1101839,1102620,1102826,1103681,1103718,1103742,1125305,1126358,1126468,1127825,1127883,1129136,1129764,1129797,1130077,1130084,1130632,1130895,1131030,1131272,1132546,1132664,1132860,1132928,1133741,1133752,1136371,1136397,1136844,1138787

Modified: db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/sql/GenericStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/sql/GenericStatement.java?rev=1138856&r1=1138855&r2=1138856&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/sql/GenericStatement.java (original)
+++ db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/sql/GenericStatement.java Thu Jun 23 12:43:45 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/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java?rev=1138856&r1=1138855&r2=1138856&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java (original)
+++ db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ProcedureTest.java Thu Jun 23 12:43:45 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.
      */