Skip to content

Commit 0b2344b

Browse files
committed
Remove COPY TO / COPY FROM
1 parent 2de9838 commit 0b2344b

File tree

4 files changed

+4
-463
lines changed

4 files changed

+4
-463
lines changed

lib/client.js

+4-36
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ var ConnectionParameters = require(__dirname + '/connection-parameters');
77
var Query = require(__dirname + '/query');
88
var defaults = require(__dirname + '/defaults');
99
var Connection = require(__dirname + '/connection');
10-
var CopyFromStream = require(__dirname + '/copystream').CopyFromStream;
11-
var CopyToStream = require(__dirname + '/copystream').CopyToStream;
1210

1311
var Client = function(config) {
1412
EventEmitter.call(this);
@@ -121,17 +119,6 @@ Client.prototype.connect = function(callback) {
121119
self.activeQuery.handleCopyInResponse(self.connection);
122120
});
123121

124-
con.on('copyOutResponse', function(msg) {
125-
if(self.activeQuery.stream === undefined) {
126-
self.activeQuery._canceledDueToError = new Error('No destination stream defined');
127-
//canceling query requires creation of new connection
128-
//look for postgres frontend/backend protocol
129-
//TODO - this needs to die/be refactored
130-
(new self.constructor({port: self.port, host: self.host}))
131-
.cancel(self, self.activeQuery);
132-
}
133-
});
134-
135122
con.on('copyData', function (msg) {
136123
self.activeQuery.handleCopyData(msg, self.connection);
137124
});
@@ -200,9 +187,8 @@ Client.prototype.getStartupConf = function() {
200187
var params = this.connectionParameters;
201188

202189
var data = {
203-
user : params.user ,
204-
database : params.database
205-
// client_encoding : "'".concat(params.client_encoding).concat("'")
190+
user: params.user,
191+
database: params.database
206192
};
207193

208194
var appName = params.application_name || params.fallback_application_name;
@@ -292,30 +278,12 @@ Client.prototype._pulseQueryQueue = function() {
292278
}
293279
};
294280

295-
Client.prototype._copy = function (text, stream) {
296-
var config = {};
297-
config.text = text;
298-
config.stream = stream;
299-
config.callback = function (error) {
300-
if(error) {
301-
config.stream.error(error);
302-
} else {
303-
config.stream.close();
304-
}
305-
};
306-
var query = new Query(config);
307-
this.queryQueue.push(query);
308-
this._pulseQueryQueue();
309-
return config.stream;
310-
311-
};
312-
313281
Client.prototype.copyFrom = function (text) {
314-
return this._copy(text, new CopyFromStream());
282+
throw new Error("For PostgreSQL COPY TO/COPY FROM support npm install pg-copy-streams");
315283
};
316284

317285
Client.prototype.copyTo = function (text) {
318-
return this._copy(text, new CopyToStream());
286+
throw new Error("For PostgreSQL COPY TO/COPY FROM support npm install pg-copy-streams");
319287
};
320288

321289
Client.prototype.query = function(config, values, callback) {

lib/copystream.js

-206
This file was deleted.

test/unit/copystream/copyfrom-tests.js

-99
This file was deleted.

0 commit comments

Comments
 (0)