diff --git a/lib/query.js b/lib/query.js index 5fb2200..65ffa44 100644 --- a/lib/query.js +++ b/lib/query.js @@ -8,9 +8,9 @@ var utils = require(__dirname + '/utils'); var Query = function(config, values, callback) { // use of "new" optional if (!(this instanceof Query)) { return new Query(config, values, callback); } - + config = utils.normalizeQueryConfig(config, values, callback); - + this.text = config.text; this.values = config.values; this.rows = config.rows; @@ -36,7 +36,7 @@ p.requiresPreparation = function() { //named queries must always be prepared if(this.name) { return true; } //always prepare if there are max number of rows expected per - //portal execution + //portal execution if(this.rows) { return true; } //don't prepare empty text queries if(!this.text) { return false; } @@ -179,14 +179,14 @@ p.prepare = function(connection) { }; p.streamData = function (connection) { if ( this.stream ) this.stream.startStreamingToConnection(connection); - else connection.sendCopyFail('No source stream defined'); + else connection.sendCopyFail('No source stream defined'); }; p.handleCopyFromChunk = function (chunk) { if ( this.stream ) { this.stream.handleChunk(chunk); - } + } //if there are no stream (for example when copy to query was sent by - //query method instead of copyTo) error will be handled - //on copyOutResponse event, so silently ignore this error here + //query method instead of copyTo) error will be handled + //on copyOutResponse event, so silently ignore this error here }; module.exports = Query;