aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Cramer <davec@fastcrypt.com>2002-03-05 18:01:27 +0000
committerDave Cramer <davec@fastcrypt.com>2002-03-05 18:01:27 +0000
commitff2f9b663f73b020cc5f8fa05d848a6f6d33c6ac (patch)
tree80e4f647bc8ad6a673803c62c9bdf622fe0ba577
parentb7cc409f7f5e81628a2c62da15f013ec33714392 (diff)
downloadpostgresql-ff2f9b663f73b020cc5f8fa05d848a6f6d33c6ac.tar.gz
postgresql-ff2f9b663f73b020cc5f8fa05d848a6f6d33c6ac.zip
fixed cancel query bug introduced by patch
-rw-r--r--src/interfaces/jdbc/org/postgresql/Connection.java12
-rw-r--r--src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java18
2 files changed, 18 insertions, 12 deletions
diff --git a/src/interfaces/jdbc/org/postgresql/Connection.java b/src/interfaces/jdbc/org/postgresql/Connection.java
index 4bdf684a608..af507303ddf 100644
--- a/src/interfaces/jdbc/org/postgresql/Connection.java
+++ b/src/interfaces/jdbc/org/postgresql/Connection.java
@@ -11,7 +11,7 @@ import org.postgresql.util.*;
import org.postgresql.core.*;
/*
- * $Id: Connection.java,v 1.41 2002/02/26 02:15:54 davec Exp $
+ * $Id: Connection.java,v 1.42 2002/03/05 18:00:36 davec Exp $
*
* This abstract class is used by org.postgresql.Driver to open either the JDBC1 or
* JDBC2 versions of the Connection class.
@@ -315,16 +315,6 @@ public abstract class Connection
switch (beresp)
{
case 'Z':
-
- try
- {
- pg_stream.SendChar('Q');
- pg_stream.SendChar(' ');
- pg_stream.SendChar(0);
- pg_stream.flush();
- } catch (IOException e) {
- throw new PSQLException("postgresql.con.ioerror",e);
- }
break;
case 'E':
case 'N':
diff --git a/src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java b/src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java
index aad95f1e4b7..4bac6413db4 100644
--- a/src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java
+++ b/src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java
@@ -13,7 +13,7 @@ import org.postgresql.util.PSQLException;
* <p>The lifetime of a QueryExecutor object is from sending the query
* until the response has been received from the backend.
*
- * $Id: QueryExecutor.java,v 1.6 2001/11/25 23:26:56 barry Exp $
+ * $Id: QueryExecutor.java,v 1.7 2002/03/05 18:01:27 davec Exp $
*/
public class QueryExecutor
@@ -57,6 +57,7 @@ public class QueryExecutor
int fqp = 0;
boolean hfr = false;
+ int lastMessage = 0;
synchronized (pg_stream)
{
@@ -112,11 +113,26 @@ public class QueryExecutor
receiveFields();
break;
case 'Z': // backend ready for query, ignore for now :-)
+ if ( lastMessage == 'Z' )
+ {
+ try
+ {
+ pg_stream.SendChar('Q');
+ pg_stream.SendChar(' ');
+ pg_stream.SendChar(0);
+ pg_stream.flush();
+ } catch (IOException e) {
+ throw new PSQLException("postgresql.con.ioerror",e);
+ }
+ fqp++;
+ }
+
break;
default:
throw new PSQLException("postgresql.con.type",
new Character((char) c));
}
+ lastMessage = c;
}
return connection.getResultSet(connection, statement, fields, tuples, status, update_count, insert_oid, binaryCursor);
}