Add resume

This commit is contained in:
Chris Kinsman 2015-12-16 16:43:22 -08:00
parent e1ce9a3948
commit 9d197a91e1

View File

@ -19,6 +19,7 @@ var eventTypes = ['close', 'data', 'end', 'error']
CopyStreamQuery.prototype.submit = function(connection) { CopyStreamQuery.prototype.submit = function(connection) {
connection.query(this.text) connection.query(this.text)
this.connection = connection this.connection = connection
this.connection.removeAllListeners('copyData')
connection.stream.pipe(this) connection.stream.pipe(this)
} }
@ -31,6 +32,8 @@ var code = {
CopyStreamQuery.prototype._detach = function() { CopyStreamQuery.prototype._detach = function() {
this.connection.stream.unpipe(this) this.connection.stream.unpipe(this)
// Unpipe can drop us out of flowing mode
this.connection.stream.resume()
} }