[teiid-commits] teiid SVN: r3122 - in trunk: test-integration/common/src/test/java/org/teiid/transport and 1 other directories.
teiid-commits at lists.jboss.org
teiid-commits at lists.jboss.org
Tue Apr 26 16:04:35 EDT 2011
Author: rareddy
Date: 2011-04-26 16:04:35 -0400 (Tue, 26 Apr 2011)
New Revision: 3122
Added:
trunk/test-integration/common/src/test/resources/TestODBCSocketTransport/testPkPrepared.expected
Modified:
trunk/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java
trunk/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java
Log:
TEIID-1532: The ODBC driver in the case of the prepared statement send "execute;close;sync" in a single input message block. when executing in asynch these can get out order and fail. This addresses the issue.
Modified: trunk/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java 2011-04-26 15:12:52 UTC (rev 3121)
+++ trunk/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java 2011-04-26 20:04:35 UTC (rev 3122)
@@ -297,6 +297,9 @@
} catch (Throwable e) {
client.errorOccurred(e);
}
+ if (query.closeRequested) {
+ closeBoundStatement(query.name);
+ }
ready(false);
}
});
@@ -520,7 +523,16 @@
if (bindName == null || bindName.length() == 0) {
bindName = UNNAMED;
}
- Portal query = this.portalMap.remove(bindName);
+ Portal query = this.portalMap.get(bindName);
+ if (query != null) {
+ if (this.executionFuture != null) {
+ synchronized(query) {
+ query.closeRequested = true;
+ }
+ return;
+ }
+ }
+ query = this.portalMap.remove(bindName);
if (query == null) {
this.client.errorOccurred(RuntimePlugin.Util.getString("not_bound", bindName)); //$NON-NLS-1$
}
@@ -671,6 +683,7 @@
QueryWorkItem.this.run(); //continue processing
}
});
+ ready(false);
return; //wait for the execution to finish
} catch (SQLException e) {
client.errorOccurred(e);
@@ -680,7 +693,7 @@
} catch(IOException e) {
client.errorOccurred(e);
}
- ready(false);
+ sync();
}
}
@@ -751,6 +764,8 @@
* The prepared statement.
*/
PreparedStatementImpl stmt;
+
+ boolean closeRequested;
}
Modified: trunk/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java 2011-04-26 15:12:52 UTC (rev 3121)
+++ trunk/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java 2011-04-26 20:04:35 UTC (rev 3122)
@@ -27,6 +27,7 @@
import java.net.InetSocketAddress;
import java.nio.charset.Charset;
import java.sql.Connection;
+import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Properties;
@@ -133,6 +134,14 @@
TestMMDatabaseMetaData.compareResultSet(rs);
}
+ @Test public void testPkPrepared() throws Exception {
+ PreparedStatement stmt = conn.prepareStatement("select ta.attname, ia.attnum, ic.relname, n.nspname, tc.relname " +//$NON-NLS-1$
+ "from pg_catalog.pg_attribute ta, pg_catalog.pg_attribute ia, pg_catalog.pg_class tc, pg_catalog.pg_index i, " +//$NON-NLS-1$
+ "pg_catalog.pg_namespace n, pg_catalog.pg_class ic where tc.relname = E'pg_attribute' AND n.nspname = E'pg_catalog'");
+ ResultSet rs = stmt.executeQuery();
+ TestMMDatabaseMetaData.compareResultSet(rs);
+ }
+
@Test public void testEscapedLiteral() throws Exception {
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("select E'\\n\\thello pg'");
Added: trunk/test-integration/common/src/test/resources/TestODBCSocketTransport/testPkPrepared.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestODBCSocketTransport/testPkPrepared.expected (rev 0)
+++ trunk/test-integration/common/src/test/resources/TestODBCSocketTransport/testPkPrepared.expected 2011-04-26 20:04:35 UTC (rev 3122)
@@ -0,0 +1,10 @@
+varchar int2 varchar varchar varchar
+name attnum tablename schemaname tablename
+oid 1 pg_attribute pg_catalog pg_attribute
+Row Count : 1
+getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
+name 12 java.lang.String name varchar 2147483647 0 0 false true false false 0 false true false true
+attnum 5 java.lang.Integer attnum int2 6 5 0 false false false false 2 false true true true
+tablename 12 java.lang.String tablename varchar 2147483647 0 0 false true false false 0 false true false true
+schemaname 12 java.lang.String schemaname varchar 2147483647 0 0 false true false false 1 false true false true
+tablename 12 java.lang.String tablename varchar 2147483647 0 0 false true false false 0 false true false true
More information about the teiid-commits
mailing list