Skip to content

Commit ff2f9b6

Browse files
author
Dave Cramer
committed
fixed cancel query bug introduced by patch
1 parent b7cc409 commit ff2f9b6

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

src/interfaces/jdbc/org/postgresql/Connection.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import org.postgresql.core.*;
1212

1313
/*
14-
* $Id: Connection.java,v 1.41 2002/02/26 02:15:54 davec Exp $
14+
* $Id: Connection.java,v 1.42 2002/03/05 18:00:36 davec Exp $
1515
*
1616
* This abstract class is used by org.postgresql.Driver to open either the JDBC1 or
1717
* JDBC2 versions of the Connection class.
@@ -315,16 +315,6 @@ protected void openConnection(String host, int port, Properties info, String dat
315315
switch (beresp)
316316
{
317317
case 'Z':
318-
319-
try
320-
{
321-
pg_stream.SendChar('Q');
322-
pg_stream.SendChar(' ');
323-
pg_stream.SendChar(0);
324-
pg_stream.flush();
325-
} catch (IOException e) {
326-
throw new PSQLException("postgresql.con.ioerror",e);
327-
}
328318
break;
329319
case 'E':
330320
case 'N':

src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* <p>The lifetime of a QueryExecutor object is from sending the query
1414
* until the response has been received from the backend.
1515
*
16-
* $Id: QueryExecutor.java,v 1.6 2001/11/25 23:26:56 barry Exp $
16+
* $Id: QueryExecutor.java,v 1.7 2002/03/05 18:01:27 davec Exp $
1717
*/
1818

1919
public class QueryExecutor
@@ -57,6 +57,7 @@ public java.sql.ResultSet execute() throws SQLException
5757

5858
int fqp = 0;
5959
boolean hfr = false;
60+
int lastMessage = 0;
6061

6162
synchronized (pg_stream)
6263
{
@@ -112,11 +113,26 @@ public java.sql.ResultSet execute() throws SQLException
112113
receiveFields();
113114
break;
114115
case 'Z': // backend ready for query, ignore for now :-)
116+
if ( lastMessage == 'Z' )
117+
{
118+
try
119+
{
120+
pg_stream.SendChar('Q');
121+
pg_stream.SendChar(' ');
122+
pg_stream.SendChar(0);
123+
pg_stream.flush();
124+
} catch (IOException e) {
125+
throw new PSQLException("postgresql.con.ioerror",e);
126+
}
127+
fqp++;
128+
}
129+
115130
break;
116131
default:
117132
throw new PSQLException("postgresql.con.type",
118133
new Character((char) c));
119134
}
135+
lastMessage = c;
120136
}
121137
return connection.getResultSet(connection, statement, fields, tuples, status, update_count, insert_oid, binaryCursor);
122138
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy