@@ -8,12 +8,12 @@ var CopyToStream = require(__dirname + '/../copystream').CopyToStream;
88
99var binding ;
1010
11- try {
11+ try {
1212 //v0.5.x
13- binding = require ( __dirname + '/../../build/Release/binding.node' ) ;
13+ binding = require ( __dirname + '/../../build/Release/binding.node' ) ;
1414} catch ( e ) {
1515 //v0.4.x
16- binding = require ( __dirname + '/../../build/default/binding' ) ;
16+ binding = require ( __dirname + '/../../build/default/binding' ) ;
1717}
1818
1919var Connection = binding . Connection ;
@@ -59,7 +59,7 @@ p._copy = function (text, stream) {
5959 } else {
6060 q . stream . close ( ) ;
6161 }
62- } ) ;
62+ } ) ;
6363 q . stream = stream ;
6464 this . _queryQueue . push ( q ) ;
6565 this . _pulseQueryQueue ( ) ;
@@ -72,13 +72,14 @@ p.copyTo = function (text) {
7272 return this . _copy ( text , new CopyToStream ( ) ) ;
7373} ;
7474p . sendCopyFromChunk = function ( chunk ) {
75- this . _sendCopyFromChunk ( chunk ) ;
75+ this . _sendCopyFromChunk ( chunk ) ;
7676} ;
7777p . endCopyFrom = function ( msg ) {
7878 this . _endCopyFrom ( msg ) ;
7979} ;
8080p . 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 ) ;
8283 this . _queryQueue . push ( query ) ;
8384 this . _pulseQueryQueue ( ) ;
8485 return query ;
@@ -203,14 +204,16 @@ var clientBuilder = function(config) {
203204 } ) ;
204205 connection . on ( 'copyInResponse' , function ( ) {
205206 //connection is ready to accept chunks
206- //start to send data from stream
207+ //start to send data from stream
207208 connection . _activeQuery . streamData ( connection ) ;
208209 } ) ;
209210 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+ }
214217 } ) ;
215218 connection . on ( 'copyData' , function ( chunk ) {
216219 //recieve chunk from connection
0 commit comments