fix jshint errors for lib/native/index.js

This commit is contained in:
Philipp Borgers 2013-01-21 14:16:41 +01:00
parent 2cc91225e3
commit 60a022b0b0

View File

@ -40,18 +40,18 @@ p.connect = function(cb) {
//remove single-fire connection error callback
self.removeListener('error', errCallback);
cb(null);
}
};
errCallback = function(err) {
//remove singel-fire connection success callback
self.removeListener('connect', connectCallback);
cb(err);
}
};
self.once('connect', connectCallback);
self.once('error', errCallback);
}
nativeConnect.call(self, conString);
})
}
});
};
p._copy = function (text, stream) {
var q = new NativeQuery(text, function (error) {
if (error) {
@ -64,7 +64,7 @@ p._copy = function (text, stream) {
this._queryQueue.push(q);
this._pulseQueryQueue();
return q.stream;
}
};
p.copyFrom = function (text) {
return this._copy(text, new CopyFromStream());
};
@ -82,7 +82,7 @@ p.query = function(config, values, callback) {
this._queryQueue.push(query);
this._pulseQueryQueue();
return query;
}
};
var nativeCancel = p.cancel;
@ -103,7 +103,11 @@ p._pulseQueryQueue = function(initialConnection) {
var query = this._queryQueue.shift();
if(!query) {
if(!initialConnection) {
this._drainPaused ? this._drainPaused++ : this.emit('drain');
if(this._drainPaused) {
this._drainPaused++;
} else {
this.emit('drain');
}
}
return;
}
@ -119,12 +123,12 @@ p._pulseQueryQueue = function(initialConnection) {
}
else if(query.values) {
//call native function
this._sendQueryWithParams(query.text, query.values)
this._sendQueryWithParams(query.text, query.values);
} else {
//call native function
this._sendQuery(query.text);
}
}
};
p.pauseDrain = function() {
this._drainPaused = 1;
@ -132,8 +136,8 @@ p.pauseDrain = function() {
p.resumeDrain = function() {
if(this._drainPaused > 1) {
this.emit('drain')
};
this.emit('drain');
}
this._drainPaused = 0;
};
p.sendCopyFail = function(msg) {