Rework handling of missing stream object for copy ops
This version works better (doesn't throw) but also doesn't report any error, which is not good
This commit is contained in:
parent
de9d5e3cd5
commit
a39e0d7cc9
13
lib/query.js
13
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;
|
||||
|
Loading…
Reference in New Issue
Block a user