Cleanly handle missing stream error on COPY operation. Closes #241

This commit is contained in:
Sandro Santilli 2013-01-16 10:11:55 +01:00
parent 21c31f69e6
commit de9d5e3cd5

View File

@ -170,9 +170,11 @@ p.prepare = function(connection) {
this.getRows(connection);
};
p.streamData = function (connection) {
this.stream.startStreamingToConnection(connection);
if ( this.stream ) this.stream.startStreamingToConnection(connection);
else this.handleError(new Error('No destination stream defined'));
};
p.handleCopyFromChunk = function (chunk) {
this.stream.handleChunk(chunk);
if ( this.stream ) this.stream.handleChunk(chunk);
else this.handleError(new Error('error', 'No source stream defined'));
}
module.exports = Query;