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 dj...@apache.org on 2006/04/07 20:29:19 UTC
svn commit: r392358 -
/db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java
Author: djd
Date: Fri Apr 7 11:29:19 2006
New Revision: 392358
URL: http://svn.apache.org/viewcvs?rev=392358&view=rev
Log:
DERBY-1159 Add some test cases that show the bug. Execution of a statement that
does not return a ResultSet with various JDBC Statement objects using executeUpdate
in a global transaction.
Merge from 389648 from trunk.
Modified:
db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java
Modified: db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java
URL: http://svn.apache.org/viewcvs/db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java?rev=392358&r1=392357&r2=392358&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java (original)
+++ db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java Fri Apr 7 11:29:19 2006
@@ -803,6 +803,7 @@
showHoldStatus("Local(held) default ", sdh);
checkHeldRS(conn, sdh, sdh.executeQuery("select * from app.foo"));
PreparedStatement psdh = conn.prepareStatement("SELECT * FROM APP.FOO");
+ PreparedStatement psdh_d = conn.prepareStatement("DELETE FROM APP.FOO WHERE A < -99");
showHoldStatus("Local(held) default Prepared", psdh);
checkHeldRS(conn, psdh, psdh.executeQuery());
@@ -817,6 +818,11 @@
ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY,
ResultSet.HOLD_CURSORS_OVER_COMMIT);
+ PreparedStatement pshh_d =
+ conn.prepareStatement("DELETE FROM APP.FOO WHERE A < -99",
+ ResultSet.TYPE_FORWARD_ONLY,
+ ResultSet.CONCUR_READ_ONLY,
+ ResultSet.HOLD_CURSORS_OVER_COMMIT);
showHoldStatus("Local(held) held Prepared", pshh);
checkHeldRS(conn, pshh, pshh.executeQuery());
@@ -830,7 +836,12 @@
ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY,
ResultSet.CLOSE_CURSORS_AT_COMMIT);
- showHoldStatus("Local(held) close Prepared", psch);
+ PreparedStatement psch_d =
+ conn.prepareStatement("DELETE FROM APP.FOO WHERE A < -99",
+ ResultSet.TYPE_FORWARD_ONLY,
+ ResultSet.CONCUR_READ_ONLY,
+ ResultSet.CLOSE_CURSORS_AT_COMMIT);
+ showHoldStatus("Local(held) close Prepared", psch);
checkHeldRS(conn, psch, psch.executeQuery());
// set the connection's holdabilty to false
@@ -840,6 +851,7 @@
showHoldStatus("Local(close) default ", sdc);
checkHeldRS(conn, sdc, sdc.executeQuery("select * from app.foo"));
PreparedStatement psdc = conn.prepareStatement("SELECT * FROM APP.FOO");
+ PreparedStatement psdc_d = conn.prepareStatement("DELETE FROM APP.FOO WHERE A < -99");
showHoldStatus("Local(close) default Prepared", psdc);
checkHeldRS(conn, psdc, psdc.executeQuery());
@@ -853,6 +865,11 @@
ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY,
ResultSet.HOLD_CURSORS_OVER_COMMIT);
+ PreparedStatement pshc_d =
+ conn.prepareStatement("DELETE FROM APP.FOO WHERE A < -99",
+ ResultSet.TYPE_FORWARD_ONLY,
+ ResultSet.CONCUR_READ_ONLY,
+ ResultSet.HOLD_CURSORS_OVER_COMMIT);
showHoldStatus("Local(close) held Prepared", pshc);
checkHeldRS(conn, pshc, pshc.executeQuery());
@@ -866,7 +883,12 @@
ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY,
ResultSet.CLOSE_CURSORS_AT_COMMIT);
- showHoldStatus("Local(close) close Prepared", pscc);
+ PreparedStatement pscc_d =
+ conn.prepareStatement("DELETE FROM APP.FOO WHERE A < -99",
+ ResultSet.TYPE_FORWARD_ONLY,
+ ResultSet.CONCUR_READ_ONLY,
+ ResultSet.CLOSE_CURSORS_AT_COMMIT);
+ showHoldStatus("Local(close) close Prepared", pscc);
checkHeldRS(conn, pscc, pscc.executeQuery());
// Revert back to holdable
@@ -898,6 +920,14 @@
shh.executeQuery("SELECT * FROM APP.FOO").close();
}
sch.executeQuery("SELECT * FROM APP.FOO").close();
+
+ // Statements not returning ResultSet's should be ok
+ if (!TestUtil.isDerbyNetClientFramework()) { // DERBY-1159
+ sdh.executeUpdate("DELETE FROM APP.FOO where A < -99");
+ shh.executeUpdate("DELETE FROM APP.FOO where A < -99");
+ sch.executeUpdate("DELETE FROM APP.FOO where A < -99");
+ }
+
// PreparedStatements obtained while default was hold.
// Only sch should work as held cursors not supported in XA
@@ -914,6 +944,13 @@
TestUtil.dumpSQLExceptions(e, true);
}
psch.executeQuery().close();
+
+ // Statements not returning ResultSet's should be ok
+ if (!TestUtil.isDerbyNetClientFramework()) { // DERBY-1159
+ psdh_d.executeUpdate();
+ pshh_d.executeUpdate();
+ psch_d.executeUpdate();
+ }
// Statements obtained while default was close.
// Only sch should work as held cursors not supported in XA
@@ -923,6 +960,13 @@
}
scc.executeQuery("SELECT * FROM APP.FOO").close();
+ // Statements not returning ResultSet's should be ok
+ if (!TestUtil.isDerbyNetClientFramework()) { // DERBY-1159
+ sdc.executeUpdate("DELETE FROM APP.FOO where A < -99");
+ shc.executeUpdate("DELETE FROM APP.FOO where A < -99");
+ scc.executeUpdate("DELETE FROM APP.FOO where A < -99");
+ }
+
// PreparedStatements obtained while default was close.
psdc.executeQuery().close();
try {
@@ -932,6 +976,14 @@
TestUtil.dumpSQLExceptions(e, true);
}
pscc.executeQuery().close();
+
+ // Statements not returning ResultSet's should be ok
+ if (!TestUtil.isDerbyNetClientFramework()) { // DERBY-1159
+ psdc_d.executeUpdate();
+ pshc_d.executeUpdate();
+ pscc_d.executeUpdate();
+ }
+
// Test we cannot switch the connection to holdable
try {