[teiid-commits] teiid SVN: r4638 - in branches/7.7.x: client/src/main/java/org/teiid/jdbc and 1 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Thu May 1 11:58:50 EDT 2014


Author: jolee
Date: 2014-05-01 11:58:50 -0400 (Thu, 01 May 2014)
New Revision: 4638

Modified:
   branches/7.7.x/build/kits/jboss-container/teiid-releasenotes.html
   branches/7.7.x/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java
   branches/7.7.x/client/src/test/java/org/teiid/jdbc/TestStatement.java
Log:
BZ1054940 - Roll up patch EDS_5.3.1_1_2014 + TEIID-2945 allowing disableLocalTxn to work via a set statement

Modified: branches/7.7.x/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- branches/7.7.x/build/kits/jboss-container/teiid-releasenotes.html	2014-04-24 12:09:46 UTC (rev 4637)
+++ branches/7.7.x/build/kits/jboss-container/teiid-releasenotes.html	2014-05-01 15:58:50 UTC (rev 4638)
@@ -256,6 +256,8 @@
 </li>
 <li>[<a href='https://issues.jboss.org/browse/TEIID-2931'>TEIID-2931</a>] - Perform equi-join full outer joins in a streaming manner
 </li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-2945'>TEIID-2945</a>] - disableLocalTxn only works at connection time
+</li>
 </ul>
 <h4>From 7.7.9</h4>
 <ul>

Modified: branches/7.7.x/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java
===================================================================
--- branches/7.7.x/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java	2014-04-24 12:09:46 UTC (rev 4637)
+++ branches/7.7.x/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java	2014-05-01 15:58:50 UTC (rev 4638)
@@ -88,7 +88,6 @@
     //  Flag to represent if the connection state needs to be readOnly, default value false.
     private boolean readOnly = false;
     
-    private boolean disableLocalTransactions = false;
     private DQP dqp;
     protected ServerConnection serverConn;
     private int transactionIsolation = DEFAULT_ISOLATION;
@@ -112,8 +111,6 @@
         logConnectionProperties(url, info);
         
         setExecutionProperties(info);
-        
-        this.disableLocalTransactions = Boolean.valueOf(this.propInfo.getProperty(ExecutionProperties.DISABLE_LOCAL_TRANSACTIONS)).booleanValue();
     }
     
     boolean isInLocalTxn() {
@@ -358,8 +355,12 @@
     }
 
     void beginLocalTxnIfNeeded() throws SQLException {
-        if (this.transactionXid != null || inLocalTxn || this.autoCommitFlag || disableLocalTransactions) {
+        if (this.transactionXid != null || inLocalTxn || this.autoCommitFlag) {
         	return;
+        }
+        String prop = this.propInfo.getProperty(ExecutionProperties.DISABLE_LOCAL_TRANSACTIONS);
+        if (prop != null && Boolean.valueOf(prop)) {
+        	return;
         }
         try {
         	try {

Modified: branches/7.7.x/client/src/test/java/org/teiid/jdbc/TestStatement.java
===================================================================
--- branches/7.7.x/client/src/test/java/org/teiid/jdbc/TestStatement.java	2014-04-24 12:09:46 UTC (rev 4637)
+++ branches/7.7.x/client/src/test/java/org/teiid/jdbc/TestStatement.java	2014-05-01 15:58:50 UTC (rev 4638)
@@ -38,6 +38,7 @@
 import org.teiid.client.RequestMessage;
 import org.teiid.client.ResultsMessage;
 import org.teiid.client.util.ResultsFuture;
+import org.teiid.net.ServerConnection;
 
 @SuppressWarnings("nls")
 public class TestStatement {
@@ -113,6 +114,23 @@
 		assertFalse(statement.execute("rollback")); //$NON-NLS-1$
 		Mockito.verify(conn).rollback(false);
 	}
+	
+	@Test public void testDisableLocalTransations() throws Exception {
+		ServerConnection mock = Mockito.mock(ServerConnection.class);
+		Mockito.stub(mock.getService(DQP.class)).toReturn(Mockito.mock(DQP.class));
+		ConnectionImpl conn = new ConnectionImpl(mock, new Properties(), "x");
+		StatementImpl statement = new StatementImpl(conn, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
+		assertTrue(conn.getAutoCommit());
+		statement.execute("set disablelocaltxn true");
+		assertFalse(statement.execute("start transaction")); //$NON-NLS-1$
+		conn.beginLocalTxnIfNeeded();
+		assertFalse(conn.isInLocalTxn());
+		
+		statement.execute("set disablelocaltxn false");
+		assertFalse(statement.execute("start transaction")); //$NON-NLS-1$
+		conn.beginLocalTxnIfNeeded();
+		assertTrue(conn.isInLocalTxn());
+	}
 
 	@SuppressWarnings("unchecked")
 	@Test public void testTransactionStatementsAsynch() throws Exception {



More information about the teiid-commits mailing list