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/02/15 18:36:53 UTC
svn commit: r628130 - in
/db/derby/code/trunk/java/testing/org/apache/derbyTesting:
functionTests/tests/lang/LangProcedureTest.java junit/JDBC.java
Author: mamta
Date: Fri Feb 15 09:36:50 2008
New Revision: 628130
URL: http://svn.apache.org/viewvc?rev=628130&view=rev
Log:
DERBY-3304
DERBY-3037
DERBY-1585
I am adding a test case to check for the resultset from the java procedure call when the
java procedure has done a rollback inside it. This test shows that in trunk, after checkin
602991 for DERBY-1585, a procedure does not return a resultset if there was a rollbck
inside the procedure with resultset creation before rollback. This behavior is different
than what happens in 10.2 codeline. In 10.2, a procedure will return a *closed* resultset
if there was a rollback inside the procedure. But a procedure should not return closed
result sets, so it appears that trunk is behaving correctly and 10.2's behavior was
incorrect.
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/LangProcedureTest.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.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=628130&r1=628129&r2=628130&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 Fri Feb 15 09:36:50 2008
@@ -802,6 +802,12 @@
drs1 = prepareCall("CALL procWithRollback(3)");
drs1.execute();
rs = drs1.getResultSet();
+ //Following shows that the rollback inside the java procedure will
+ //cuase procedure to return no resultset (A procedure does
+ //not return closed resultsets). In 10.2 codeline though, java
+ //procedure returns a closed resultset if there is a rollback
+ //inside the java procedure.
+ JDBC.assertNoMoreResults(drs1);
JDBC.assertClosed(rs1);
JDBC.assertClosed(resultSet);
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java?rev=628130&r1=628129&r2=628130&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java Fri Feb 15 09:36:50 2008
@@ -523,15 +523,17 @@
}
/**
- * Assert that the statement has no more results. Logic taken
- * from javadoc for java.sql.Statement.getMoreResults.
+ * Assert that the statement has no more results(getMoreResults) and it
+ * indeed does not return any resultsets(by checking getResultSet).
+ * Also, ensure that update count is -1.
* @param s Statement holding no results.
* @throws SQLException Exception checking results.
*/
public static void assertNoMoreResults(Statement s) throws SQLException
{
- Assert.assertTrue((s.getMoreResults() == false)
- && (s.getUpdateCount() == -1));
+ Assert.assertFalse(s.getMoreResults());
+ Assert.assertTrue(s.getUpdateCount() == -1);
+ Assert.assertNull(s.getResultSet());
}
/**