diff --git a/lib/client.js b/lib/client.js index 173291f2..672943fa 100644 --- a/lib/client.js +++ b/lib/client.js @@ -9,6 +9,7 @@ var defaults = require(__dirname + '/defaults'); var Connection = require(__dirname + '/connection'); var CopyFromStream = require(__dirname + '/copystream').CopyFromStream; var CopyToStream = require(__dirname + '/copystream').CopyToStream; + var Client = function(config) { EventEmitter.call(this); @@ -22,7 +23,7 @@ var Client = function(config) { config = config || {}; this.connection = config.connection || new Connection({ - stream: config.stream, + stream: config.stream, ssl: config.ssl }); this.queryQueue = []; @@ -112,10 +113,12 @@ p.connect = function(callback) { }); con.on('copyOutResponse', function(msg) { if (self.activeQuery.stream === undefined) { - self.activeQuery._canceledDueToError = new Error('No destination stream defined'); - //canceling query requires creation of new connection + self.activeQuery._canceledDueToError = + new Error('No destination stream defined'); + //canceling query requires creation of new connection //look for postgres frontend/backend protocol - (new self.constructor({port: self.port, host: self.host})).cancel(self, self.activeQuery); + (new self.constructor({port: self.port, host: self.host})) + .cancel(self, self.activeQuery); } }); con.on('copyData', function (msg) { @@ -202,7 +205,7 @@ p._pulseQueryQueue = function() { } }; p._copy = function (text, stream) { - var config = {}, + var config = {}, query; config.text = text; config.stream = stream; @@ -227,7 +230,8 @@ p.copyTo = function (text) { }; p.query = function(config, values, callback) { //can take in strings, config object or query object - var query = (config instanceof Query) ? config : new Query(config, values, callback); + var query = (config instanceof Query) ? config : + new Query(config, values, callback); if (this.binary && !query.binary) { query.binary = true; } @@ -237,7 +241,8 @@ p.query = function(config, values, callback) { return query; }; -//prevents client from otherwise emitting 'drain' event until 'resumeDrain' is called +//prevents client from otherwise emitting 'drain' event until 'resumeDrain' is +//called p.pauseDrain = function() { this._drainPaused = 1; };