fix jshint errors for lib/query.js

This commit is contained in:
Philipp Borgers 2013-01-21 14:35:52 +01:00
parent 616804dc0d
commit da1e62e684

View File

@ -7,7 +7,7 @@ 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);
if (!(this instanceof Query)) { return new Query(config, values, callback); }
config = utils.normalizeQueryConfig(config, values, callback);
@ -19,7 +19,7 @@ var Query = function(config, values, callback) {
this.binary = config.binary;
this.stream = config.stream;
//use unique portal name each time
this.portal = config.portal || ""
this.portal = config.portal || "";
this.callback = config.callback;
this._fieldNames = [];
this._fieldConverters = [];
@ -34,15 +34,15 @@ var p = Query.prototype;
p.requiresPreparation = function() {
//named queries must always be prepared
if(this.name) return true;
if(this.name) { return true; }
//always prepare if there are max number of rows expected per
//portal execution
if(this.rows) return true;
if(this.rows) { return true; }
//don't prepare empty text queries
if(!this.text) return false;
if(!this.text) { return false; }
//binary should be prepared to specify results should be in binary
//unless there are no parameters
if(this.binary && !this.values) return false;
if(this.binary && !this.values) { return false; }
//prepare if there are values
return (this.values || 0).length > 0;
};
@ -64,7 +64,7 @@ p.handleRowDescription = function(msg) {
var format = field.format;
this._fieldNames[i] = field.name;
this._fieldConverters[i] = Types.getTypeParser(field.dataTypeID, format);
};
}
};
p.handleDataRow = function(msg) {
@ -110,7 +110,7 @@ p.handleError = function(err) {
//if callback supplied do not emit error event as uncaught error
//events will bubble up to node process
if(this.callback) {
this.callback(err)
this.callback(err);
} else {
this.emit('error', err);
}
@ -188,5 +188,5 @@ p.handleCopyFromChunk = function (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
}
};
module.exports = Query;