Author: jolee
Date: 2012-03-16 17:10:45 -0400 (Fri, 16 Mar 2012)
New Revision: 3945
Modified:
branches/7.4.x/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java
branches/7.4.x/runtime/src/main/java/org/teiid/transport/PgBackendProtocol.java
Log:
TEIID-1973 (minor mod for backport) SQLFetch hangs after first batch returned when
odbc.ini property UseDeclareFetch=1 is used
Modified: branches/7.4.x/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java
===================================================================
---
branches/7.4.x/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java 2012-03-16
18:21:37 UTC (rev 3944)
+++
branches/7.4.x/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java 2012-03-16
21:10:45 UTC (rev 3945)
@@ -228,10 +228,12 @@
public void onCompletion(ResultsFuture<Boolean> future) {
executionFuture = null;
try {
- List<PgColInfo> cols =
getPgColInfo(stmt.getResultSet().getMetaData());
- cursorMap.put(cursorName, new Cursor(cursorName, sql, stmt,
null, stmt.getResultSet(), cols));
- client.sendCommandComplete("DECLARE CURSOR", 0); //$NON-NLS-1$
- completion.getResultsReceiver().receiveResults(0);
+ if (future.get()) {
+ List<PgColInfo> cols =
getPgColInfo(stmt.getResultSet().getMetaData());
+ cursorMap.put(cursorName, new Cursor(cursorName, sql, stmt,
null, stmt.getResultSet(), cols));
+ client.sendCommandComplete("DECLARE CURSOR", 0); //$NON-NLS-1$
+ completion.getResultsReceiver().receiveResults(0);
+ }
} catch (Throwable e) {
completion.getResultsReceiver().exceptionOccurred(e);
}
@@ -488,11 +490,12 @@
try {
int rowsSent = future.get();
if (rowsSent < cursor.fetchSize) {
- client.sendCommandComplete(cursor.sql, 0);
+ client.sendCommandComplete(cursor.sql, rowsSent);
}
else {
client.sendPortalSuspended();
}
+ doneExecuting();
} catch (InterruptedException e) {
throw new AssertionError(e);
} catch (ExecutionException e) {
@@ -749,10 +752,7 @@
preparedName = UNNAMED;
}
Prepared query = this.preparedMap.remove(preparedName);
- if (query == null) {
- errorOccurred(RuntimePlugin.Util.getString("no_stmt_found", preparedName));
//$NON-NLS-1$
- }
- else {
+ if (query != null) {
// Close all the bound messages off of this prepared
// TODO: can there be more than one?
this.portalMap.remove(preparedName);
Modified: branches/7.4.x/runtime/src/main/java/org/teiid/transport/PgBackendProtocol.java
===================================================================
---
branches/7.4.x/runtime/src/main/java/org/teiid/transport/PgBackendProtocol.java 2012-03-16
18:21:37 UTC (rev 3944)
+++
branches/7.4.x/runtime/src/main/java/org/teiid/transport/PgBackendProtocol.java 2012-03-16
21:10:45 UTC (rev 3945)
@@ -377,7 +377,7 @@
@Override
public void terminated() {
trace("channel being terminated");
- this.sendNoticeResponse("Connection closed");
+ // no need to send any reply; this is showing as malformed packet.
this.ctx.getChannel().close();
}
Show replies by date