@@ -9,6 +9,7 @@ var defaults = require(__dirname + '/defaults');
9
9
var Connection = require ( __dirname + '/connection' ) ;
10
10
var CopyFromStream = require ( __dirname + '/copystream' ) . CopyFromStream ;
11
11
var CopyToStream = require ( __dirname + '/copystream' ) . CopyToStream ;
12
+
12
13
var Client = function ( config ) {
13
14
EventEmitter . call ( this ) ;
14
15
@@ -22,7 +23,7 @@ var Client = function(config) {
22
23
config = config || { } ;
23
24
24
25
this . connection = config . connection || new Connection ( {
25
- stream : config . stream ,
26
+ stream : config . stream ,
26
27
ssl : config . ssl
27
28
} ) ;
28
29
this . queryQueue = [ ] ;
@@ -112,10 +113,12 @@ p.connect = function(callback) {
112
113
} ) ;
113
114
con . on ( 'copyOutResponse' , function ( msg ) {
114
115
if ( self . activeQuery . stream === undefined ) {
115
- self . activeQuery . _canceledDueToError = new Error ( 'No destination stream defined' ) ;
116
- //canceling query requires creation of new connection
116
+ self . activeQuery . _canceledDueToError =
117
+ new Error ( 'No destination stream defined' ) ;
118
+ //canceling query requires creation of new connection
117
119
//look for postgres frontend/backend protocol
118
- ( new self . constructor ( { port : self . port , host : self . host } ) ) . cancel ( self , self . activeQuery ) ;
120
+ ( new self . constructor ( { port : self . port , host : self . host } ) )
121
+ . cancel ( self , self . activeQuery ) ;
119
122
}
120
123
} ) ;
121
124
con . on ( 'copyData' , function ( msg ) {
@@ -202,7 +205,7 @@ p._pulseQueryQueue = function() {
202
205
}
203
206
} ;
204
207
p . _copy = function ( text , stream ) {
205
- var config = { } ,
208
+ var config = { } ,
206
209
query ;
207
210
config . text = text ;
208
211
config . stream = stream ;
@@ -227,7 +230,8 @@ p.copyTo = function (text) {
227
230
} ;
228
231
p . query = function ( config , values , callback ) {
229
232
//can take in strings, config object or query object
230
- var query = ( config instanceof Query ) ? config : new Query ( config , values , callback ) ;
233
+ var query = ( config instanceof Query ) ? config :
234
+ new Query ( config , values , callback ) ;
231
235
if ( this . binary && ! query . binary ) {
232
236
query . binary = true ;
233
237
}
@@ -237,7 +241,8 @@ p.query = function(config, values, callback) {
237
241
return query ;
238
242
} ;
239
243
240
- //prevents client from otherwise emitting 'drain' event until 'resumeDrain' is called
244
+ //prevents client from otherwise emitting 'drain' event until 'resumeDrain' is
245
+ //called
241
246
p . pauseDrain = function ( ) {
242
247
this . _drainPaused = 1 ;
243
248
} ;
0 commit comments