mysql-pool
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -11,3 +11,2 @@ "use strict"; | ||
var self = this; | ||
EventEmitter.call(this); | ||
@@ -19,4 +18,7 @@ | ||
// connections waiting for a query to execute | ||
this._idleQueue = []; | ||
// all connections that belong to this pool | ||
this._connectionPool = []; | ||
// queries to execute when a connection is ready | ||
this._todoQueue = []; | ||
@@ -113,2 +115,4 @@ | ||
var pool = this; | ||
var args = Array.prototype.slice.call(params.args); | ||
var cb = args.pop(); | ||
@@ -118,3 +122,3 @@ function mkCallback(client) { | ||
if(params.cb) { | ||
params.cb.apply(client, arguments); | ||
cb.apply(client, arguments); | ||
} else if(err) { | ||
@@ -150,10 +154,7 @@ pool.emit("error", err); | ||
} | ||
if(key in FOR_EACH) { | ||
return function(cb) { | ||
var args = Array.prototype.slice.call(arguments, 1); | ||
return function() { | ||
return this._forEach({ | ||
method: method, | ||
destroying: FOR_EACH[key], | ||
cb: cb, | ||
args: args | ||
method:method, args:arguments, destroying:FOR_EACH[key] | ||
}); | ||
@@ -163,9 +164,5 @@ }; | ||
pool[key + "All"] = function(cb) { | ||
var args = Array.prototype.slice.call(arguments, 1); | ||
pool[key + "All"] = function() { | ||
return this._forEach({ | ||
method: method, | ||
destroying: false, | ||
cb: cb, | ||
args: args | ||
method:method, args:arguments, destroying:false | ||
}); | ||
@@ -201,3 +198,3 @@ }; | ||
for(key in this.Client.prototype) { | ||
if(!key.match(/^_/) && !(key in this) && !(key in EventEmitter.prototype)) { | ||
if(!key.match(/^[_A-Z]/) && !(key in this) && !(key in EventEmitter.prototype)) { | ||
this[key] = mkPrototypeMethod(this.Client.prototype[key], key); | ||
@@ -204,0 +201,0 @@ } |
{ | ||
"name": "mysql-pool", | ||
"description": "MySQL connection pool for node.js on top of node-mysql.", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"homepage": "https://github.com/Kijewski/node-mysql-pool", | ||
@@ -6,0 +6,0 @@ "repository": { |
@@ -28,3 +28,3 @@ <h1 id="Readme">node-mysql-pool</h1> | ||
The node-mysql-pool works even with unknown forks of node-mysql, as long as | ||
The node-mysql-pool even works with unknown forks of node-mysql, as long as | ||
@@ -40,3 +40,3 @@ * the last parameter of any method is the callback function, | ||
var MySQLPool = require("./node-mysql-pool").MySQLPool, | ||
var MySQLPool = require("mysql-pool").MySQLPool, | ||
pool = new MySQLPool({database: "test"}); | ||
@@ -65,2 +65,10 @@ | ||
<h2 id="Installation">Installation</h2> | ||
* Using [npm](http://npmjs.org/): `npm install mysql-pool` | ||
* Using git: | ||
* `git clone git@github.com:Kijewski/node-mysql-pool.git node-mysql-pool` | ||
* *or* | ||
* `git submodule add git@github.com:Kijewski/node-mysql-pool.git deps/node-mysql-pool` | ||
<h2 id="API">API</h2> | ||
@@ -107,3 +115,3 @@ | ||
* If you do not want the npm version of node-mysql—e.g. because you forked and | ||
tweaked it for you purposes—you can supply a different `Client` object. | ||
tweaked it for your purposes—you can supply a different `Client` object. | ||
* `pool.properties.xyz = undefined`: | ||
@@ -142,2 +150,3 @@ * Property `xyz` of the `Client` object. | ||
query(sql, [params], cb) | ||
ping([cb])) | ||
statistics([cb]) | ||
@@ -144,0 +153,0 @@ |
12307
180
173