bugfix: correctly create new connection for canceling copy to query

This commit is contained in:
anton 2013-01-18 13:55:35 +02:00 committed by bmc
parent c5c31143c1
commit 8ea2f259ed
2 changed files with 4 additions and 2 deletions

View File

@ -111,7 +111,9 @@ p.connect = function(callback) {
con.on('copyOutResponse', function(msg) {
if (self.activeQuery.stream === undefined) {
self.activeQuery._canceledDueToError = new Error('No destination stream defined');
(new self.constructor(self.config)).cancel(self, self.activeQuery);
//canceling query requires creation of new connection
//look for postgres frontend/backend protocol
(new self.constructor({port: self.port, host: self.host})).cancel(self, self.activeQuery);
}
});
con.on('copyData', function (msg) {

View File

@ -203,7 +203,7 @@ var clientBuilder = function(config) {
connection.on('copyOutResponse', function(msg) {
if (connection._activeQuery.stream === undefined) {
connection._activeQuery._canceledDueToError = new Error('No destination stream defined');
(new clientBuilder(connection.config)).cancel(connection, connection._activeQuery);
(new clientBuilder({port: connection.port, host: connection.host})).cancel(connection, connection._activeQuery);
}
});
connection.on('copyData', function (chunk) {