db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r389648 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java
Date Wed, 29 Mar 2006 01:14:57 GMT
Author: djd
Date: Tue Mar 28 17:14:56 2006
New Revision: 389648

URL: http://svn.apache.org/viewcvs?rev=389648&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.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java?rev=389648&r1=389647&r2=389648&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java
Tue Mar 28 17:14:56 2006
@@ -806,6 +806,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());
             
@@ -820,6 +821,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());
                         
@@ -833,7 +839,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
@@ -843,6 +854,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());
  
@@ -856,6 +868,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());
             
@@ -869,7 +886,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
@@ -908,6 +930,14 @@
                 TestUtil.dumpSQLExceptions(e, true);
             }
             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
@@ -924,6 +954,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
@@ -936,6 +973,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 {
@@ -945,6 +989,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
             // or create a statement with holdable.



Mime
View raw message