@@ -8,12 +8,12 @@ var CopyToStream = require(__dirname + '/../copystream').CopyToStream;
8
8
9
9
var binding ;
10
10
11
- try {
11
+ try {
12
12
//v0.5.x
13
- binding = require ( __dirname + '/../../build/Release/binding.node' ) ;
13
+ binding = require ( __dirname + '/../../build/Release/binding.node' ) ;
14
14
} catch ( e ) {
15
15
//v0.4.x
16
- binding = require ( __dirname + '/../../build/default/binding' ) ;
16
+ binding = require ( __dirname + '/../../build/default/binding' ) ;
17
17
}
18
18
19
19
var Connection = binding . Connection ;
@@ -59,7 +59,7 @@ p._copy = function (text, stream) {
59
59
} else {
60
60
q . stream . close ( ) ;
61
61
}
62
- } ) ;
62
+ } ) ;
63
63
q . stream = stream ;
64
64
this . _queryQueue . push ( q ) ;
65
65
this . _pulseQueryQueue ( ) ;
@@ -72,13 +72,14 @@ p.copyTo = function (text) {
72
72
return this . _copy ( text , new CopyToStream ( ) ) ;
73
73
} ;
74
74
p . sendCopyFromChunk = function ( chunk ) {
75
- this . _sendCopyFromChunk ( chunk ) ;
75
+ this . _sendCopyFromChunk ( chunk ) ;
76
76
} ;
77
77
p . endCopyFrom = function ( msg ) {
78
78
this . _endCopyFrom ( msg ) ;
79
79
} ;
80
80
p . query = function ( config , values , callback ) {
81
- var query = ( config instanceof NativeQuery ) ? config : new NativeQuery ( config , values , callback ) ;
81
+ var query = ( config instanceof NativeQuery ) ? config :
82
+ new NativeQuery ( config , values , callback ) ;
82
83
this . _queryQueue . push ( query ) ;
83
84
this . _pulseQueryQueue ( ) ;
84
85
return query ;
@@ -203,14 +204,16 @@ var clientBuilder = function(config) {
203
204
} ) ;
204
205
connection . on ( 'copyInResponse' , function ( ) {
205
206
//connection is ready to accept chunks
206
- //start to send data from stream
207
+ //start to send data from stream
207
208
connection . _activeQuery . streamData ( connection ) ;
208
209
} ) ;
209
210
connection . on ( 'copyOutResponse' , function ( msg ) {
210
- if ( connection . _activeQuery . stream === undefined ) {
211
- connection . _activeQuery . _canceledDueToError = new Error ( 'No destination stream defined' ) ;
212
- ( new clientBuilder ( { port : connection . port , host : connection . host } ) ) . cancel ( connection , connection . _activeQuery ) ;
213
- }
211
+ if ( connection . _activeQuery . stream === undefined ) {
212
+ connection . _activeQuery . _canceledDueToError =
213
+ new Error ( 'No destination stream defined' ) ;
214
+ ( new clientBuilder ( { port : connection . port , host : connection . host } ) )
215
+ . cancel ( connection , connection . _activeQuery ) ;
216
+ }
214
217
} ) ;
215
218
connection . on ( 'copyData' , function ( chunk ) {
216
219
//recieve chunk from connection
0 commit comments