mysql-pool
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -12,2 +12,3 @@ "use strict"; | ||
EventEmitter.call(this); | ||
this.properties = {}; | ||
@@ -24,3 +25,3 @@ // connections waiting for a query to execute | ||
case "Client": | ||
throw new Error("Deprecated: specify `library` instead of `Client`."); | ||
throw new Error("Deprecated: specify `mysql` instead of `Client`."); | ||
case "mysql": | ||
@@ -42,3 +43,3 @@ case "poolSize": | ||
} else if(typeof this.mysql == "string") { | ||
this.mysql = require(this.library); | ||
this.mysql = require(this.mysql); | ||
} | ||
@@ -45,0 +46,0 @@ |
{ | ||
"name": "mysql-pool", | ||
"description": "MySQL connection pool for node.js on top of node-mysql.", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"homepage": "https://github.com/Kijewski/node-mysql-pool", | ||
@@ -6,0 +6,0 @@ "repository": { |
@@ -35,22 +35,24 @@ <a name="Readme"></a> | ||
var MySQLPool = require("mysql-pool").MySQLPool; | ||
var pool = new MySQLPool({ | ||
poolSize: 4, | ||
user: 'root', | ||
password: 'root', | ||
database: 'test' | ||
}); | ||
pool.query("SELECT 'Hello, World!' AS hello", function(err, rows, fields) { | ||
if(err) throw err; | ||
console.log(rows[0].hello); | ||
}); | ||
for(var i = 0; i < 10; ++i) { | ||
pool.query("SELECT SLEEP(2), ? AS i", [i], function(err, rows, fields) { | ||
if(err) throw err; | ||
console.log("Slept: " + rows[0].i); | ||
}); | ||
} | ||
```javascript | ||
var MySQLPool = require("mysql-pool").MySQLPool; | ||
var pool = new MySQLPool({ | ||
poolSize: 4, | ||
user: 'root', | ||
password: 'root', | ||
database: 'test' | ||
}); | ||
pool.query("SELECT 'Hello, World!' AS hello", function(err, rows, fields) { | ||
if(err) throw err; | ||
console.log(rows[0].hello); | ||
}); | ||
for(var i = 0; i < 10; ++i) { | ||
pool.query("SELECT SLEEP(2), ? AS i", [i], function(err, rows, fields) { | ||
if(err) throw err; | ||
console.log("Slept: " + rows[0].i); | ||
}); | ||
} | ||
``` | ||
You probably do not have to change anything if you already used | ||
@@ -115,3 +117,3 @@ [node-mysql](https://github.com/felixge/node-mysql/) | ||
mysqlPool.Pool(options) | ||
mysqlPool.Pool([options]) | ||
@@ -121,3 +123,3 @@ creates a new, currently empty. Any property for the single connections or | ||
If the parameter `poolsize` is omitted, the value of `client.poolsize`, or 1 is used. | ||
If the parameter `poolsize` is omitted, 1 is used. | ||
@@ -124,0 +126,0 @@ Only if all connection attemps failed `err` is supplied. |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
143
213
12874