@@ -7,8 +7,6 @@ var ConnectionParameters = require(__dirname + '/connection-parameters');
7
7
var Query = require ( __dirname + '/query' ) ;
8
8
var defaults = require ( __dirname + '/defaults' ) ;
9
9
var Connection = require ( __dirname + '/connection' ) ;
10
- var CopyFromStream = require ( __dirname + '/copystream' ) . CopyFromStream ;
11
- var CopyToStream = require ( __dirname + '/copystream' ) . CopyToStream ;
12
10
13
11
var Client = function ( config ) {
14
12
EventEmitter . call ( this ) ;
@@ -121,17 +119,6 @@ Client.prototype.connect = function(callback) {
121
119
self . activeQuery . handleCopyInResponse ( self . connection ) ;
122
120
} ) ;
123
121
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
-
135
122
con . on ( 'copyData' , function ( msg ) {
136
123
self . activeQuery . handleCopyData ( msg , self . connection ) ;
137
124
} ) ;
@@ -200,9 +187,8 @@ Client.prototype.getStartupConf = function() {
200
187
var params = this . connectionParameters ;
201
188
202
189
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
206
192
} ;
207
193
208
194
var appName = params . application_name || params . fallback_application_name ;
@@ -292,30 +278,12 @@ Client.prototype._pulseQueryQueue = function() {
292
278
}
293
279
} ;
294
280
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
-
313
281
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" ) ;
315
283
} ;
316
284
317
285
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" ) ;
319
287
} ;
320
288
321
289
Client . prototype . query = function ( config , values , callback ) {
0 commit comments