不要怂,就是干,撸起袖子干!

Commit 07273911 by Sascha Depold

refactoring

1 parent 00594184
Showing with 13 additions and 13 deletions
......@@ -10,6 +10,19 @@ var ConnectorManager = module.exports = function(config) {
this.maxConcurrentQueries = (this.config.maxConcurrentQueries || 50)
}
ConnectorManager.prototype.query = function(sql, callee, options) {
if(!this.isConnected) this.connect()
var queueItem = {
query: new Query(this.client, callee, options || {}),
sql: sql
}
this._enqueue(queueItem)
return queueItem.query
}
ConnectorManager.prototype.connect = function() {
var self = this
......@@ -24,19 +37,6 @@ ConnectorManager.prototype.connect = function() {
this.client.setMaxListeners(this.maxConcurrentQueries)
}
ConnectorManager.prototype.query = function(sql, callee, options) {
if(!this.isConnected) this.connect()
var queueItem = {
query: new Query(this.client, callee, options || {}),
sql: sql
}
this._enqueue(queueItem)
return queueItem.query
}
ConnectorManager.prototype.disconnect = function() {
var self = this
this.client.end(function() { self.client = null })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!