mirror of
https://github.com/brianc/node-postgres.git
synced 2026-01-25 16:03:13 +00:00
Send backend a CopyFail when no stream is defined to copy from
This commit is contained in:
parent
a39e0d7cc9
commit
2fc22de21a
@ -267,6 +267,11 @@ p.sendCopyFromChunk = function (chunk) {
|
||||
p.endCopyFrom = function () {
|
||||
this.stream.write(this.writer.add(emptyBuffer).flush(0x63));
|
||||
}
|
||||
p.sendCopyFail = function (msg) {
|
||||
//this.stream.write(this.writer.add(emptyBuffer).flush(0x66));
|
||||
this.writer.addCString(msg);
|
||||
this._send(0x66);
|
||||
}
|
||||
//parsing methods
|
||||
p.setBuffer = function(buffer) {
|
||||
if(this.lastBuffer) { //we have unfinished biznaz
|
||||
|
||||
@ -171,11 +171,7 @@ p.prepare = function(connection) {
|
||||
};
|
||||
p.streamData = function (connection) {
|
||||
if ( this.stream ) this.stream.startStreamingToConnection(connection);
|
||||
else {
|
||||
connection.endCopyFrom(); // send an EOF to connection
|
||||
// TODO: signal the problem somehow
|
||||
//this.handleError(new Error('No source stream defined'));
|
||||
}
|
||||
else connection.sendCopyFail('No source stream defined');
|
||||
};
|
||||
p.handleCopyFromChunk = function (chunk) {
|
||||
if ( this.stream ) this.stream.handleChunk(chunk);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user