diff --git a/lib/query.js b/lib/query.js index 1185a2a..2f80411 100644 --- a/lib/query.js +++ b/lib/query.js @@ -17,7 +17,7 @@ var Query = function(config, values, callback) { this.types = config.types; this.name = config.name; this.binary = config.binary; - this.stream = config.stream; + this.stream = config.stream; //use unique portal name each time this.portal = config.portal || "" this.callback = config.callback; @@ -171,10 +171,17 @@ p.prepare = function(connection) { }; p.streamData = function (connection) { if ( this.stream ) this.stream.startStreamingToConnection(connection); - else this.handleError(new Error('No destination stream defined')); + else { + connection.endCopyFrom(); // send an EOF to connection + // TODO: signal the problem somehow + //this.handleError(new Error('No source stream defined')); + } }; p.handleCopyFromChunk = function (chunk) { if ( this.stream ) this.stream.handleChunk(chunk); - else this.handleError(new Error('error', 'No source stream defined')); + else { + // TODO: signal the problem somehow + //this.handleError(new Error('error', 'No destination stream defined')); + } } module.exports = Query;