Author: jolee
Date: 2014-08-26 09:46:34 -0400 (Tue, 26 Aug 2014)
New Revision: 4654
Modified:
branches/7.7.x/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java
branches/7.7.x/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java
Log:
TEIID-3049 fix for odbc disabled local txn commit
Conflicts:
test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java
Conflicts:
runtime/src/test/java/org/teiid/runtime/TestEmbeddedServer.java
test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java
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-08-26
13:46:27 UTC (rev 4653)
+++ branches/7.7.x/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java 2014-08-26
13:46:34 UTC (rev 4654)
@@ -355,13 +355,9 @@
}
void beginLocalTxnIfNeeded() throws SQLException {
- if (this.transactionXid != null || inLocalTxn || this.autoCommitFlag) {
+ if (this.transactionXid != null || inLocalTxn || this.autoCommitFlag ||
isDisableLocalTxn()) {
return;
}
- String prop =
this.propInfo.getProperty(ExecutionProperties.DISABLE_LOCAL_TRANSACTIONS);
- if (prop != null && Boolean.valueOf(prop)) {
- return;
- }
try {
try {
this.dqp.begin();
@@ -374,7 +370,12 @@
autoCommitFlag = true;
}
}
- }
+ }
+
+ private boolean isDisableLocalTxn() {
+ String prop =
this.propInfo.getProperty(ExecutionProperties.DISABLE_LOCAL_TRANSACTIONS);
+ return prop != null && Boolean.valueOf(prop);
+ }
public StatementImpl createStatement() throws SQLException {
return createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
@@ -678,6 +679,10 @@
}
this.autoCommitFlag = true;
+
+ if (isDisableLocalTxn()) {
+ return ResultsFuture.NULL_FUTURE;
+ }
try {
if (commit) {
Modified:
branches/7.7.x/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java
===================================================================
---
branches/7.7.x/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java 2014-08-26
13:46:27 UTC (rev 4653)
+++
branches/7.7.x/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java 2014-08-26
13:46:34 UTC (rev 4654)
@@ -312,57 +312,12 @@
}
// this does not work as JDBC always sends the queries in prepared form
- //public void testPgDeclareCursor() throws Exception {
- /*
- @Test public void testCursor() throws Exception {
+ public void testPgDeclareCursor() throws Exception {
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("begin;declare \"foo\" cursor for
select * from pg_proc;fetch 10 in \"foo\"; close \"foo\"");
rs.next();
}
-
- @Test public void testScrollCursor() throws Exception {
- Statement stmt = conn.createStatement();
- ExtendedQueryExectutorImpl.simplePortal = "foo";
- try {
- assertFalse(stmt.execute("declare \"foo\" insensitive scroll cursor for
select * from pg_proc;"));
- assertFalse(stmt.execute("move 5 in \"foo\""));
- stmt.execute("fetch 10 in \"foo\"");
- ResultSet rs = stmt.getResultSet();
- int rowCount = 0;
- while (rs.next()) {
- rowCount++;
- }
- assertEquals(6, rowCount);
- stmt.execute("close \"foo\"");
- } finally {
- ExtendedQueryExectutorImpl.simplePortal = null;
- }
-
- }
-
-
- @Test public void testScrollCursorWithHold() throws Exception {
- Statement stmt = conn.createStatement();
- ExtendedQueryExectutorImpl.simplePortal = "foo";
- try {
- assertFalse(stmt.execute("declare \"foo\" insensitive scroll cursor
with hold for select * from pg_proc;"));
- assertFalse(stmt.execute("move 5 in \"foo\""));
- stmt.execute("fetch 10 in \"foo\"");
- ResultSet rs = stmt.getResultSet();
- int rowCount = 0;
- while (rs.next()) {
- rowCount++;
- }
- assertEquals(6, rowCount);
- stmt.execute("close \"foo\"");
- } finally {
- ExtendedQueryExectutorImpl.simplePortal = null;
- }
-
- }
- */
-
@Test public void testPgProcedure() throws Exception {
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("select has_function_privilege(100,
'foo')");
Show replies by date