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 km...@apache.org on 2006/04/15 02:09:22 UTC

svn commit: r394230 - in /db/derby/code/branches/10.1/java: client/org/apache/derby/client/net/ testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/ testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/

Author: kmarsden
Date: Fri Apr 14 17:09:13 2006
New Revision: 394230

URL: http://svn.apache.org/viewcvs?rev=394230&view=rev
Log:
DERBY-1025 [xa] client XAResource.start() does not commit an active local transaction when auto commit is true

Contributed by Deepa Remesh
port from trunk


Modified:
    db/derby/code/branches/10.1/java/client/org/apache/derby/client/net/NetXAResource.java
    db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/XATest.out
    db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java

Modified: db/derby/code/branches/10.1/java/client/org/apache/derby/client/net/NetXAResource.java
URL: http://svn.apache.org/viewcvs/db/derby/code/branches/10.1/java/client/org/apache/derby/client/net/NetXAResource.java?rev=394230&r1=394229&r2=394230&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/client/org/apache/derby/client/net/NetXAResource.java (original)
+++ db/derby/code/branches/10.1/java/client/org/apache/derby/client/net/NetXAResource.java Fri Apr 14 17:09:13 2006
@@ -551,6 +551,17 @@
         if (conn_.isPhysicalConnClosed()) {
             connectionClosedFailure();
         }
+        
+        // DERBY-1025 - Flow an auto-commit if in auto-commit mode before 
+        // entering a global transaction
+        try {
+        	if(conn_.autoCommit_)
+        		conn_.flowAutoCommit();
+        } catch (SqlException sqle) {
+        	rc = XAException.XAER_RMERR;
+            exceptionsOnXA = org.apache.derby.client.am.Utils.accumulateSQLException
+                    (sqle, exceptionsOnXA);
+        } 
 
         // update the XACallInfo
         NetXACallInfo callInfo = callInfoArray_[conn_.currXACallInfoOffset_];

Modified: db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/XATest.out
URL: http://svn.apache.org/viewcvs/db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/XATest.out?rev=394230&r1=394229&r2=394230&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/XATest.out (original)
+++ db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/XATest.out Fri Apr 14 17:09:13 2006
@@ -183,7 +183,6 @@
 Non-held ResultSet correctly closed after commit
 BGBC 0
 BGAC 1
-DERBY-1025 Call conn.commit to avoid exception with client
 START GLOBAL TRANSACTION
 Global transaction open ResultSets 12
 EXPECTED SQLSTATE(XJ05C): Cannot set holdability ResultSet.HOLD_CURSORS_OVER_COMMIT for a global transaction.

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=394230&r1=394229&r2=394230&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 14 17:09:13 2006
@@ -900,16 +900,15 @@
             rs.next(); System.out.println("BGBC " + rs.getInt(1));
             conn.commit();
             rs.next(); System.out.println("BGAC " + rs.getInt(1));
-            
+            rs.close();
+           
+            // ensure a transaction is active to test DERBY-1025
+            rs = sdh.executeQuery("SELECT * FROM APP.FOO");
+           
             // This switch to global is ok because conn
             // is in auto-commit mode, thus the start performs
             // an implicit commit to complete the local transaction.
             
-            // DERBY-1025 Client only bug
-            if (TestUtil.isDerbyNetClientFramework()) {
-                System.out.println("DERBY-1025 Call conn.commit to avoid exception with client");
-                conn.commit();
-            }
             System.out.println("START GLOBAL TRANSACTION");
             // start a global xact and test those statements.
             xar.start(xid, XAResource.TMNOFLAGS);